合并分支 'akun' 到 'master'
Akun 查看合并请求 !3357
正在显示
3 个修改的文件
包含
60 行增加
和
4 行删除
| @@ -127,13 +127,36 @@ class GeoQuestionController extends BaseController | @@ -127,13 +127,36 @@ class GeoQuestionController extends BaseController | ||
| 127 | $this->response('success',Code::SUCCESS,$data); | 127 | $this->response('success',Code::SUCCESS,$data); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | + /** | ||
| 131 | + * 未命中问题列表 | ||
| 132 | + * @author Akun | ||
| 133 | + * @date 2025/11/27 10:01 | ||
| 134 | + */ | ||
| 130 | public function unHitQuestionList(){ | 135 | public function unHitQuestionList(){ |
| 131 | $this->request->validate([ | 136 | $this->request->validate([ |
| 132 | 'project_id'=>'required', | 137 | 'project_id'=>'required', |
| 133 | ],[ | 138 | ],[ |
| 134 | 'project_id.required' => '项目ID不能为空', | 139 | 'project_id.required' => '项目ID不能为空', |
| 135 | ]); | 140 | ]); |
| 136 | - $data = $this->logic->getUnHitQuestionList(); | 141 | + $data = $this->logic->unHitQuestionList(); |
| 137 | $this->response('success',Code::SUCCESS,$data); | 142 | $this->response('success',Code::SUCCESS,$data); |
| 138 | } | 143 | } |
| 144 | + | ||
| 145 | + /** | ||
| 146 | + * 删除未命中问题 | ||
| 147 | + * @author Akun | ||
| 148 | + * @date 2025/11/27 10:34 | ||
| 149 | + */ | ||
| 150 | + public function delUnHitQuestion(){ | ||
| 151 | + $this->request->validate([ | ||
| 152 | + 'project_id'=>'required', | ||
| 153 | + 'question'=>'required', | ||
| 154 | + ],[ | ||
| 155 | + 'project_id.required' => '项目ID不能为空', | ||
| 156 | + 'question.required' => '问题不能为空', | ||
| 157 | + ]); | ||
| 158 | + | ||
| 159 | + $this->logic->delUnHitQuestion(); | ||
| 160 | + $this->response('success',Code::SUCCESS); | ||
| 161 | + } | ||
| 139 | } | 162 | } |
| @@ -14,6 +14,7 @@ use App\Models\Geo\GeoPlatform; | @@ -14,6 +14,7 @@ use App\Models\Geo\GeoPlatform; | ||
| 14 | use App\Models\Geo\GeoQuestion; | 14 | use App\Models\Geo\GeoQuestion; |
| 15 | use App\Models\Geo\GeoQuestionResult; | 15 | use App\Models\Geo\GeoQuestionResult; |
| 16 | use App\Models\Project\Project; | 16 | use App\Models\Project\Project; |
| 17 | +use Illuminate\Support\Facades\DB; | ||
| 17 | 18 | ||
| 18 | class GeoQuestionLogic extends BaseLogic | 19 | class GeoQuestionLogic extends BaseLogic |
| 19 | { | 20 | { |
| @@ -138,12 +139,12 @@ class GeoQuestionLogic extends BaseLogic | @@ -138,12 +139,12 @@ class GeoQuestionLogic extends BaseLogic | ||
| 138 | } | 139 | } |
| 139 | 140 | ||
| 140 | /** | 141 | /** |
| 141 | - * 获取未名字的问题列表 | 142 | + * 获取未命中的问题列表 |
| 142 | * @return array | 143 | * @return array |
| 143 | * @author Akun | 144 | * @author Akun |
| 144 | * @date 2025/11/25 16:44 | 145 | * @date 2025/11/25 16:44 |
| 145 | */ | 146 | */ |
| 146 | - public function getUnHitQuestionList(){ | 147 | + public function unHitQuestionList(){ |
| 147 | $data = GeoQuestionResult::where('project_id',$this->param['project_id'])->where('hit',0)->select('platform','question')->get()->toArray(); | 148 | $data = GeoQuestionResult::where('project_id',$this->param['project_id'])->where('hit',0)->select('platform','question')->get()->toArray(); |
| 148 | $list = []; | 149 | $list = []; |
| 149 | if(!empty($data)){ | 150 | if(!empty($data)){ |
| @@ -160,10 +161,41 @@ class GeoQuestionLogic extends BaseLogic | @@ -160,10 +161,41 @@ class GeoQuestionLogic extends BaseLogic | ||
| 160 | 161 | ||
| 161 | if(!empty($temp)){ | 162 | if(!empty($temp)){ |
| 162 | foreach ($temp as $kt=>$vt){ | 163 | foreach ($temp as $kt=>$vt){ |
| 163 | - $list[] = ['question'=>$kt,'platform'=>$vt]; | 164 | + $list[] = ['question'=>$kt,'platform'=>array_unique($vt)]; |
| 164 | } | 165 | } |
| 165 | } | 166 | } |
| 166 | } | 167 | } |
| 167 | return $this->success($list); | 168 | return $this->success($list); |
| 168 | } | 169 | } |
| 170 | + | ||
| 171 | + /** | ||
| 172 | + * 删除未命中问题 | ||
| 173 | + * @throws \App\Exceptions\AsideGlobalException | ||
| 174 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 175 | + * @author Akun | ||
| 176 | + * @date 2025/11/27 10:51 | ||
| 177 | + */ | ||
| 178 | + public function delUnHitQuestion(){ | ||
| 179 | + $question = $this->param['question']; | ||
| 180 | + $project_id = $this->param['project_id']; | ||
| 181 | + | ||
| 182 | + DB::beginTransaction(); | ||
| 183 | + try { | ||
| 184 | + //删除问题结果 | ||
| 185 | + $resultModel = new GeoQuestionResult(); | ||
| 186 | + $resultModel->del([ | ||
| 187 | + 'project_id' => $project_id, | ||
| 188 | + 'question' => $question | ||
| 189 | + ]); | ||
| 190 | + | ||
| 191 | + //删除问题 | ||
| 192 | + $lists = $this->model->select(['id','question'])->where('project_id', $project_id)->whereJsonContains('question', [['Value' => $question]])->get()->toArray(); | ||
| 193 | + dd($lists); | ||
| 194 | + | ||
| 195 | + DB::commit(); | ||
| 196 | + }catch (\Exception $e){ | ||
| 197 | + DB::rollBack(); | ||
| 198 | + $this->fail('删除问题失败, error:' . $e->getMessage()); | ||
| 199 | + } | ||
| 200 | + } | ||
| 169 | } | 201 | } |
| @@ -575,6 +575,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -575,6 +575,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 575 | Route::any('/saveGeoQuestion', [Aside\Geo\GeoQuestionController::class, 'saveGeoQuestion'])->name('admin.geo_question_saveGeoQuestion'); | 575 | Route::any('/saveGeoQuestion', [Aside\Geo\GeoQuestionController::class, 'saveGeoQuestion'])->name('admin.geo_question_saveGeoQuestion'); |
| 576 | Route::any('/delGeoQuestion', [Aside\Geo\GeoQuestionController::class, 'delGeoQuestion'])->name('admin.geo_question_delGeoQuestion'); | 576 | Route::any('/delGeoQuestion', [Aside\Geo\GeoQuestionController::class, 'delGeoQuestion'])->name('admin.geo_question_delGeoQuestion'); |
| 577 | Route::any('/unHitQuestionList', [Aside\Geo\GeoQuestionController::class, 'unHitQuestionList'])->name('admin.geo_question_unHitQuestionList'); | 577 | Route::any('/unHitQuestionList', [Aside\Geo\GeoQuestionController::class, 'unHitQuestionList'])->name('admin.geo_question_unHitQuestionList'); |
| 578 | + Route::any('/delUnHitQuestion', [Aside\Geo\GeoQuestionController::class, 'delUnHitQuestion'])->name('admin.geo_question_delUnHitQuestion'); | ||
| 578 | }); | 579 | }); |
| 579 | //文章列表 | 580 | //文章列表 |
| 580 | Route::prefix('article')->group(function () { | 581 | Route::prefix('article')->group(function () { |
-
请 注册 或 登录 后发表评论