正在显示
3 个修改的文件
包含
65 行增加
和
0 行删除
| @@ -105,4 +105,33 @@ class GeoQuestionResController extends BaseController | @@ -105,4 +105,33 @@ class GeoQuestionResController extends BaseController | ||
| 105 | $data['platform'] = $this->logic->platformHitCount(); | 105 | $data['platform'] = $this->logic->platformHitCount(); |
| 106 | $this->response('success',Code::SUCCESS,$data); | 106 | $this->response('success',Code::SUCCESS,$data); |
| 107 | } | 107 | } |
| 108 | + | ||
| 109 | + /** | ||
| 110 | + * @remark :获取搜索时间 | ||
| 111 | + * @name :getSearchDate | ||
| 112 | + * @author :lyh | ||
| 113 | + * @method :post | ||
| 114 | + * @time :2025/7/21 16:35 | ||
| 115 | + */ | ||
| 116 | + public function getSearchDate(){ | ||
| 117 | + $data = $this->logic->getSearchDate(); | ||
| 118 | + $this->response('success',Code::SUCCESS,$data); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * @remark :获取搜索列表 | ||
| 123 | + * @name :getSearchList | ||
| 124 | + * @author :lyh | ||
| 125 | + * @method :post | ||
| 126 | + * @time :2025/7/21 16:47 | ||
| 127 | + */ | ||
| 128 | + public function getSearchList(){ | ||
| 129 | + $this->request->validate([ | ||
| 130 | + 'created_at'=>'required', | ||
| 131 | + ],[ | ||
| 132 | + 'created_at.required' => 'created_at不能为空', | ||
| 133 | + ]); | ||
| 134 | + $data = $this->logic->getSearchList($this->map,$this->page,$this->row); | ||
| 135 | + $this->response('success',Code::SUCCESS,$data); | ||
| 136 | + } | ||
| 108 | } | 137 | } |
| @@ -12,6 +12,7 @@ namespace App\Http\Logic\Bside\Geo; | @@ -12,6 +12,7 @@ namespace App\Http\Logic\Bside\Geo; | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | use App\Models\Geo\GeoPlatform; | 13 | use App\Models\Geo\GeoPlatform; |
| 14 | use App\Models\Geo\GeoQuestion; | 14 | use App\Models\Geo\GeoQuestion; |
| 15 | +use App\Models\Geo\GeoQuestionLog; | ||
| 15 | use App\Models\Geo\GeoQuestionResult; | 16 | use App\Models\Geo\GeoQuestionResult; |
| 16 | 17 | ||
| 17 | class GeoQuestionResLogic extends BaseLogic | 18 | class GeoQuestionResLogic extends BaseLogic |
| @@ -122,4 +123,37 @@ class GeoQuestionResLogic extends BaseLogic | @@ -122,4 +123,37 @@ class GeoQuestionResLogic extends BaseLogic | ||
| 122 | } | 123 | } |
| 123 | return $this->success($data); | 124 | return $this->success($data); |
| 124 | } | 125 | } |
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * @remark :获取搜索时间 | ||
| 129 | + * @name :getSearchDate | ||
| 130 | + * @author :lyh | ||
| 131 | + * @method :post | ||
| 132 | + * @time :2025/7/21 16:36 | ||
| 133 | + */ | ||
| 134 | + public function getSearchDate(){ | ||
| 135 | + $dates = $this->model->select(DB::raw('DATE(created_at) as date_only'))->distinct()->pluck('date_only'); | ||
| 136 | + return $this->success($dates); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * @remark :获取搜索列表 | ||
| 141 | + * @name :getSearchList | ||
| 142 | + * @author :lyh | ||
| 143 | + * @method :post | ||
| 144 | + * @time :2025/7/21 16:48 | ||
| 145 | + */ | ||
| 146 | + public function getSearchList($map = [],$page = 1,$row = 20){ | ||
| 147 | + $filed = ['id','project_id','question_id','platform','question','en_question','keywords','url','created_at','updated_at']; | ||
| 148 | + $map['project_id'] = $this->user['project_id']; | ||
| 149 | + $map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].'23:59:59']]; | ||
| 150 | + $resLogModel = new GeoQuestionLog(); | ||
| 151 | + $query = $resLogModel->formatQuery($map); | ||
| 152 | + $query = $query->where(function ($q) { | ||
| 153 | + $q->whereRaw('JSON_LENGTH(keywords) > 0') | ||
| 154 | + ->orWhereRaw('JSON_LENGTH(url) > 0'); | ||
| 155 | + }); | ||
| 156 | + $data = $query->orderByRaw('CHAR_LENGTH(question) ASC')->paginate($row, $filed, 'page', $page); | ||
| 157 | + return $this->success($data); | ||
| 158 | + } | ||
| 125 | } | 159 | } |
| @@ -756,6 +756,8 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -756,6 +756,8 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 756 | Route::any('/getType', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getType'])->name('geo_result_getType');//geo设置类型 | 756 | Route::any('/getType', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getType'])->name('geo_result_getType');//geo设置类型 |
| 757 | Route::any('/getCount', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getCount'])->name('geo_result_getCount');//geo设置类型统计数量 | 757 | Route::any('/getCount', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getCount'])->name('geo_result_getCount');//geo设置类型统计数量 |
| 758 | Route::any('/countQuantity', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'countQuantity'])->name('geo_result_countQuantity');//geo统计 | 758 | Route::any('/countQuantity', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'countQuantity'])->name('geo_result_countQuantity');//geo统计 |
| 759 | + Route::any('/getSearchDate', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getSearchDate'])->name('geo_result_getSearchDate');//geo获取请求时间的记录 | ||
| 760 | + Route::any('/getSearchList', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getSearchList'])->name('geo_result_getSearchList');//搜索记录列表 | ||
| 759 | }); | 761 | }); |
| 760 | }); | 762 | }); |
| 761 | //无需登录验证的路由组 | 763 | //无需登录验证的路由组 |
-
请 注册 或 登录 后发表评论