作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -31,14 +31,27 @@ class VisitController extends BaseController @@ -31,14 +31,27 @@ class VisitController extends BaseController
31 $this->response('success',Code::SUCCESS,$data); 31 $this->response('success',Code::SUCCESS,$data);
32 } 32 }
33 33
  34 + /**
  35 + * @remark :
  36 + * @name :item
  37 + * @author :lyh
  38 + * @method :post
  39 + * @time :2024/5/6 16:26
  40 + */
34 public function item(VisitLogic $logic){ 41 public function item(VisitLogic $logic){
35 - $this->request->validate([  
36 - 'id'=>'required'  
37 - ],[  
38 - 'id.required' => 'ID不能为空'  
39 - ]);  
40 $data = $logic->getItemList(); 42 $data = $logic->getItemList();
41 $this->response('success',Code::SUCCESS,$data); 43 $this->response('success',Code::SUCCESS,$data);
42 } 44 }
43 45
  46 + /**
  47 + * @remark :导出详情
  48 + * @name :downloadIndex
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2024/5/6 16:42
  52 + */
  53 + public function downloadIndex(VisitLogic $logic){
  54 + $data = $logic->downloadItem($this->map,$this->page,$this->row,$this->order);
  55 + $this->response('success',Code::SUCCESS,$data);
  56 + }
44 } 57 }
@@ -451,7 +451,7 @@ class ImageController extends Controller @@ -451,7 +451,7 @@ class ImageController extends Controller
451 foreach ($files as $file){ 451 foreach ($files as $file){
452 if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){ 452 if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){
453 if ($file->getSize() > $this->cache['image_max'] * 1024) { 453 if ($file->getSize() > $this->cache['image_max'] * 1024) {
454 - $this->response('图片最大为1024K',Code::SYSTEM_ERROR); 454 + $this->response('图片最大为'.$this->cache['image_max'],Code::SYSTEM_ERROR);
455 } 455 }
456 }else{ 456 }else{
457 if ($file->getSize() > $max) { 457 if ($file->getSize() > $max) {
@@ -462,7 +462,7 @@ class ImageController extends Controller @@ -462,7 +462,7 @@ class ImageController extends Controller
462 }else{ 462 }else{
463 if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){ 463 if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){
464 if ($files->getSize() > $this->cache['image_max'] * 1024) { 464 if ($files->getSize() > $this->cache['image_max'] * 1024) {
465 - $this->response('图片最大为1024K',Code::SYSTEM_ERROR); 465 + $this->response('图片最大为'.$this->cache['image_max'],Code::SYSTEM_ERROR);
466 } 466 }
467 }else{ 467 }else{
468 if ($files->getSize() > $max) { 468 if ($files->getSize() > $max) {
@@ -31,12 +31,32 @@ class VisitLogic extends BaseLogic @@ -31,12 +31,32 @@ class VisitLogic extends BaseLogic
31 31
32 public function getItemList(){ 32 public function getItemList(){
33 $this->model = new VisitItem(); 33 $this->model = new VisitItem();
34 - $map = [  
35 - 'customer_visit_id' => $this->param['id'],  
36 -// 'domain' => $this->user['domain'],  
37 - ];  
38 - $data = $this->model->list($map, 'created_at'); 34 + if(isset($this->param['id']) && !empty($this->param['id'])){
  35 + $map = [
  36 + 'customer_visit_id' => $this->param['id'],
  37 + ];
  38 + }
  39 + $data = $this->model->list($map ?? [], 'created_at');
39 return $this->success($data); 40 return $this->success($data);
40 } 41 }
41 42
  43 + /**
  44 + * @remark :导出数据
  45 + * @name :downloadItem
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2024/5/6 16:39
  49 + */
  50 + public function downloadItem($map,$page,$row,$order,$filed = ['*']){
  51 + $lists = $this->model->lists($map,$page,$row,$order,$filed);
  52 + $itemModel = new VisitItem();
  53 + if(!empty($lists) && !empty($lists['list'])){
  54 + foreach ($lists['list'] as $k => $v){
  55 + $v['sub'] = $itemModel->list(['customer_visit_id' => $v['id']]);
  56 + $lists['list'][$k] = $v;
  57 + }
  58 + }
  59 + return $this->success($lists);
  60 + }
  61 +
42 } 62 }
@@ -21,7 +21,7 @@ class Visit extends Base @@ -21,7 +21,7 @@ class Visit extends Base
21 //连接数据库 21 //连接数据库
22 protected $connection = 'custom_mysql'; 22 protected $connection = 'custom_mysql';
23 protected $appends = ['device_text']; 23 protected $appends = ['device_text'];
24 - protected $fillable = ['ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at']; 24 +// protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at'];
25 25
26 const DEVICE_PC = 1; 26 const DEVICE_PC = 1;
27 const DEVICE_MOBILE = 2; 27 const DEVICE_MOBILE = 2;
@@ -438,6 +438,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -438,6 +438,7 @@ Route::middleware(['bloginauth'])->group(function () {
438 Route::prefix('visit')->group(function () { 438 Route::prefix('visit')->group(function () {
439 Route::any('/', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'index'])->name('visit_list'); 439 Route::any('/', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'index'])->name('visit_list');
440 Route::any('/item', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'item'])->name('visit_item'); 440 Route::any('/item', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'item'])->name('visit_item');
  441 + Route::any('/downloadIndex', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'downloadIndex'])->name('visit_downloadIndex');
441 }); 442 });
442 443
443 //访问数据 444 //访问数据