正在显示
4 个修改的文件
包含
29 行增加
和
24 行删除
| @@ -92,30 +92,32 @@ class ProjectController extends BaseController | @@ -92,30 +92,32 @@ class ProjectController extends BaseController | ||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | /** | 94 | /** |
| 95 | - * @remark :搜索升级项目 | ||
| 96 | - * @name :searchUpgrade | ||
| 97 | - * @author :lyh | ||
| 98 | - * @method :post | ||
| 99 | - * @time :2023/11/6 16:27 | ||
| 100 | - */ | ||
| 101 | - public function searchUpgrade(&$query){ | ||
| 102 | - if(isset($this->map['is_upgrade']) && !empty($this->map['is_upgrade'])){ | ||
| 103 | - $query->where('gl_project.is_upgrade', $this->map['is_upgrade']); | ||
| 104 | - } | ||
| 105 | - return $query; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - /** | ||
| 109 | * 搜索项目状态 | 95 | * 搜索项目状态 |
| 110 | * @param $query | 96 | * @param $query |
| 111 | * @return mixed | 97 | * @return mixed |
| 112 | */ | 98 | */ |
| 113 | public function searchType(&$query){ | 99 | public function searchType(&$query){ |
| 100 | + if(isset($this->map['type']) && !empty($this->map['type'])){ | ||
| 114 | if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])) | 101 | if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])) |
| 115 | $query->where('gl_project.type', $this->map['type']); | 102 | $query->where('gl_project.type', $this->map['type']); |
| 116 | else{ | 103 | else{ |
| 117 | $query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]); | 104 | $query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]); |
| 118 | } | 105 | } |
| 106 | + } | ||
| 107 | + return $query; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * @remark :搜索升级项目 | ||
| 112 | + * @name :searchUpgrade | ||
| 113 | + * @author :lyh | ||
| 114 | + * @method :post | ||
| 115 | + * @time :2023/11/6 16:27 | ||
| 116 | + */ | ||
| 117 | + public function searchUpgrade(&$query){ | ||
| 118 | + if(isset($this->map['is_upgrade']) && !empty($this->map['is_upgrade'])){ | ||
| 119 | + $query->where('gl_project.is_upgrade', $this->map['is_upgrade']); | ||
| 120 | + } | ||
| 119 | return $query; | 121 | return $query; |
| 120 | } | 122 | } |
| 121 | 123 |
| @@ -62,6 +62,8 @@ class NewsLogic extends BaseLogic | @@ -62,6 +62,8 @@ class NewsLogic extends BaseLogic | ||
| 62 | DB::beginTransaction(); | 62 | DB::beginTransaction(); |
| 63 | try { | 63 | try { |
| 64 | $this->param = $this->paramProcessing($this->param); | 64 | $this->param = $this->paramProcessing($this->param); |
| 65 | + //路由映射 | ||
| 66 | + $this->param['url'] = $this->param['url'].'-'.RouteMap::SOURCE_NEWS; | ||
| 65 | if (isset($this->param['id']) && !empty($this->param['id'])) { | 67 | if (isset($this->param['id']) && !empty($this->param['id'])) { |
| 66 | //是否更新路由 | 68 | //是否更新路由 |
| 67 | $id = $this->editNewsRoute($this->param['id'], $this->param['url']); | 69 | $id = $this->editNewsRoute($this->param['id'], $this->param['url']); |
| @@ -112,6 +112,8 @@ class CategoryLogic extends BaseLogic | @@ -112,6 +112,8 @@ class CategoryLogic extends BaseLogic | ||
| 112 | public function categorySave(){ | 112 | public function categorySave(){ |
| 113 | DB::beginTransaction(); | 113 | DB::beginTransaction(); |
| 114 | try { | 114 | try { |
| 115 | + //路由映射 | ||
| 116 | + $this->param['route'] = $this->param['route'].'-'.RouteMap::SOURCE_PRODUCT_CATE; | ||
| 115 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 117 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 116 | //是否编辑路由 | 118 | //是否编辑路由 |
| 117 | $id = $this->editCategoryRoute($this->param['id'],$this->param['route']); | 119 | $id = $this->editCategoryRoute($this->param['id'],$this->param['route']); |
| @@ -123,7 +125,6 @@ class CategoryLogic extends BaseLogic | @@ -123,7 +125,6 @@ class CategoryLogic extends BaseLogic | ||
| 123 | //处理子集 | 125 | //处理子集 |
| 124 | $this->addProcessingSon($id); | 126 | $this->addProcessingSon($id); |
| 125 | } | 127 | } |
| 126 | - //路由映射 | ||
| 127 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); | 128 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); |
| 128 | $this->edit(['route'=>$route],['id'=>$id]); | 129 | $this->edit(['route'=>$route],['id'=>$id]); |
| 129 | //清除缓存 | 130 | //清除缓存 |
| @@ -37,11 +37,12 @@ class ProductLogic extends BaseLogic | @@ -37,11 +37,12 @@ class ProductLogic extends BaseLogic | ||
| 37 | * @time :2023/8/21 18:35 | 37 | * @time :2023/8/21 18:35 |
| 38 | */ | 38 | */ |
| 39 | public function productSave(){ | 39 | public function productSave(){ |
| 40 | -// $category_ids = $this->param['category_id'] ?? []; | ||
| 41 | //参数处理 | 40 | //参数处理 |
| 42 | $this->param = $this->handleSaveParam($this->param); | 41 | $this->param = $this->handleSaveParam($this->param); |
| 43 | -// DB::connection('custom_mysql')->beginTransaction(); | ||
| 44 | -// try { | 42 | + DB::connection('custom_mysql')->beginTransaction(); |
| 43 | + try { | ||
| 44 | + //路由映射 | ||
| 45 | + $this->param['route'] = $this->param['route'].'-'.RouteMap::SOURCE_PRODUCT; | ||
| 45 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 46 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 46 | //查看路由是否更新 | 47 | //查看路由是否更新 |
| 47 | $id = $this->editProductRoute($this->param['id'],$this->param['route']); | 48 | $id = $this->editProductRoute($this->param['id'],$this->param['route']); |
| @@ -52,16 +53,15 @@ class ProductLogic extends BaseLogic | @@ -52,16 +53,15 @@ class ProductLogic extends BaseLogic | ||
| 52 | $this->param['updated_at'] = $this->param['created_at']; | 53 | $this->param['updated_at'] = $this->param['created_at']; |
| 53 | $id = $this->model->addReturnId($this->param); | 54 | $id = $this->model->addReturnId($this->param); |
| 54 | } | 55 | } |
| 55 | - //路由映射 | ||
| 56 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | 56 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); |
| 57 | $this->model->edit(['route'=>$route],['id'=>$id]); | 57 | $this->model->edit(['route'=>$route],['id'=>$id]); |
| 58 | //产品分类关联 | 58 | //产品分类关联 |
| 59 | // CategoryRelated::saveRelated($id, $category_ids); | 59 | // CategoryRelated::saveRelated($id, $category_ids); |
| 60 | -// DB::connection('custom_mysql')->commit(); | ||
| 61 | -// }catch (\Exception $e){ | ||
| 62 | -// DB::connection('custom_mysql')->rollBack(); | ||
| 63 | -// $this->fail('系统错误请联系管理员'); | ||
| 64 | -// } | 60 | + DB::connection('custom_mysql')->commit(); |
| 61 | + }catch (\Exception $e){ | ||
| 62 | + DB::connection('custom_mysql')->rollBack(); | ||
| 63 | + $this->fail('系统错误请联系管理员'); | ||
| 64 | + } | ||
| 65 | //通知更新 | 65 | //通知更新 |
| 66 | $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]); | 66 | $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]); |
| 67 | return $this->success(); | 67 | return $this->success(); |
-
请 注册 或 登录 后发表评论