Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate
正在显示
7 个修改的文件
包含
116 行增加
和
7 行删除
| @@ -9,7 +9,6 @@ | @@ -9,7 +9,6 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Controllers\Aside\Com; | 10 | namespace App\Http\Controllers\Aside\Com; |
| 11 | 11 | ||
| 12 | -use App\Helper\Common; | ||
| 13 | use App\Http\Controllers\Bside\BaseController; | 12 | use App\Http\Controllers\Bside\BaseController; |
| 14 | use App\Models\Com\UpdateLog; | 13 | use App\Models\Com\UpdateLog; |
| 15 | use App\Models\Com\UpdateOldInfo; | 14 | use App\Models\Com\UpdateOldInfo; |
| @@ -17,7 +16,6 @@ use App\Models\Domain\DomainInfo; | @@ -17,7 +16,6 @@ use App\Models\Domain\DomainInfo; | ||
| 17 | use App\Models\Project\ProjectUpdateTdk; | 16 | use App\Models\Project\ProjectUpdateTdk; |
| 18 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| 19 | use Illuminate\Support\Facades\DB; | 18 | use Illuminate\Support\Facades\DB; |
| 20 | -use Illuminate\Support\Facades\Redis; | ||
| 21 | 19 | ||
| 22 | /** | 20 | /** |
| 23 | * @remark :b端网站更新相关 | 21 | * @remark :b端网站更新相关 |
| @@ -105,12 +103,23 @@ class UpdateController extends BaseController | @@ -105,12 +103,23 @@ class UpdateController extends BaseController | ||
| 105 | //关闭数据库 | 103 | //关闭数据库 |
| 106 | DB::disconnect('custom_mysql'); | 104 | DB::disconnect('custom_mysql'); |
| 107 | 105 | ||
| 108 | - $update = ['collect_status' => 0]; | ||
| 109 | - if ($this->param['type'] == 2 && !$domain_info) { | ||
| 110 | - $update['status'] = 0; | 106 | + if ($domain_info) { |
| 107 | + $old_info = UpdateOldInfo::where('project_id', $this->param['project_id'])->first(); | ||
| 108 | + if (!$old_info) { | ||
| 109 | + $old_info = new UpdateOldInfo(); | ||
| 110 | + $old_info->project_id = $this->param['project_id']; | ||
| 111 | + $old_info->link_type = 0; | ||
| 112 | + $old_info->old_domain_online = $domain_info->domain; | ||
| 113 | + } | ||
| 114 | + $old_info->old_domain_test = $test_domain; | ||
| 115 | + $old_info->save(); | ||
| 111 | } | 116 | } |
| 112 | 117 | ||
| 113 | - UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update); | 118 | + UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news', 'website_info', 'tag'])->update(['collect_status' => 0]); |
| 119 | + | ||
| 120 | + if ($this->param['type'] == 2 && !$domain_info) { | ||
| 121 | + UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->update(['status' => 0]); | ||
| 122 | + } | ||
| 114 | 123 | ||
| 115 | $this->response('采集任务添加成功'); | 124 | $this->response('采集任务添加成功'); |
| 116 | } | 125 | } |
| @@ -287,4 +287,25 @@ class BlogController extends BaseController | @@ -287,4 +287,25 @@ class BlogController extends BaseController | ||
| 287 | $logic->setAllSort(); | 287 | $logic->setAllSort(); |
| 288 | $this->response('success'); | 288 | $this->response('success'); |
| 289 | } | 289 | } |
| 290 | + | ||
| 291 | + /** | ||
| 292 | + * @remark :批量设置产品分类及状态 | ||
| 293 | + * @name :batchSetCategory | ||
| 294 | + * @author :lyh | ||
| 295 | + * @method :post | ||
| 296 | + * @time :2023/8/15 17:51 | ||
| 297 | + */ | ||
| 298 | + public function batchSetCategory(BlogLogic $logic){ | ||
| 299 | + $this->request->validate([ | ||
| 300 | + 'id'=>'required', | ||
| 301 | + 'category_id'=>'required', | ||
| 302 | + 'status'=>'required' | ||
| 303 | + ],[ | ||
| 304 | + 'id.required' => '产品ID不能为空', | ||
| 305 | + 'category_id.required' => '分类ID不能为空', | ||
| 306 | + 'status.required'=>'状态不能为空' | ||
| 307 | + ]); | ||
| 308 | + $logic->batchSetCategory(); | ||
| 309 | + $this->response('success'); | ||
| 310 | + } | ||
| 290 | } | 311 | } |
| @@ -274,4 +274,26 @@ class NewsController extends BaseController | @@ -274,4 +274,26 @@ class NewsController extends BaseController | ||
| 274 | $newsLogic->setAllSort(); | 274 | $newsLogic->setAllSort(); |
| 275 | $this->response('success'); | 275 | $this->response('success'); |
| 276 | } | 276 | } |
| 277 | + | ||
| 278 | + | ||
| 279 | + /** | ||
| 280 | + * @remark :批量设置产品分类及状态 | ||
| 281 | + * @name :batchSetCategory | ||
| 282 | + * @author :lyh | ||
| 283 | + * @method :post | ||
| 284 | + * @time :2023/8/15 17:51 | ||
| 285 | + */ | ||
| 286 | + public function batchSetCategory(NewsLogic $logic){ | ||
| 287 | + $this->request->validate([ | ||
| 288 | + 'id'=>'required', | ||
| 289 | + 'category_id'=>'required', | ||
| 290 | + 'status'=>'required' | ||
| 291 | + ],[ | ||
| 292 | + 'id.required' => '产品ID不能为空', | ||
| 293 | + 'category_id.required' => '分类ID不能为空', | ||
| 294 | + 'status.required'=>'状态不能为空' | ||
| 295 | + ]); | ||
| 296 | + $logic->batchSetCategory(); | ||
| 297 | + $this->response('success'); | ||
| 298 | + } | ||
| 277 | } | 299 | } |
| @@ -361,7 +361,7 @@ class BTemplateLogic extends BaseLogic | @@ -361,7 +361,7 @@ class BTemplateLogic extends BaseLogic | ||
| 361 | 'template_id' => $template_id, | 361 | 'template_id' => $template_id, |
| 362 | 'project_id' => $this->user['project_id'], | 362 | 'project_id' => $this->user['project_id'], |
| 363 | 'type'=>$type, | 363 | 'type'=>$type, |
| 364 | - 'is_custom'=>$is_custom, | 364 | + 'is_custom'=>0, |
| 365 | ]; | 365 | ]; |
| 366 | $commonTemplateModel = new BTemplateCommon(); | 366 | $commonTemplateModel = new BTemplateCommon(); |
| 367 | $commonInfo = $commonTemplateModel->read($data); | 367 | $commonInfo = $commonTemplateModel->read($data); |
| @@ -362,4 +362,32 @@ class BlogLogic extends BaseLogic | @@ -362,4 +362,32 @@ class BlogLogic extends BaseLogic | ||
| 362 | 362 | ||
| 363 | return false; | 363 | return false; |
| 364 | } | 364 | } |
| 365 | + | ||
| 366 | + /** | ||
| 367 | + * @remark :批量设置产品分类及状态 | ||
| 368 | + * @name :batchSetCategory | ||
| 369 | + * @author :lyh | ||
| 370 | + * @method :post | ||
| 371 | + * @time :2023/8/15 17:53 | ||
| 372 | + */ | ||
| 373 | + public function batchSetCategory(){ | ||
| 374 | + if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { | ||
| 375 | + DB::connection('custom_mysql')->beginTransaction(); | ||
| 376 | + $this->param['category_id'] = ','.implode(',',$this->param['category_id']).','; | ||
| 377 | + try { | ||
| 378 | + //批量 | ||
| 379 | + $param = [ | ||
| 380 | + 'category_id'=>$this->param['category_id'], | ||
| 381 | + 'status'=>$this->param['status'] | ||
| 382 | + ]; | ||
| 383 | + $this->model->edit($param,['id'=>['in',$this->param['id']]]); | ||
| 384 | + DB::connection('custom_mysql')->commit(); | ||
| 385 | + //对应添加关联表 | ||
| 386 | + }catch (\Exception $e){ | ||
| 387 | + DB::connection('custom_mysql')->rollBack(); | ||
| 388 | + $this->fail('系统错误,请联系管理员'); | ||
| 389 | + } | ||
| 390 | + } | ||
| 391 | + return $this->success(); | ||
| 392 | + } | ||
| 365 | } | 393 | } |
| @@ -396,4 +396,32 @@ class NewsLogic extends BaseLogic | @@ -396,4 +396,32 @@ class NewsLogic extends BaseLogic | ||
| 396 | 396 | ||
| 397 | return false; | 397 | return false; |
| 398 | } | 398 | } |
| 399 | + | ||
| 400 | + /** | ||
| 401 | + * @remark :批量设置产品分类及状态 | ||
| 402 | + * @name :batchSetCategory | ||
| 403 | + * @author :lyh | ||
| 404 | + * @method :post | ||
| 405 | + * @time :2023/8/15 17:53 | ||
| 406 | + */ | ||
| 407 | + public function batchSetCategory(){ | ||
| 408 | + if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { | ||
| 409 | + DB::connection('custom_mysql')->beginTransaction(); | ||
| 410 | + $this->param['category_id'] = ','.implode(',',$this->param['category_id']).','; | ||
| 411 | + try { | ||
| 412 | + //批量 | ||
| 413 | + $param = [ | ||
| 414 | + 'category_id'=>$this->param['category_id'], | ||
| 415 | + 'status'=>$this->param['status'] | ||
| 416 | + ]; | ||
| 417 | + $this->model->edit($param,['id'=>['in',$this->param['id']]]); | ||
| 418 | + DB::connection('custom_mysql')->commit(); | ||
| 419 | + //对应添加关联表 | ||
| 420 | + }catch (\Exception $e){ | ||
| 421 | + DB::connection('custom_mysql')->rollBack(); | ||
| 422 | + $this->fail('系统错误,请联系管理员'); | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + return $this->success(); | ||
| 426 | + } | ||
| 399 | } | 427 | } |
| @@ -75,6 +75,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -75,6 +75,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 75 | Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status'); | 75 | Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status'); |
| 76 | Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort'); | 76 | Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort'); |
| 77 | Route::any('/allSort', [\App\Http\Controllers\Bside\News\NewsController::class, 'allSort'])->name('news_allSort'); | 77 | Route::any('/allSort', [\App\Http\Controllers\Bside\News\NewsController::class, 'allSort'])->name('news_allSort'); |
| 78 | + Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\News\NewsController::class, 'batchSetCategory'])->name('news_batchSetCategory'); | ||
| 78 | Route::any('/statusNum', [\App\Http\Controllers\Bside\News\NewsController::class, 'getStatusNumber'])->name('news_statusNum'); | 79 | Route::any('/statusNum', [\App\Http\Controllers\Bside\News\NewsController::class, 'getStatusNumber'])->name('news_statusNum'); |
| 79 | }); | 80 | }); |
| 80 | 81 |
-
请 注册 或 登录 后发表评论