作者 lyh

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6

@@ -146,6 +146,7 @@ class Languages extends Command @@ -146,6 +146,7 @@ class Languages extends Command
146 {"short":"ug","english":"Uyghur","chinese":"维吾尔语","language":"ئۇيغۇر"}]'; 146 {"short":"ug","english":"Uyghur","chinese":"维吾尔语","language":"ئۇيغۇر"}]';
147 $data = json_decode($data); 147 $data = json_decode($data);
148 foreach ($data as $v){ 148 foreach ($data as $v){
  149 + $v = (array)$v;
149 echo date('Y-m-d H:i:s') . ' start: ' . $v['short'] . PHP_EOL; 150 echo date('Y-m-d H:i:s') . ' start: ' . $v['short'] . PHP_EOL;
150 $languageModel = new WebLanguage(); 151 $languageModel = new WebLanguage();
151 $languageModel->add($v); 152 $languageModel->add($v);
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :LanguageController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/11/30 11:21
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Setting;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Models\WebSetting\WebLanguage;
  15 +
  16 +class LanguageController extends BaseController
  17 +{
  18 + /**
  19 + * @remark :获取小语种列表
  20 + * @name :lists
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2023/11/30 10:59
  24 + */
  25 + public function lists(){
  26 + $webLanguageModel = new WebLanguage();
  27 + $lists = $webLanguageModel->list();
  28 + $this->response('success',Code::SUCCESS,$lists);
  29 + }
  30 +}
@@ -69,10 +69,12 @@ class OnlineCheckLogic extends BaseLogic @@ -69,10 +69,12 @@ class OnlineCheckLogic extends BaseLogic
69 */ 69 */
70 public function saveOnlineCheck(){ 70 public function saveOnlineCheck(){
71 $info = $this->model->read(['project_id'=>$this->param['id']]); 71 $info = $this->model->read(['project_id'=>$this->param['id']]);
72 - $projectModel = new Project();  
73 if($info !== false){ 72 if($info !== false){
74 $this->fail('已提交,请勿重复提交'); 73 $this->fail('已提交,请勿重复提交');
75 }else{ 74 }else{
  75 + $projectModel = new Project();
  76 + //提交审核修改状态为审核中
  77 + $projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$this->param['id']]);
76 //组装数据 78 //组装数据
77 $data = [ 79 $data = [
78 'project_id' => $this->param['id'], 80 'project_id' => $this->param['id'],
@@ -85,8 +87,6 @@ class OnlineCheckLogic extends BaseLogic @@ -85,8 +87,6 @@ class OnlineCheckLogic extends BaseLogic
85 if($rs === false){ 87 if($rs === false){
86 $this->fail('error'); 88 $this->fail('error');
87 } 89 }
88 - //提交审核修改状态为审核中  
89 - $projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$this->param['id']]);  
90 } 90 }
91 return $this->success(); 91 return $this->success();
92 } 92 }
@@ -378,8 +378,7 @@ class BTemplateLogic extends BaseLogic @@ -378,8 +378,7 @@ class BTemplateLogic extends BaseLogic
378 $route = 'all'; 378 $route = 'all';
379 } 379 }
380 } 380 }
381 - return $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route]);  
382 - return $this->success(); 381 + return $this->addUpdateNotify($type,$route);
383 } 382 }
384 383
385 /** 384 /**
@@ -66,8 +66,8 @@ class CustomTemplateLogic extends BaseLogic @@ -66,8 +66,8 @@ class CustomTemplateLogic extends BaseLogic
66 try { 66 try {
67 $this->param['url'] = str_replace_url($this->param['url']); 67 $this->param['url'] = str_replace_url($this->param['url']);
68 if(isset($this->param['id']) && !empty($this->param['id'])){ 68 if(isset($this->param['id']) && !empty($this->param['id'])){
69 - $id = $this->param['id'];  
70 - $this->param['url'] = $this->editCustomRoute($this->param['url']); 69 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']);
  70 + $this->editCustomRoute($this->param['url']);
71 $this->model->edit($this->param,['id'=>$this->param['id']]); 71 $this->model->edit($this->param,['id'=>$this->param['id']]);
72 }else{ 72 }else{
73 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ 73 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
@@ -75,9 +75,10 @@ class CustomTemplateLogic extends BaseLogic @@ -75,9 +75,10 @@ class CustomTemplateLogic extends BaseLogic
75 } 75 }
76 $this->param['project_id'] = $this->user['project_id']; 76 $this->param['project_id'] = $this->user['project_id'];
77 $id = $this->model->addReturnId($this->param); 77 $id = $this->model->addReturnId($this->param);
  78 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
  79 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
  80 + $this->model->edit(['url'=>$route],['id'=>$id]);
78 } 81 }
79 - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);  
80 - $this->model->edit(['url'=>$route],['id'=>$id]);  
81 }catch (\Exception $e){ 82 }catch (\Exception $e){
82 $this->fail('error'); 83 $this->fail('error');
83 } 84 }
@@ -110,8 +111,8 @@ class CustomTemplateLogic extends BaseLogic @@ -110,8 +111,8 @@ class CustomTemplateLogic extends BaseLogic
110 if($rs === false){ 111 if($rs === false){
111 $this->fail('系统错误,请联系管理'); 112 $this->fail('系统错误,请联系管理');
112 } 113 }
113 - $data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']];  
114 - $this->updateNotify($data); 114 + //通知
  115 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']);
115 return $this->success(); 116 return $this->success();
116 } 117 }
117 118
@@ -210,14 +211,10 @@ class CustomTemplateLogic extends BaseLogic @@ -210,14 +211,10 @@ class CustomTemplateLogic extends BaseLogic
210 $this->fail('404页面链接不可修改'); 211 $this->fail('404页面链接不可修改');
211 } 212 }
212 if($info['url'] != $route){ 213 if($info['url'] != $route){
213 - //生成一条删除路由记录  
214 - $data = [  
215 - 'source'=>RouteMap::SOURCE_PAGE,  
216 - 'route'=>$info['url'],  
217 - ];  
218 - $this->setRouteDeleteSave($data); 214 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
  215 + $this->curlDelRoute($info['url']);
219 } 216 }
220 - return $route; 217 + return true;
221 } 218 }
222 219
223 /** 220 /**
@@ -261,11 +258,7 @@ class CustomTemplateLogic extends BaseLogic @@ -261,11 +258,7 @@ class CustomTemplateLogic extends BaseLogic
261 RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); 258 RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
262 //生成一条删除路由记录 259 //生成一条删除路由记录
263 $info = $this->model->read(['id' => $id], ['id', 'url']); 260 $info = $this->model->read(['id' => $id], ['id', 'url']);
264 - $data = [  
265 - 'source' => RouteMap::SOURCE_NEWS,  
266 - 'route' => $info['url'],  
267 - ];  
268 - $this->setRouteDeleteSave($data); 261 + $this->curlDelRoute($info['url']);
269 return $this->success(); 262 return $this->success();
270 } 263 }
271 264
@@ -142,49 +142,36 @@ class BaseLogic extends Logic @@ -142,49 +142,36 @@ class BaseLogic extends Logic
142 } 142 }
143 143
144 /** 144 /**
145 - * @name :(通知更新)projectUrl 145 + * @name :生成一条新路由记录
146 * @author :lyh 146 * @author :lyh
147 * @method :post 147 * @method :post
148 * @time :2023/6/6 14:09 148 * @time :2023/6/6 14:09
149 */ 149 */
150 - function updateNotify($data) 150 + public function addUpdateNotify($type,$route)
151 { 151 {
152 $updateNotifyModel = new UpdateNotify(); 152 $updateNotifyModel = new UpdateNotify();
153 - if($data['route'] != 'all'){  
154 - $info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>1]);  
155 - if($info === false){  
156 - $param = [  
157 - 'project_id'=>$data['project_id'],  
158 - 'type'=>$data['type'],  
159 - 'route'=>$data['route'],  
160 - ];  
161 - $updateNotifyModel->add($param);  
162 - }  
163 - //单页面直接通知更新  
164 - $url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$data['route']; 153 + $info = $updateNotifyModel->read(['project_id'=>$this->user['project_id'],'route'=>$route,'status'=>1]);
  154 + if($info === false){
  155 + $param = [
  156 + 'project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route,'status'=>1
  157 + ];
  158 + $updateNotifyModel->add($param);
165 }else{ 159 }else{
166 - $url = $this->user['domain'].'api/webInfo/?type=clear_website'; 160 + $updateNotifyModel->edit(['route'=>$route],['project_id'=>$this->user['project_id'],'type'=>$type,'status'=>1]);
167 } 161 }
168 - curlGet($url);  
169 return $this->success(); 162 return $this->success();
170 } 163 }
171 164
172 /** 165 /**
173 - * @remark :删除和编辑路由时生成一条记录  
174 - * @name :setRouteDeleteSave 166 + * @remark :删除路由通知C端
  167 + * @name :curlDelRoute
175 * @author :lyh 168 * @author :lyh
176 * @method :post 169 * @method :post
177 - * @time :2023/9/7 9:38 170 + * @time :2023/11/30 14:43
178 */ 171 */
179 - public function setRouteDeleteSave($param){  
180 - $routeDeleteModel = new RouteDelete();  
181 - $data = [  
182 - 'project_id'=>$this->user['project_id'],  
183 - 'source'=>$param['source'],  
184 - 'created_at'=>date('Y-m-d H:i:s'),  
185 - 'route'=>$param['route'],  
186 - ];  
187 - $routeDeleteModel->insert($data); 172 + public function curlDelRoute($route){
  173 + $url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$route;
  174 + curlGet($url);
188 return $this->success(); 175 return $this->success();
189 } 176 }
190 } 177 }
@@ -32,8 +32,7 @@ class BlogCategoryLogic extends BaseLogic @@ -32,8 +32,7 @@ class BlogCategoryLogic extends BaseLogic
32 DB::beginTransaction(); 32 DB::beginTransaction();
33 try { 33 try {
34 if(isset($this->param['id']) && !empty($this->param['id'])){ 34 if(isset($this->param['id']) && !empty($this->param['id'])){
35 - //查看路由是否更新  
36 - $id = $this->param['id']; 35 + $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']);
37 $this->editCategoryRoute($this->param['id'], $this->param['alias']); 36 $this->editCategoryRoute($this->param['id'], $this->param['alias']);
38 $this->editHandleCategory($this->param['id'],$this->param['pid']); 37 $this->editHandleCategory($this->param['id'],$this->param['pid']);
39 $this->param['operator_id'] = $this->user['id']; 38 $this->param['operator_id'] = $this->user['id'];
@@ -46,18 +45,17 @@ class BlogCategoryLogic extends BaseLogic @@ -46,18 +45,17 @@ class BlogCategoryLogic extends BaseLogic
46 //拼接参数 45 //拼接参数
47 $this->param = $this->addParamProcessing($this->param); 46 $this->param = $this->addParamProcessing($this->param);
48 $id = $this->model->addReturnId($this->param); 47 $id = $this->model->addReturnId($this->param);
  48 + $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
  49 + $this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route);
  50 + $this->edit(['alias'=>$route],['id'=>$id]);
49 //处理子集 51 //处理子集
50 $this->addProcessingSon($id); 52 $this->addProcessingSon($id);
51 } 53 }
52 - $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);  
53 - $this->edit(['alias'=>$route],['id'=>$id]);  
54 DB::commit(); 54 DB::commit();
55 }catch (\Exception $e){ 55 }catch (\Exception $e){
56 DB::rollBack(); 56 DB::rollBack();
57 $this->fail('系统错误,请联系管理'); 57 $this->fail('系统错误,请联系管理');
58 } 58 }
59 - //通知更新  
60 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]);  
61 return $this->success(); 59 return $this->success();
62 } 60 }
63 61
@@ -114,11 +112,8 @@ class BlogCategoryLogic extends BaseLogic @@ -114,11 +112,8 @@ class BlogCategoryLogic extends BaseLogic
114 //生成一条删除路由记录 112 //生成一条删除路由记录
115 $info = $this->model->read(['id'=>$id],['id','alias']); 113 $info = $this->model->read(['id'=>$id],['id','alias']);
116 if($info['alias'] != $route){ 114 if($info['alias'] != $route){
117 - $data = [  
118 - 'source'=>RouteMap::SOURCE_NEWS_CATE,  
119 - 'route'=>$info['alias'],  
120 - ];  
121 - $this->setRouteDeleteSave($data); 115 + $this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route);
  116 + $this->curlDelRoute($info['alias']);
122 } 117 }
123 return true; 118 return true;
124 } 119 }
@@ -311,11 +306,7 @@ class BlogCategoryLogic extends BaseLogic @@ -311,11 +306,7 @@ class BlogCategoryLogic extends BaseLogic
311 RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); 306 RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
312 //生成一条删除路由记录 307 //生成一条删除路由记录
313 $info = $this->model->read(['id'=>$id],['id','alias']); 308 $info = $this->model->read(['id'=>$id],['id','alias']);
314 - $data = [  
315 - 'source'=>RouteMap::SOURCE_BLOG_CATE,  
316 - 'route'=>$info['alias'],  
317 - ];  
318 - $this->setRouteDeleteSave($data); 309 + $this->curlDelRoute($info['alias']);
319 return $this->success(); 310 return $this->success();
320 } 311 }
321 312
@@ -331,27 +322,22 @@ class BlogCategoryLogic extends BaseLogic @@ -331,27 +322,22 @@ class BlogCategoryLogic extends BaseLogic
331 */ 322 */
332 public function importBlogCategory($project_id,$user_id,$category){ 323 public function importBlogCategory($project_id,$user_id,$category){
333 $return = []; 324 $return = [];
334 -  
335 $cate_arr = explode('/',$category); 325 $cate_arr = explode('/',$category);
336 -  
337 $pid = 0; 326 $pid = 0;
338 foreach ($cate_arr as $v){ 327 foreach ($cate_arr as $v){
339 if($v){ 328 if($v){
340 $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]); 329 $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]);
341 if(!$category_info){ 330 if(!$category_info){
342 $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]); 331 $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]);
343 -  
344 $route = RouteMap::setRoute($v, RouteMap::SOURCE_BLOG_CATE, $id, $project_id); 332 $route = RouteMap::setRoute($v, RouteMap::SOURCE_BLOG_CATE, $id, $project_id);
345 $this->model->edit(['alias'=>$route],['id'=>$id]); 333 $this->model->edit(['alias'=>$route],['id'=>$id]);
346 }else{ 334 }else{
347 $id = $category_info['id']; 335 $id = $category_info['id'];
348 } 336 }
349 -  
350 $return[] = $id; 337 $return[] = $id;
351 $pid = $id; 338 $pid = $id;
352 } 339 }
353 } 340 }
354 -  
355 return $this->getLastCategory($return); 341 return $this->getLastCategory($return);
356 } 342 }
357 343
@@ -34,22 +34,20 @@ class BlogLogic extends BaseLogic @@ -34,22 +34,20 @@ class BlogLogic extends BaseLogic
34 try { 34 try {
35 $this->param = $this->paramProcessing($this->param); 35 $this->param = $this->paramProcessing($this->param);
36 if(isset($this->param['id']) && !empty($this->param['id'])){ 36 if(isset($this->param['id']) && !empty($this->param['id'])){
37 - //是否更新路由  
38 - $id = $this->param['id']; 37 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);
39 $this->editNewsRoute($this->param['id'],$this->param['url']); 38 $this->editNewsRoute($this->param['id'],$this->param['url']);
40 $this->edit($this->param,['id'=>$this->param['id']]); 39 $this->edit($this->param,['id'=>$this->param['id']]);
41 }else{ 40 }else{
42 $id = $this->model->addReturnId($this->param); 41 $id = $this->model->addReturnId($this->param);
  42 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
  43 + $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
  44 + $this->edit(['url'=>$route],['id'=>$id]);
43 } 45 }
44 - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);  
45 - $this->edit(['url'=>$route],['id'=>$id]);  
46 DB::commit(); 46 DB::commit();
47 }catch (\Exception $e){ 47 }catch (\Exception $e){
48 DB::rollBack(); 48 DB::rollBack();
49 $this->fail('error'); 49 $this->fail('error');
50 } 50 }
51 - //通知更新  
52 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);  
53 return $this->success(); 51 return $this->success();
54 } 52 }
55 53
@@ -64,11 +62,8 @@ class BlogLogic extends BaseLogic @@ -64,11 +62,8 @@ class BlogLogic extends BaseLogic
64 //生成一条删除路由记录 62 //生成一条删除路由记录
65 $info = $this->model->read(['id'=>$id],['id','url']); 63 $info = $this->model->read(['id'=>$id],['id','url']);
66 if($info['url'] != $route){ 64 if($info['url'] != $route){
67 - $data = [  
68 - 'source'=>RouteMap::SOURCE_BLOG,  
69 - 'route'=>$info['url'],  
70 - ];  
71 - $this->setRouteDeleteSave($data); 65 + $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
  66 + $this->curlDelRoute($info['url']);
72 } 67 }
73 return true; 68 return true;
74 } 69 }
@@ -90,10 +85,11 @@ class BlogLogic extends BaseLogic @@ -90,10 +85,11 @@ class BlogLogic extends BaseLogic
90 85
91 86
92 /** 87 /**
93 - * @name :获取数据详情  
94 - * @return array  
95 - * @author :liyuhang  
96 - * @method 88 + * @remark :获取数据详情
  89 + * @name :blogInfo
  90 + * @author :lyh
  91 + * @method :post
  92 + * @time :2023/11/30 15:17
97 */ 93 */
98 public function blogInfo(){ 94 public function blogInfo(){
99 $info = $this->model->read($this->param); 95 $info = $this->model->read($this->param);
@@ -110,11 +106,11 @@ class BlogLogic extends BaseLogic @@ -110,11 +106,11 @@ class BlogLogic extends BaseLogic
110 106
111 107
112 /** 108 /**
113 - * @name :修改状态  
114 - * @return array  
115 - * @throws \App\Exceptions\BsideGlobalException  
116 - * @author :liyuhang  
117 - * @method 109 + * @remark :修改状态
  110 + * @name :blogStatus
  111 + * @author :lyh
  112 + * @method :post
  113 + * @time :2023/11/30 15:16
118 */ 114 */
119 public function blogStatus(){ 115 public function blogStatus(){
120 $this->param['operator_id'] = $this->user['id']; 116 $this->param['operator_id'] = $this->user['id'];
@@ -126,10 +122,11 @@ class BlogLogic extends BaseLogic @@ -126,10 +122,11 @@ class BlogLogic extends BaseLogic
126 } 122 }
127 123
128 /** 124 /**
129 - * @name :删除  
130 - * @return void  
131 - * @author :liyuhang  
132 - * @method 125 + * @remark :删除
  126 + * @name :blogDel
  127 + * @author :lyh
  128 + * @method :post
  129 + * @time :2023/11/30 15:17
133 */ 130 */
134 public function blogDel(){ 131 public function blogDel(){
135 DB::beginTransaction(); 132 DB::beginTransaction();
@@ -158,11 +155,7 @@ class BlogLogic extends BaseLogic @@ -158,11 +155,7 @@ class BlogLogic extends BaseLogic
158 RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); 155 RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
159 //生成一条删除路由记录 156 //生成一条删除路由记录
160 $info = $this->model->read(['id'=>$id],['id','url']); 157 $info = $this->model->read(['id'=>$id],['id','url']);
161 - $data = [  
162 - 'source'=>RouteMap::SOURCE_BLOG,  
163 - 'route'=>$info['url'],  
164 - ];  
165 - $this->setRouteDeleteSave($data); 158 + $this->curlDelRoute($info['url']);
166 return $this->success(); 159 return $this->success();
167 } 160 }
168 161
@@ -55,7 +55,7 @@ class NavLogic extends BaseLogic @@ -55,7 +55,7 @@ class NavLogic extends BaseLogic
55 $this->model->add($this->param); 55 $this->model->add($this->param);
56 } 56 }
57 //编辑菜单后,通知更新 57 //编辑菜单后,通知更新
58 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']); 58 + $this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all');
59 return $this->success(); 59 return $this->success();
60 } 60 }
61 61
@@ -97,7 +97,7 @@ class NavLogic extends BaseLogic @@ -97,7 +97,7 @@ class NavLogic extends BaseLogic
97 $this->fail('error'); 97 $this->fail('error');
98 } 98 }
99 //编辑菜单后,通知更新 99 //编辑菜单后,通知更新
100 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']); 100 + $this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all');
101 return $this->success(); 101 return $this->success();
102 } 102 }
103 103
@@ -44,11 +44,10 @@ class NewsCategoryLogic extends BaseLogic @@ -44,11 +44,10 @@ class NewsCategoryLogic extends BaseLogic
44 DB::beginTransaction(); 44 DB::beginTransaction();
45 try { 45 try {
46 if(isset($this->param['id']) && !empty($this->param['id'])){ 46 if(isset($this->param['id']) && !empty($this->param['id'])){
47 - $this->param['operator_id'] = $this->user['id'];  
48 - //查看路由是否更新  
49 - $id = $this->param['id']; 47 + $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']);
50 $this->editCategoryRoute($this->param['id'],$this->param['alias']); 48 $this->editCategoryRoute($this->param['id'],$this->param['alias']);
51 $this->editHandleCategory($this->param['id'],$this->param['pid']); 49 $this->editHandleCategory($this->param['id'],$this->param['pid']);
  50 + $this->param['operator_id'] = $this->user['id'];
52 $this->edit($this->param,['id'=>$this->param['id']]); 51 $this->edit($this->param,['id'=>$this->param['id']]);
53 }else{ 52 }else{
54 if(!isset($this->param['alias']) || empty($this->param['alias'])){ 53 if(!isset($this->param['alias']) || empty($this->param['alias'])){
@@ -56,18 +55,17 @@ class NewsCategoryLogic extends BaseLogic @@ -56,18 +55,17 @@ class NewsCategoryLogic extends BaseLogic
56 } 55 }
57 $this->param = $this->addParamProcessing($this->param); 56 $this->param = $this->addParamProcessing($this->param);
58 $id = $this->model->addReturnId($this->param); 57 $id = $this->model->addReturnId($this->param);
  58 + $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
  59 + $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
  60 + $this->model->edit(['alias'=>$route],['id'=>$id]);
59 //当父级分类拥有产品时,处理子集 61 //当父级分类拥有产品时,处理子集
60 $this->addProcessingSon($id); 62 $this->addProcessingSon($id);
61 } 63 }
62 - $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);  
63 - $this->model->edit(['alias'=>$route],['id'=>$id]);  
64 DB::commit(); 64 DB::commit();
65 }catch (\Exception $e){ 65 }catch (\Exception $e){
66 DB::rollBack(); 66 DB::rollBack();
67 $this->fail('系统错误,请联系管理员'); 67 $this->fail('系统错误,请联系管理员');
68 } 68 }
69 - //更新通知记录表  
70 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]);  
71 return $this->success(); 69 return $this->success();
72 } 70 }
73 71
@@ -124,22 +122,19 @@ class NewsCategoryLogic extends BaseLogic @@ -124,22 +122,19 @@ class NewsCategoryLogic extends BaseLogic
124 //生成一条删除路由记录 122 //生成一条删除路由记录
125 $info = $this->model->read(['id'=>$id],['id','alias']); 123 $info = $this->model->read(['id'=>$id],['id','alias']);
126 if($info['alias'] != $route){ 124 if($info['alias'] != $route){
127 - $data = [  
128 - 'source'=>RouteMap::SOURCE_NEWS_CATE,  
129 - 'route'=>$info['alias'],  
130 - ];  
131 - $this->setRouteDeleteSave($data); 125 + $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
  126 + $this->curlDelRoute($info['alias']);
132 } 127 }
133 return true; 128 return true;
134 } 129 }
135 130
136 131
137 /** 132 /**
138 - * @name :修改状态  
139 - * @return array  
140 - * @throws \App\Exceptions\BsideGlobalException  
141 - * @author :liyuhang  
142 - * @method 133 + * @remark :修改状态
  134 + * @name :status_news_category
  135 + * @author :lyh
  136 + * @method :post
  137 + * @time :2023/11/30 15:13
143 */ 138 */
144 public function status_news_category(){ 139 public function status_news_category(){
145 $this->param['operator_id'] = $this->user['id']; 140 $this->param['operator_id'] = $this->user['id'];
@@ -291,13 +286,8 @@ class NewsCategoryLogic extends BaseLogic @@ -291,13 +286,8 @@ class NewsCategoryLogic extends BaseLogic
291 public function delRoute($id){ 286 public function delRoute($id){
292 //删除路由映射 287 //删除路由映射
293 RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); 288 RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
294 - //生成一条删除路由记录  
295 $info = $this->model->read(['id'=>$id],['id','alias']); 289 $info = $this->model->read(['id'=>$id],['id','alias']);
296 - $data = [  
297 - 'source'=>RouteMap::SOURCE_NEWS_CATE,  
298 - 'route'=>$info['alias'],  
299 - ];  
300 - $this->setRouteDeleteSave($data); 290 + $this->curlDelRoute($info['alias']);
301 return $this->success(); 291 return $this->success();
302 } 292 }
303 293
@@ -313,22 +303,18 @@ class NewsCategoryLogic extends BaseLogic @@ -313,22 +303,18 @@ class NewsCategoryLogic extends BaseLogic
313 */ 303 */
314 public function importNewsCategory($project_id,$user_id,$category){ 304 public function importNewsCategory($project_id,$user_id,$category){
315 $return = []; 305 $return = [];
316 -  
317 $cate_arr = explode('/',$category); 306 $cate_arr = explode('/',$category);
318 -  
319 $pid = 0; 307 $pid = 0;
320 foreach ($cate_arr as $v){ 308 foreach ($cate_arr as $v){
321 if($v){ 309 if($v){
322 $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]); 310 $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]);
323 if(!$category_info){ 311 if(!$category_info){
324 $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]); 312 $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]);
325 -  
326 $route = RouteMap::setRoute($v, RouteMap::SOURCE_NEWS_CATE, $id, $project_id); 313 $route = RouteMap::setRoute($v, RouteMap::SOURCE_NEWS_CATE, $id, $project_id);
327 $this->model->edit(['alias'=>$route],['id'=>$id]); 314 $this->model->edit(['alias'=>$route],['id'=>$id]);
328 }else{ 315 }else{
329 $id = $category_info['id']; 316 $id = $category_info['id'];
330 } 317 }
331 -  
332 $return[] = $id; 318 $return[] = $id;
333 $pid = $id; 319 $pid = $id;
334 } 320 }
@@ -63,23 +63,22 @@ class NewsLogic extends BaseLogic @@ -63,23 +63,22 @@ class NewsLogic extends BaseLogic
63 try { 63 try {
64 $this->param = $this->paramProcessing($this->param); 64 $this->param = $this->paramProcessing($this->param);
65 if (isset($this->param['id']) && !empty($this->param['id'])) { 65 if (isset($this->param['id']) && !empty($this->param['id'])) {
  66 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']);
66 //是否更新路由 67 //是否更新路由
67 $this->editNewsRoute($this->param['id'], $this->param['url']); 68 $this->editNewsRoute($this->param['id'], $this->param['url']);
68 - $id = $this->param['id'];  
69 $this->edit($this->param, ['id' => $this->param['id']]); 69 $this->edit($this->param, ['id' => $this->param['id']]);
70 } else { 70 } else {
71 $id = $this->model->addReturnId($this->param); 71 $id = $this->model->addReturnId($this->param);
  72 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
  73 + $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
  74 + $this->edit(['url' => $route], ['id' => $id]);
72 } 75 }
73 //更新路由 76 //更新路由
74 - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);  
75 - $this->edit(['url' => $route], ['id' => $id]);  
76 DB::commit(); 77 DB::commit();
77 } catch (\Exception $e) { 78 } catch (\Exception $e) {
78 DB::rollBack(); 79 DB::rollBack();
79 $this->fail('系统错误,请联系管理员'); 80 $this->fail('系统错误,请联系管理员');
80 } 81 }
81 - //通知更新  
82 - $this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]);  
83 return $this->success(); 82 return $this->success();
84 } 83 }
85 84
@@ -95,11 +94,8 @@ class NewsLogic extends BaseLogic @@ -95,11 +94,8 @@ class NewsLogic extends BaseLogic
95 //生成一条删除路由记录 94 //生成一条删除路由记录
96 $info = $this->model->read(['id' => $id], ['id', 'url']); 95 $info = $this->model->read(['id' => $id], ['id', 'url']);
97 if ($info['url'] != $route) { 96 if ($info['url'] != $route) {
98 - $data = [  
99 - 'source' => RouteMap::SOURCE_NEWS,  
100 - 'route' => $info['url'],  
101 - ];  
102 - $this->setRouteDeleteSave($data); 97 + $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
  98 + $this->curlDelRoute($info['url']);
103 } 99 }
104 return true; 100 return true;
105 } 101 }
@@ -271,11 +267,7 @@ class NewsLogic extends BaseLogic @@ -271,11 +267,7 @@ class NewsLogic extends BaseLogic
271 RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); 267 RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
272 //生成一条删除路由记录 268 //生成一条删除路由记录
273 $info = $this->model->read(['id' => $id], ['id', 'url']); 269 $info = $this->model->read(['id' => $id], ['id', 'url']);
274 - $data = [  
275 - 'source' => RouteMap::SOURCE_NEWS,  
276 - 'route' => $info['url'],  
277 - ];  
278 - $this->setRouteDeleteSave($data); 270 + $this->curlDelRoute($info['url']);
279 return $this->success(); 271 return $this->success();
280 } 272 }
281 273
@@ -113,19 +113,20 @@ class CategoryLogic extends BaseLogic @@ -113,19 +113,20 @@ class CategoryLogic extends BaseLogic
113 DB::beginTransaction(); 113 DB::beginTransaction();
114 try { 114 try {
115 if(isset($this->param['id']) && !empty($this->param['id'])){ 115 if(isset($this->param['id']) && !empty($this->param['id'])){
116 - //是否编辑路由  
117 - $id = $this->editCategoryRoute($this->param['id'],$this->param['route']); 116 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $this->param['id'], $this->user['project_id']);
  117 + $this->editCategoryRoute($this->param['id'],$this->param['route']);
118 //处理子集 118 //处理子集
119 $this->editHandleCategory($this->param['id'],$this->param['pid']); 119 $this->editHandleCategory($this->param['id'],$this->param['pid']);
120 $this->model->edit($this->param,['id'=>$this->param['id']]); 120 $this->model->edit($this->param,['id'=>$this->param['id']]);
121 }else{ 121 }else{
122 $this->param['project_id'] = $this->user['project_id']; 122 $this->param['project_id'] = $this->user['project_id'];
123 $id = $this->model->addReturnId($this->param); 123 $id = $this->model->addReturnId($this->param);
  124 + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
  125 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
  126 + $this->edit(['route'=>$route],['id'=>$id]);
124 //处理子集 127 //处理子集
125 $this->addProcessingSon($id); 128 $this->addProcessingSon($id);
126 } 129 }
127 - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);  
128 - $this->edit(['route'=>$route],['id'=>$id]);  
129 //清除缓存 130 //清除缓存
130 Common::del_user_cache('product_category',$this->user['project_id']); 131 Common::del_user_cache('product_category',$this->user['project_id']);
131 DB::commit(); 132 DB::commit();
@@ -133,9 +134,6 @@ class CategoryLogic extends BaseLogic @@ -133,9 +134,6 @@ class CategoryLogic extends BaseLogic
133 DB::rollBack(); 134 DB::rollBack();
134 $this->fail('系统错误,请联系管理员'); 135 $this->fail('系统错误,请联系管理员');
135 } 136 }
136 - //通知更新  
137 - $notifyData = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route];  
138 - $this->updateNotify($notifyData);  
139 return $this->success(); 137 return $this->success();
140 } 138 }
141 139
@@ -234,13 +232,10 @@ class CategoryLogic extends BaseLogic @@ -234,13 +232,10 @@ class CategoryLogic extends BaseLogic
234 //生成一条删除路由记录 232 //生成一条删除路由记录
235 $info = $this->model->read(['id'=>$id],['id','route']); 233 $info = $this->model->read(['id'=>$id],['id','route']);
236 if($info['route'] != $route){ 234 if($info['route'] != $route){
237 - $data = [  
238 - 'source'=>RouteMap::SOURCE_PRODUCT_CATE,  
239 - 'route'=>$info['route'],  
240 - ];  
241 - $this->setRouteDeleteSave($data); 235 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
  236 + $this->curlDelRoute($info['route']);
242 } 237 }
243 - return $id; 238 + return true;
244 } 239 }
245 240
246 /** 241 /**
@@ -283,11 +278,7 @@ class CategoryLogic extends BaseLogic @@ -283,11 +278,7 @@ class CategoryLogic extends BaseLogic
283 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); 278 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
284 //生成一条删除路由记录 279 //生成一条删除路由记录
285 $info = $this->model->read(['id'=>$id],['id','route']); 280 $info = $this->model->read(['id'=>$id],['id','route']);
286 - $data = [  
287 - 'source'=>RouteMap::SOURCE_PRODUCT_CATE,  
288 - 'route'=>$info['route'],  
289 - ];  
290 - $this->setRouteDeleteSave($data); 281 + $this->curlDelRoute($info['route']);
291 return $this->success(); 282 return $this->success();
292 } 283 }
293 284
@@ -302,27 +293,22 @@ class CategoryLogic extends BaseLogic @@ -302,27 +293,22 @@ class CategoryLogic extends BaseLogic
302 */ 293 */
303 public function importProductCategory($project_id,$category){ 294 public function importProductCategory($project_id,$category){
304 $return = []; 295 $return = [];
305 -  
306 $cate_arr = explode('/',$category); 296 $cate_arr = explode('/',$category);
307 -  
308 $pid = 0; 297 $pid = 0;
309 foreach ($cate_arr as $v){ 298 foreach ($cate_arr as $v){
310 if($v){ 299 if($v){
311 $category_info = $this->model->read(['title'=>$v,'pid'=>$pid]); 300 $category_info = $this->model->read(['title'=>$v,'pid'=>$pid]);
312 if(!$category_info){ 301 if(!$category_info){
313 $id = $this->model->addReturnId(['title'=>$v,'pid'=>$pid,'project_id'=>$project_id]); 302 $id = $this->model->addReturnId(['title'=>$v,'pid'=>$pid,'project_id'=>$project_id]);
314 -  
315 $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_CATE, $id, $project_id); 303 $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_CATE, $id, $project_id);
316 $this->model->edit(['route'=>$route],['id'=>$id]); 304 $this->model->edit(['route'=>$route],['id'=>$id]);
317 }else{ 305 }else{
318 $id = $category_info['id']; 306 $id = $category_info['id'];
319 } 307 }
320 -  
321 $return[] = $id; 308 $return[] = $id;
322 $pid = $id; 309 $pid = $id;
323 } 310 }
324 } 311 }
325 -  
326 //清除缓存 312 //清除缓存
327 Common::del_user_cache('product_category',$project_id); 313 Common::del_user_cache('product_category',$project_id);
328 return $this->getLastCategory($return); 314 return $this->getLastCategory($return);
@@ -56,17 +56,16 @@ class KeywordLogic extends BaseLogic @@ -56,17 +56,16 @@ class KeywordLogic extends BaseLogic
56 try { 56 try {
57 $this->param = $this->handleSaveParam($this->param); 57 $this->param = $this->handleSaveParam($this->param);
58 if(isset($this->param['id']) && !empty($this->param['id'])){ 58 if(isset($this->param['id']) && !empty($this->param['id'])){
  59 + //TODO::不能修改路由
59 $this->model->edit($this->param,['id'=>$this->param['id']]); 60 $this->model->edit($this->param,['id'=>$this->param['id']]);
60 - $id = $this->param['id'];  
61 }else{ 61 }else{
62 - $this->param['project_id'] = $this->user['project_id'];  
63 - $this->param['created_at'] = date('Y-m-d H:i:s');  
64 - $this->param['updated_at'] = $this->param['created_at']; 62 + $this->param = $this->addHandleParam($this->param);
65 $id = $this->model->insertGetId($this->param); 63 $id = $this->model->insertGetId($this->param);
  64 + //路由映射
  65 + $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
  66 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_KEYWORD,$route);
  67 + $this->model->edit(['route'=>$route],['id'=>$id]);
66 } 68 }
67 - //路由映射  
68 - $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);  
69 - $this->model->edit(['route'=>$route],['id'=>$id]);  
70 //清除缓存 69 //清除缓存
71 Common::del_user_cache('product_keyword',$this->user['project_id']); 70 Common::del_user_cache('product_keyword',$this->user['project_id']);
72 DB::commit(); 71 DB::commit();
@@ -74,12 +73,24 @@ class KeywordLogic extends BaseLogic @@ -74,12 +73,24 @@ class KeywordLogic extends BaseLogic
74 DB::rollBack(); 73 DB::rollBack();
75 $this->fail('保存失败'); 74 $this->fail('保存失败');
76 } 75 }
77 - //通知更新  
78 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_KEYWORD, 'route'=>$route]);  
79 return $this->success(); 76 return $this->success();
80 } 77 }
81 78
82 /** 79 /**
  80 + * @remark :添加组装数据
  81 + * @name :addHandleParam
  82 + * @author :lyh
  83 + * @method :post
  84 + * @time :2023/11/30 15:00
  85 + */
  86 + public function addHandleParam($param){
  87 + $param['project_id'] = $this->user['project_id'];
  88 + $param['created_at'] = date('Y-m-d H:i:s');
  89 + $param['updated_at'] = $param['created_at'];
  90 + return $this->success($param);
  91 + }
  92 +
  93 + /**
83 * @remark :保存数据时参数处理 94 * @remark :保存数据时参数处理
84 * @name :handleSaveParam 95 * @name :handleSaveParam
85 * @author :lyh 96 * @author :lyh
@@ -174,11 +185,7 @@ class KeywordLogic extends BaseLogic @@ -174,11 +185,7 @@ class KeywordLogic extends BaseLogic
174 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); 185 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
175 //生成一条删除路由记录 186 //生成一条删除路由记录
176 $info = $this->model->read(['id'=>$id],['id','route']); 187 $info = $this->model->read(['id'=>$id],['id','route']);
177 - $data = [  
178 - 'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,  
179 - 'route'=>$info['route'],  
180 - ];  
181 - $this->setRouteDeleteSave($data); 188 + $this->curlDelRoute($info['route']);
182 return $this->success(); 189 return $this->success();
183 } 190 }
184 191
@@ -193,9 +200,7 @@ class KeywordLogic extends BaseLogic @@ -193,9 +200,7 @@ class KeywordLogic extends BaseLogic
193 */ 200 */
194 public function importProductKeyword($project_id,$keyword){ 201 public function importProductKeyword($project_id,$keyword){
195 $return = []; 202 $return = [];
196 -  
197 $keyword_arr = explode(',',$keyword); 203 $keyword_arr = explode(',',$keyword);
198 -  
199 foreach ($keyword_arr as $v){ 204 foreach ($keyword_arr as $v){
200 $keyword_info = $this->model->read(['title'=>$v]); 205 $keyword_info = $this->model->read(['title'=>$v]);
201 if(!$keyword_info){ 206 if(!$keyword_info){
@@ -207,7 +212,6 @@ class KeywordLogic extends BaseLogic @@ -207,7 +212,6 @@ class KeywordLogic extends BaseLogic
207 } 212 }
208 $return[] = $k_id; 213 $return[] = $k_id;
209 } 214 }
210 -  
211 //清除缓存 215 //清除缓存
212 Common::del_user_cache('product_keyword',$project_id); 216 Common::del_user_cache('product_keyword',$project_id);
213 return ','.implode(',',$return).','; 217 return ','.implode(',',$return).',';
@@ -56,16 +56,17 @@ class ProductLogic extends BaseLogic @@ -56,16 +56,17 @@ class ProductLogic extends BaseLogic
56 DB::connection('custom_mysql')->beginTransaction(); 56 DB::connection('custom_mysql')->beginTransaction();
57 try { 57 try {
58 if(isset($this->param['id']) && !empty($this->param['id'])){ 58 if(isset($this->param['id']) && !empty($this->param['id'])){
59 - $id = $this->param['id']; 59 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
60 //查看路由是否更新 60 //查看路由是否更新
61 - $this->param['route'] = $this->editProductRoute($this->param['route']); 61 + $this->editProductRoute($this->param['id'],$this->param['route']);
62 $this->model->edit($this->param,['id'=>$this->param['id']]); 62 $this->model->edit($this->param,['id'=>$this->param['id']]);
63 }else{ 63 }else{
64 $this->param = $this->addHandleParam($this->param); 64 $this->param = $this->addHandleParam($this->param);
65 $id = $this->model->addReturnId($this->param); 65 $id = $this->model->addReturnId($this->param);
  66 + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
  67 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
  68 + $this->model->edit(['route'=>$route],['id'=>$id]);
66 } 69 }
67 - $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);  
68 - $this->model->edit(['route'=> $this->param['route']],['id'=>$id]);  
69 //产品分类关联 70 //产品分类关联
70 CategoryRelated::saveRelated($id, $category_ids); 71 CategoryRelated::saveRelated($id, $category_ids);
71 //保存扩展字段 72 //保存扩展字段
@@ -75,8 +76,6 @@ class ProductLogic extends BaseLogic @@ -75,8 +76,6 @@ class ProductLogic extends BaseLogic
75 DB::connection('custom_mysql')->rollBack(); 76 DB::connection('custom_mysql')->rollBack();
76 $this->fail('系统错误请联系管理员'); 77 $this->fail('系统错误请联系管理员');
77 } 78 }
78 - //通知更新  
79 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$this->param['route']]);  
80 return $this->success(); 79 return $this->success();
81 } 80 }
82 81
@@ -154,10 +153,15 @@ class ProductLogic extends BaseLogic @@ -154,10 +153,15 @@ class ProductLogic extends BaseLogic
154 }else{ 153 }else{
155 $this->param['thumb'] = Arr::a2s([]); 154 $this->param['thumb'] = Arr::a2s([]);
156 } 155 }
157 - if(isset($this->param['route']) && !empty($this->param['route'])){  
158 - $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); 156 + try {
  157 + if(isset($this->param['route']) && !empty($this->param['route'])){
  158 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
  159 + $this->editProductRoute($this->param['route']);
  160 + }
  161 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  162 + }catch (\Exception $e){
  163 + $this->fail('系统错误,请连续管理员');;
159 } 164 }
160 - $this->model->edit($this->param,['id'=>$this->param['id']]);  
161 return $this->success(); 165 return $this->success();
162 } 166 }
163 167
@@ -285,15 +289,11 @@ class ProductLogic extends BaseLogic @@ -285,15 +289,11 @@ class ProductLogic extends BaseLogic
285 * @method :post 289 * @method :post
286 * @time :2023/9/7 10:02 290 * @time :2023/9/7 10:02
287 */ 291 */
288 - public function editProductRoute($route){  
289 - $info = $this->model->read(['id'=>$this->param['id']]); 292 + public function editProductRoute($id,$route){
  293 + $info = $this->model->read(['id'=>$id]);
290 if($info['route'] != $route){ 294 if($info['route'] != $route){
291 - //生成一条删除路由记录  
292 - $data = [  
293 - 'source'=>RouteMap::SOURCE_PRODUCT,  
294 - 'route'=>$route,  
295 - ];  
296 - $this->setRouteDeleteSave($data); 295 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
  296 + $this->curlDelRoute($info['route']);
297 } 297 }
298 return $route; 298 return $route;
299 } 299 }
@@ -340,11 +340,7 @@ class ProductLogic extends BaseLogic @@ -340,11 +340,7 @@ class ProductLogic extends BaseLogic
340 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); 340 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
341 //生成一条删除路由记录 341 //生成一条删除路由记录
342 $info = $this->model->read(['id'=>$id],['id','route']); 342 $info = $this->model->read(['id'=>$id],['id','route']);
343 - $data = [  
344 - 'source'=>RouteMap::SOURCE_PRODUCT,  
345 - 'route'=>$info['route'],  
346 - ];  
347 - $this->setRouteDeleteSave($data); 343 + $this->curlDelRoute($info['route']);
348 return $this->success(); 344 return $this->success();
349 } 345 }
350 346
@@ -418,6 +418,11 @@ Route::middleware(['bloginauth'])->group(function () { @@ -418,6 +418,11 @@ Route::middleware(['bloginauth'])->group(function () {
418 Route::any('/upload', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'upload'])->name('file_manager_upload'); 418 Route::any('/upload', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'upload'])->name('file_manager_upload');
419 Route::any('/delete', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'delete'])->name('file_manager_delete'); 419 Route::any('/delete', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'delete'])->name('file_manager_delete');
420 }); 420 });
  421 +
  422 + //小语种
  423 + Route::prefix('language')->group(function () {
  424 + Route::any('/', [\App\Http\Controllers\Bside\Setting\LanguageController::class, 'lists'])->name('language_lists');
  425 + });
421 }); 426 });
422 //无需登录验证的路由组 427 //无需登录验证的路由组
423 Route::group([], function () { 428 Route::group([], function () {