作者 lyh

gx

@@ -50,7 +50,7 @@ class UpdateProductCategory extends Command @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command
50 public function handle(){ 50 public function handle(){
51 //获取所有项目 51 //获取所有项目
52 $projectModel = new Project(); 52 $projectModel = new Project();
53 - $list = $projectModel->list(['id'=>['in',[475]]],'id',['id']); 53 + $list = $projectModel->list(['id'=>['in',[302]]],'id',['id']);
54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; 54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL;
55 try { 55 try {
56 foreach ($list as $v) { 56 foreach ($list as $v) {
@@ -199,7 +199,7 @@ class BlogLogic extends BaseLogic @@ -199,7 +199,7 @@ class BlogLogic extends BaseLogic
199 foreach ($category as $v){ 199 foreach ($category as $v){
200 $str .= $v.','; 200 $str .= $v.',';
201 } 201 }
202 - return !empty($str) ? ','.$str : ''; 202 + return !empty(trim($str,',')) ? ','.$str.',' : '';
203 } 203 }
204 204
205 /** 205 /**
@@ -217,7 +217,7 @@ class NewsLogic extends BaseLogic @@ -217,7 +217,7 @@ class NewsLogic extends BaseLogic
217 foreach ($category as $v){ 217 foreach ($category as $v){
218 $str .= $v.','; 218 $str .= $v.',';
219 } 219 }
220 - return !empty($str) ? ','.$str : ''; 220 + return !empty(trim($str,',')) ? ','.$str.',' : '';
221 } 221 }
222 222
223 /** 223 /**
@@ -248,7 +248,7 @@ class CategoryLogic extends BaseLogic @@ -248,7 +248,7 @@ class CategoryLogic extends BaseLogic
248 $str .= $v.','; 248 $str .= $v.',';
249 } 249 }
250 } 250 }
251 - return !empty($str) ? ','.$str : ''; 251 + return !empty(trim($str,',')) ? ','.$str.',' : '';
252 } 252 }
253 253
254 /** 254 /**
@@ -197,6 +197,7 @@ class ProductLogic extends BaseLogic @@ -197,6 +197,7 @@ class ProductLogic extends BaseLogic
197 * @time :2023/10/26 9:49 197 * @time :2023/10/26 9:49
198 */ 198 */
199 public function editList(){ 199 public function editList(){
  200 + $category_ids = $this->param['category_id'];
200 $this->param['category_id'] = $this->handleListCategory($this->param['category_id']); 201 $this->param['category_id'] = $this->handleListCategory($this->param['category_id']);
201 $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); 202 $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']);
202 if(isset($this->param['gallery']) && !empty($this->param['gallery'])){ 203 if(isset($this->param['gallery']) && !empty($this->param['gallery'])){
@@ -215,6 +216,8 @@ class ProductLogic extends BaseLogic @@ -215,6 +216,8 @@ class ProductLogic extends BaseLogic
215 $this->editProductRoute($this->param['id'],$this->param['route']); 216 $this->editProductRoute($this->param['id'],$this->param['route']);
216 } 217 }
217 $this->model->edit($this->param,['id'=>$this->param['id']]); 218 $this->model->edit($this->param,['id'=>$this->param['id']]);
  219 + //产品分类关联
  220 + CategoryRelated::saveRelated($this->param['id'], $category_ids);
218 }catch (\Exception $e){ 221 }catch (\Exception $e){
219 $this->fail('系统错误,请连续管理员'); 222 $this->fail('系统错误,请连续管理员');
220 } 223 }
@@ -317,7 +320,7 @@ class ProductLogic extends BaseLogic @@ -317,7 +320,7 @@ class ProductLogic extends BaseLogic
317 $str .= $v.','; 320 $str .= $v.',';
318 } 321 }
319 } 322 }
320 - return !empty($str) ? ','.$str : ''; 323 + return !empty(trim($str,',')) ? ','.$str.',' : '';
321 } 324 }
322 325
323 /** 326 /**