作者 lyh

gx

@@ -65,8 +65,8 @@ class KeywordController extends BaseController @@ -65,8 +65,8 @@ class KeywordController extends BaseController
65 ],[ 65 ],[
66 'id.required' => 'ID不能为空' 66 'id.required' => 'ID不能为空'
67 ]); 67 ]);
68 - $data = $logic->getInfo($this->param['id']);  
69 - return $this->success(Arr::twoKeepKeys($data, ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'created_at', 'route', 'url'])); 68 + $data = $logic->getKeywordInfo();
  69 + return $this->success($data);
70 } 70 }
71 71
72 /** 72 /**
@@ -34,9 +34,9 @@ class KeywordLogic extends BaseLogic @@ -34,9 +34,9 @@ class KeywordLogic extends BaseLogic
34 * @method :post 34 * @method :post
35 * @time :2023/8/23 16:50 35 * @time :2023/8/23 16:50
36 */ 36 */
37 - public function getInfo($id) 37 + public function getKeywordInfo()
38 { 38 {
39 - $info = parent::getInfo($id); 39 + $info = $this->model->read($this->param);
40 $info['url'] = $this->user['domain'] . $info['route']; 40 $info['url'] = $this->user['domain'] . $info['route'];
41 return $this->success($info); 41 return $this->success($info);
42 } 42 }
@@ -49,8 +49,8 @@ class KeywordLogic extends BaseLogic @@ -49,8 +49,8 @@ class KeywordLogic extends BaseLogic
49 * @time :2023/8/23 16:50 49 * @time :2023/8/23 16:50
50 */ 50 */
51 public function keywordSave(){ 51 public function keywordSave(){
52 -// DB::beginTransaction();  
53 -// try { 52 + DB::beginTransaction();
  53 + try {
54 $this->param = $this->handleSaveParam($this->param); 54 $this->param = $this->handleSaveParam($this->param);
55 if(isset($this->param['id']) && !empty($this->param['id'])){ 55 if(isset($this->param['id']) && !empty($this->param['id'])){
56 $info = $this->model->read(['id'=>$this->param['id']],['id','route']); 56 $info = $this->model->read(['id'=>$this->param['id']],['id','route']);
@@ -67,11 +67,11 @@ class KeywordLogic extends BaseLogic @@ -67,11 +67,11 @@ class KeywordLogic extends BaseLogic
67 } 67 }
68 //清除缓存 68 //清除缓存
69 Common::del_user_cache('product_keyword',$this->user['project_id']); 69 Common::del_user_cache('product_keyword',$this->user['project_id']);
70 -// DB::commit();  
71 -// }catch (\Exception $e){  
72 -// DB::rollBack();  
73 -// $this->fail('保存失败');  
74 -// } 70 + DB::commit();
  71 + }catch (\Exception $e){
  72 + DB::rollBack();
  73 + $this->fail('保存失败');
  74 + }
75 //通知更新 75 //通知更新
76 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_KEYWORD, 'route'=>$route]); 76 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_KEYWORD, 'route'=>$route]);
77 return $this->success(); 77 return $this->success();