作者 lyh

gx复制项目

@@ -220,7 +220,7 @@ class KeywordController extends BaseController @@ -220,7 +220,7 @@ class KeywordController extends BaseController
220 'title.max' => '批量操作不能超过500条数据' 220 'title.max' => '批量操作不能超过500条数据'
221 ]); 221 ]);
222 $keywordModel = new Keyword(); 222 $keywordModel = new Keyword();
223 - $rs = $keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword']],['title'=>['in',$this->param['title']]]); 223 + $rs = $keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword'] ?? 0],['title'=>['in',$this->param['title']]]);
224 if($rs === false){ 224 if($rs === false){
225 $this->fail('编辑失败,请联系管理员'); 225 $this->fail('编辑失败,请联系管理员');
226 } 226 }
@@ -127,6 +127,9 @@ class KeywordLogic extends BaseLogic @@ -127,6 +127,9 @@ class KeywordLogic extends BaseLogic
127 if(!empty($param['related_blog_ids'])){ 127 if(!empty($param['related_blog_ids'])){
128 $param['related_blog_ids'] = Arr::arrToSet($param['related_blog_ids'] ?? []); 128 $param['related_blog_ids'] = Arr::arrToSet($param['related_blog_ids'] ?? []);
129 } 129 }
  130 + if(!isset($param['is_video_keyword']) || $param['is_video_keyword'] == null){
  131 + $param['is_video_keyword'] = 0;
  132 + }
130 return $param; 133 return $param;
131 } 134 }
132 135
@@ -436,8 +436,8 @@ class ProductLogic extends BaseLogic @@ -436,8 +436,8 @@ class ProductLogic extends BaseLogic
436 public function setCopyProduct(){ 436 public function setCopyProduct(){
437 $info = $this->model->read(['id'=>$this->param['id']]); 437 $info = $this->model->read(['id'=>$this->param['id']]);
438 $param = $this->setProductParams($info); 438 $param = $this->setProductParams($info);
439 -// DB::beginTransaction();  
440 -// try { 439 + DB::beginTransaction();
  440 + try {
441 $save_id = $this->model->insertGetId($param); 441 $save_id = $this->model->insertGetId($param);
442 CategoryRelated::saveRelated($save_id, $info['category_id']); 442 CategoryRelated::saveRelated($save_id, $info['category_id']);
443 $route = preg_replace('/-product.*/', '', $param['route']); 443 $route = preg_replace('/-product.*/', '', $param['route']);
@@ -448,11 +448,11 @@ class ProductLogic extends BaseLogic @@ -448,11 +448,11 @@ class ProductLogic extends BaseLogic
448 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id); 448 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
449 //同步扩展字段 449 //同步扩展字段
450 $this->copyExtendInfo($info['id'],$save_id); 450 $this->copyExtendInfo($info['id'],$save_id);
451 -// DB::commit();  
452 -// }catch (\Exception $e){  
453 -// DB::rollBack();  
454 -// $this->fail('复制失败,请联系管理员');  
455 -// } 451 + DB::commit();
  452 + }catch (\Exception $e){
  453 + DB::rollBack();
  454 + $this->fail('复制失败,请联系管理员');
  455 + }
456 return $this->success(['id'=>$save_id]); 456 return $this->success(['id'=>$save_id]);
457 } 457 }
458 458