作者 lyh

gx脚本更新路由

@@ -41,7 +41,7 @@ class ProductLogic extends BaseLogic @@ -41,7 +41,7 @@ class ProductLogic extends BaseLogic
41 * @time :2023/8/21 18:35 41 * @time :2023/8/21 18:35
42 */ 42 */
43 public function productSave(){ 43 public function productSave(){
44 -// try { 44 + try {
45 if(isset($this->param['id']) && !empty($this->param['id'])){ 45 if(isset($this->param['id']) && !empty($this->param['id'])){
46 $data = $this->editProduct(); 46 $data = $this->editProduct();
47 }else{ 47 }else{
@@ -50,11 +50,11 @@ class ProductLogic extends BaseLogic @@ -50,11 +50,11 @@ class ProductLogic extends BaseLogic
50 CategoryRelated::saveRelated($data['id'], $this->param['category_id'] ?? []);//分类关联 50 CategoryRelated::saveRelated($data['id'], $this->param['category_id'] ?? []);//分类关联
51 KeywordRelated::saveRelated($data['id'],$this->param['keyword_id'] ?? []);//关键字关联 51 KeywordRelated::saveRelated($data['id'],$this->param['keyword_id'] ?? []);//关键字关联
52 $this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段 52 $this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段
53 -// $this->saveDetail($data['id'],$this->param['detail'] ?? []);  
54 -// }catch (\Exception $e){  
55 -// Log::info('错误信息---'.$e->getMessage());  
56 -// $this->fail('系统错误,请联系管理员');  
57 -// } 53 + $this->saveDetail($data['id'],$this->param['detail'] ?? []);
  54 + }catch (\Exception $e){
  55 + Log::info('错误信息---'.$e->getMessage());
  56 + $this->fail('系统错误,请联系管理员');
  57 + }
58 $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? ''); 58 $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? '');
59 $this->curlDelRoute(['new_route'=>$data['route'] ?? '']); 59 $this->curlDelRoute(['new_route'=>$data['route'] ?? '']);
60 return $this->success(['id'=>$data['id']]); 60 return $this->success(['id'=>$data['id']]);
@@ -75,14 +75,9 @@ class ProductLogic extends BaseLogic @@ -75,14 +75,9 @@ class ProductLogic extends BaseLogic
75 if($this->user['project_id'] != 2059){//2059项目不处理排序 75 if($this->user['project_id'] != 2059){//2059项目不处理排序
76 $param['sort'] = $this->setProductSort(); 76 $param['sort'] = $this->setProductSort();
77 } 77 }
78 -// try {  
79 - $id = $this->model->addReturnId($param);  
80 - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);  
81 - $this->model->edit(['route'=>$route],['id'=>$id]);  
82 - //保存新描述  
83 -// }catch (\Exception $e){  
84 -// $this->fail('操作失败,请联系管理员:'.$e->getMessage());  
85 -// } 78 + $id = $this->model->addReturnId($param);
  79 + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
  80 + $this->model->edit(['route'=>$route],['id'=>$id]);
86 return $this->success(['id'=>$id,'route'=>$route]); 81 return $this->success(['id'=>$id,'route'=>$route]);
87 } 82 }
88 83
@@ -99,17 +94,12 @@ class ProductLogic extends BaseLogic @@ -99,17 +94,12 @@ class ProductLogic extends BaseLogic
99 $route = $param['route']; 94 $route = $param['route'];
100 $is_upgrade = $param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 95 $is_upgrade = $param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
101 $six_read = $param['six_read'] ?? 0;//是否按6.0显示 96 $six_read = $param['six_read'] ?? 0;//是否按6.0显示
102 - try {  
103 - if($six_read == 0 && $is_upgrade == 1){  
104 - unset($param['route']);  
105 - }else{  
106 - $param['route'] = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);  
107 - }  
108 - $this->model->edit($param,['id'=>$this->param['id']]);  
109 - //保存新描述  
110 - }catch (\Exception $e){  
111 - $this->fail('操作失败,请联系管理员:'.$e->getMessage()); 97 + if($six_read == 0 && $is_upgrade == 1){
  98 + unset($param['route']);
  99 + }else{
  100 + $param['route'] = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
112 } 101 }
  102 + $this->model->edit($param,['id'=>$this->param['id']]);
113 return $this->success(['id'=>$this->param['id'],'route'=>$route]); 103 return $this->success(['id'=>$this->param['id'],'route'=>$route]);
114 } 104 }
115 105