作者 lyh

gx数据

... ... @@ -105,4 +105,33 @@ class GeoQuestionResController extends BaseController
$data['platform'] = $this->logic->platformHitCount();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取搜索时间
* @name :getSearchDate
* @author :lyh
* @method :post
* @time :2025/7/21 16:35
*/
public function getSearchDate(){
$data = $this->logic->getSearchDate();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取搜索列表
* @name :getSearchList
* @author :lyh
* @method :post
* @time :2025/7/21 16:47
*/
public function getSearchList(){
$this->request->validate([
'created_at'=>'required',
],[
'created_at.required' => 'created_at不能为空',
]);
$data = $this->logic->getSearchList($this->map,$this->page,$this->row);
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -12,6 +12,7 @@ namespace App\Http\Logic\Bside\Geo;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Geo\GeoPlatform;
use App\Models\Geo\GeoQuestion;
use App\Models\Geo\GeoQuestionLog;
use App\Models\Geo\GeoQuestionResult;
class GeoQuestionResLogic extends BaseLogic
... ... @@ -122,4 +123,37 @@ class GeoQuestionResLogic extends BaseLogic
}
return $this->success($data);
}
/**
* @remark :获取搜索时间
* @name :getSearchDate
* @author :lyh
* @method :post
* @time :2025/7/21 16:36
*/
public function getSearchDate(){
$dates = $this->model->select(DB::raw('DATE(created_at) as date_only'))->distinct()->pluck('date_only');
return $this->success($dates);
}
/**
* @remark :获取搜索列表
* @name :getSearchList
* @author :lyh
* @method :post
* @time :2025/7/21 16:48
*/
public function getSearchList($map = [],$page = 1,$row = 20){
$filed = ['id','project_id','question_id','platform','question','en_question','keywords','url','created_at','updated_at'];
$map['project_id'] = $this->user['project_id'];
$map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].'23:59:59']];
$resLogModel = new GeoQuestionLog();
$query = $resLogModel->formatQuery($map);
$query = $query->where(function ($q) {
$q->whereRaw('JSON_LENGTH(keywords) > 0')
->orWhereRaw('JSON_LENGTH(url) > 0');
});
$data = $query->orderByRaw('CHAR_LENGTH(question) ASC')->paginate($row, $filed, 'page', $page);
return $this->success($data);
}
}
... ...
... ... @@ -756,6 +756,8 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/getType', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getType'])->name('geo_result_getType');//geo设置类型
Route::any('/getCount', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getCount'])->name('geo_result_getCount');//geo设置类型统计数量
Route::any('/countQuantity', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'countQuantity'])->name('geo_result_countQuantity');//geo统计
Route::any('/getSearchDate', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getSearchDate'])->name('geo_result_getSearchDate');//geo获取请求时间的记录
Route::any('/getSearchList', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getSearchList'])->name('geo_result_getSearchList');//搜索记录列表
});
});
//无需登录验证的路由组
... ...