Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate
正在显示
7 个修改的文件
包含
28 行增加
和
41 行删除
| @@ -109,7 +109,7 @@ class FileManageController extends BaseController | @@ -109,7 +109,7 @@ class FileManageController extends BaseController | ||
| 109 | $fileName = $enName; | 109 | $fileName = $enName; |
| 110 | $i=1; | 110 | $i=1; |
| 111 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ | 111 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ |
| 112 | - $enName = $fileName .'_'.$i; | 112 | + $enName = $fileName .'-'.$i; |
| 113 | $i++; | 113 | $i++; |
| 114 | } | 114 | } |
| 115 | return $enName.'.'.$nameArr[1]; | 115 | return $enName.'.'.$nameArr[1]; |
| @@ -33,9 +33,11 @@ class NavController extends BaseController | @@ -33,9 +33,11 @@ class NavController extends BaseController | ||
| 33 | $lists = $nav->list($this->map,$this->order = ['sort','id'],['*'],'asc'); | 33 | $lists = $nav->list($this->map,$this->order = ['sort','id'],['*'],'asc'); |
| 34 | $data = array(); | 34 | $data = array(); |
| 35 | if(!empty($lists)){ | 35 | if(!empty($lists)){ |
| 36 | + foreach ($lists as $k => $v){ | ||
| 37 | + $v = $this->handleReturnInfo((array)$v); | ||
| 38 | + $lists[$k] = $v; | ||
| 39 | + } | ||
| 36 | foreach ($lists as $v){ | 40 | foreach ($lists as $v){ |
| 37 | - $v = (array)$v; | ||
| 38 | - $v = $this->handleReturnInfo($v); | ||
| 39 | if ($v['pid'] == 0) { | 41 | if ($v['pid'] == 0) { |
| 40 | $v['sub'] = _get_child($v['id'], $lists); | 42 | $v['sub'] = _get_child($v['id'], $lists); |
| 41 | $data[] = $v; | 43 | $data[] = $v; |
| @@ -443,7 +443,7 @@ class ProductController extends BaseController | @@ -443,7 +443,7 @@ class ProductController extends BaseController | ||
| 443 | } | 443 | } |
| 444 | 444 | ||
| 445 | /** | 445 | /** |
| 446 | - * @remark :批量设置产品分类及状态 | 446 | + * @remark :批量设置产品分类 |
| 447 | * @name :batchSetCategory | 447 | * @name :batchSetCategory |
| 448 | * @author :lyh | 448 | * @author :lyh |
| 449 | * @method :post | 449 | * @method :post |
| @@ -453,11 +453,9 @@ class ProductController extends BaseController | @@ -453,11 +453,9 @@ class ProductController extends BaseController | ||
| 453 | $this->request->validate([ | 453 | $this->request->validate([ |
| 454 | 'id'=>'required', | 454 | 'id'=>'required', |
| 455 | 'category_id'=>'required', | 455 | 'category_id'=>'required', |
| 456 | - 'status'=>'required' | ||
| 457 | ],[ | 456 | ],[ |
| 458 | 'id.required' => '产品ID不能为空', | 457 | 'id.required' => '产品ID不能为空', |
| 459 | 'category_id.required' => '分类ID不能为空', | 458 | 'category_id.required' => '分类ID不能为空', |
| 460 | - 'status.required'=>'状态不能为空' | ||
| 461 | ]); | 459 | ]); |
| 462 | $logic->batchSetCategory(); | 460 | $logic->batchSetCategory(); |
| 463 | $this->response('success'); | 461 | $this->response('success'); |
| @@ -169,7 +169,7 @@ class FileController | @@ -169,7 +169,7 @@ class FileController | ||
| 169 | $fileName = $enName; | 169 | $fileName = $enName; |
| 170 | $i=1; | 170 | $i=1; |
| 171 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ | 171 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ |
| 172 | - $enName = $fileName .'_'.$i; | 172 | + $enName = $fileName .'-'.$i; |
| 173 | $i++; | 173 | $i++; |
| 174 | } | 174 | } |
| 175 | return $enName.'.'.$nameArr[1]; | 175 | return $enName.'.'.$nameArr[1]; |
| @@ -229,7 +229,7 @@ class ImageController extends Controller | @@ -229,7 +229,7 @@ class ImageController extends Controller | ||
| 229 | $fileName = $enName; | 229 | $fileName = $enName; |
| 230 | $i=1; | 230 | $i=1; |
| 231 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ | 231 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ |
| 232 | - $enName = $fileName .'_'.$i; | 232 | + $enName = $fileName .'-'.$i; |
| 233 | $i++; | 233 | $i++; |
| 234 | } | 234 | } |
| 235 | return $enName.'.'.$nameArr[1]; | 235 | return $enName.'.'.$nameArr[1]; |
| @@ -335,22 +335,6 @@ class ProductLogic extends BaseLogic | @@ -335,22 +335,6 @@ class ProductLogic extends BaseLogic | ||
| 335 | return !empty(trim($str,',')) ? ','.$str.',' : ''; | 335 | return !empty(trim($str,',')) ? ','.$str.',' : ''; |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | - /** | ||
| 339 | - * @remark :获取最后一级分类id(数组) | ||
| 340 | - * @name :getLastCategory | ||
| 341 | - * @author :lyh | ||
| 342 | - * @method :post | ||
| 343 | - * @time :2023/10/20 9:02 | ||
| 344 | - */ | ||
| 345 | - public function getLastCategoryArr($category){ | ||
| 346 | - $arr = []; | ||
| 347 | - if(isset($category) && !empty($category)){ | ||
| 348 | - foreach ($category as $v){ | ||
| 349 | - $arr[] = $v; | ||
| 350 | - } | ||
| 351 | - } | ||
| 352 | - return $arr; | ||
| 353 | - } | ||
| 354 | 338 | ||
| 355 | /** | 339 | /** |
| 356 | * @remark :编辑产品 | 340 | * @remark :编辑产品 |
| @@ -575,27 +559,29 @@ class ProductLogic extends BaseLogic | @@ -575,27 +559,29 @@ class ProductLogic extends BaseLogic | ||
| 575 | * @time :2023/8/15 17:53 | 559 | * @time :2023/8/15 17:53 |
| 576 | */ | 560 | */ |
| 577 | public function batchSetCategory(){ | 561 | public function batchSetCategory(){ |
| 578 | - if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { | ||
| 579 | - DB::connection('custom_mysql')->beginTransaction(); | ||
| 580 | - $category_ids = $this->getLastCategoryArr($this->param['category_id']); | ||
| 581 | - $this->param['category_id'] = ','.implode(',',$category_ids).','; | ||
| 582 | - try { | ||
| 583 | - //批量 | ||
| 584 | - $param = [ | ||
| 585 | - 'category_id'=>$this->param['category_id'], | ||
| 586 | - 'status'=>$this->param['status'] | ||
| 587 | - ]; | ||
| 588 | - $this->model->edit($param,['id'=>['in',$this->param['id']]]); | 562 | + if(!isset($this->param['category_id']) || empty($this->param['category_id'])){ |
| 563 | + $this->fail('请选择分类'); | ||
| 564 | + } | ||
| 565 | + try { | ||
| 566 | + if(!isset($this->param['is_cover']) || ($this->param['is_cover'] == 1)){ | ||
| 567 | + $category_ids = ','.implode(',',$this->param['category_id']).','; | ||
| 568 | + $this->model->edit(['category_id'=>$category_ids],['id'=>['in',$this->param['id']]]); | ||
| 589 | //分类关联 | 569 | //分类关联 |
| 590 | foreach ($this->param['id'] as $id){ | 570 | foreach ($this->param['id'] as $id){ |
| 591 | - CategoryRelated::saveRelated($id, $category_ids); | 571 | + CategoryRelated::saveRelated($id, $this->param['category_id']); |
| 572 | + } | ||
| 573 | + }else{ | ||
| 574 | + foreach ($this->param['id'] as $id){ | ||
| 575 | + //获取当前产品的分类 | ||
| 576 | + $productInfo = $this->model->read(['id'=>$id],['id','category_id']); | ||
| 577 | + $category_ids_arr = array_values(array_unique(array_merge($productInfo['category_id'],$this->param['category_id']))); | ||
| 578 | + $category_ids = ','.implode(',',$category_ids_arr).','; | ||
| 579 | + $this->model->edit(['category_id'=>$category_ids],['id'=>$id]); | ||
| 580 | + CategoryRelated::saveRelated($id, $category_ids_arr); | ||
| 592 | } | 581 | } |
| 593 | - DB::connection('custom_mysql')->commit(); | ||
| 594 | - //对应添加关联表 | ||
| 595 | - }catch (\Exception $e){ | ||
| 596 | - DB::connection('custom_mysql')->rollBack(); | ||
| 597 | - $this->fail('系统错误,请联系管理员'); | ||
| 598 | } | 582 | } |
| 583 | + }catch (\Exception $e){ | ||
| 584 | + $this->fail('设置分类失败,请联系管理员'); | ||
| 599 | } | 585 | } |
| 600 | return $this->success(); | 586 | return $this->success(); |
| 601 | } | 587 | } |
| @@ -502,6 +502,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -502,6 +502,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 502 | Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'sort'])->name('custom_content_sort'); | 502 | Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'sort'])->name('custom_content_sort'); |
| 503 | Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'del'])->name('custom_content_del'); | 503 | Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'del'])->name('custom_content_del'); |
| 504 | Route::any('/allSort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'allSort'])->name('custom_content_allSort'); | 504 | Route::any('/allSort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'allSort'])->name('custom_content_allSort'); |
| 505 | + Route::any('/copyModuleContent', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'copyModuleContent'])->name('custom_content_copyModuleContent'); | ||
| 505 | }); | 506 | }); |
| 506 | 507 | ||
| 507 | Route::prefix('extend')->group(function () { | 508 | Route::prefix('extend')->group(function () { |
-
请 注册 或 登录 后发表评论