作者 刘锟

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

... ... @@ -31,14 +31,27 @@ class VisitController extends BaseController
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :
* @name :item
* @author :lyh
* @method :post
* @time :2024/5/6 16:26
*/
public function item(VisitLogic $logic){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$data = $logic->getItemList();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :导出详情
* @name :downloadIndex
* @author :lyh
* @method :post
* @time :2024/5/6 16:42
*/
public function downloadIndex(VisitLogic $logic){
$data = $logic->downloadItem($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -451,7 +451,7 @@ class ImageController extends Controller
foreach ($files as $file){
if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){
if ($file->getSize() > $this->cache['image_max'] * 1024) {
$this->response('图片最大为1024K',Code::SYSTEM_ERROR);
$this->response('图片最大为'.$this->cache['image_max'],Code::SYSTEM_ERROR);
}
}else{
if ($file->getSize() > $max) {
... ... @@ -462,7 +462,7 @@ class ImageController extends Controller
}else{
if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){
if ($files->getSize() > $this->cache['image_max'] * 1024) {
$this->response('图片最大为1024K',Code::SYSTEM_ERROR);
$this->response('图片最大为'.$this->cache['image_max'],Code::SYSTEM_ERROR);
}
}else{
if ($files->getSize() > $max) {
... ...
... ... @@ -31,12 +31,32 @@ class VisitLogic extends BaseLogic
public function getItemList(){
$this->model = new VisitItem();
$map = [
'customer_visit_id' => $this->param['id'],
// 'domain' => $this->user['domain'],
];
$data = $this->model->list($map, 'created_at');
if(isset($this->param['id']) && !empty($this->param['id'])){
$map = [
'customer_visit_id' => $this->param['id'],
];
}
$data = $this->model->list($map ?? [], 'created_at');
return $this->success($data);
}
/**
* @remark :导出数据
* @name :downloadItem
* @author :lyh
* @method :post
* @time :2024/5/6 16:39
*/
public function downloadItem($map,$page,$row,$order,$filed = ['*']){
$lists = $this->model->lists($map,$page,$row,$order,$filed);
$itemModel = new VisitItem();
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['sub'] = $itemModel->list(['customer_visit_id' => $v['id']]);
$lists['list'][$k] = $v;
}
}
return $this->success($lists);
}
}
... ...
... ... @@ -21,7 +21,7 @@ class Visit extends Base
//连接数据库
protected $connection = 'custom_mysql';
protected $appends = ['device_text'];
protected $fillable = ['ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at'];
// protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at'];
const DEVICE_PC = 1;
const DEVICE_MOBILE = 2;
... ...
... ... @@ -438,6 +438,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('visit')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'index'])->name('visit_list');
Route::any('/item', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'item'])->name('visit_item');
Route::any('/downloadIndex', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'downloadIndex'])->name('visit_downloadIndex');
});
//访问数据
... ...