|
@@ -21,7 +21,7 @@ class KeywordLogic extends BaseLogic |
|
@@ -21,7 +21,7 @@ class KeywordLogic extends BaseLogic |
|
21
|
public function __construct()
|
21
|
public function __construct()
|
|
22
|
{
|
22
|
{
|
|
23
|
parent::__construct();
|
23
|
parent::__construct();
|
|
24
|
-
|
24
|
+ $this->param = $this->requestAll;
|
|
25
|
$this->model = new Keyword();
|
25
|
$this->model = new Keyword();
|
|
26
|
}
|
26
|
}
|
|
27
|
|
27
|
|
|
@@ -43,16 +43,23 @@ class KeywordLogic extends BaseLogic |
|
@@ -43,16 +43,23 @@ class KeywordLogic extends BaseLogic |
|
43
|
return $this->success($info);
|
43
|
return $this->success($info);
|
|
44
|
}
|
44
|
}
|
|
45
|
|
45
|
|
|
46
|
- public function save($param){
|
46
|
+ public function keywordSave(){
|
|
47
|
DB::beginTransaction();
|
47
|
DB::beginTransaction();
|
|
48
|
try {
|
48
|
try {
|
|
49
|
- $res = parent::save($param);
|
49
|
+ if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
50
|
+ $id = $this->param['id'];
|
|
|
|
51
|
+ $this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
52
|
+ }else{
|
|
|
|
53
|
+ $this->param['project_id'] = $this->user['project_id'];
|
|
|
|
54
|
+ $this->param['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
55
|
+ $this->param['updated_at'] = $this->param['created_at'];
|
|
|
|
56
|
+ $id = $this->model->insertGetId($this->param);
|
|
|
|
57
|
+ }
|
|
50
|
//路由映射
|
58
|
//路由映射
|
|
51
|
- $route = RouteMap::setRoute($param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $res['id'], $this->user['project_id']);
|
59
|
+ $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
|
|
52
|
DB::commit();
|
60
|
DB::commit();
|
|
53
|
}catch (\Exception $e){
|
61
|
}catch (\Exception $e){
|
|
54
|
DB::rollBack();
|
62
|
DB::rollBack();
|
|
55
|
- errorLog('产品关键词保存失败', $param, $e);
|
|
|
|
56
|
$this->fail('保存失败');
|
63
|
$this->fail('保存失败');
|
|
57
|
}
|
64
|
}
|
|
58
|
//通知更新
|
65
|
//通知更新
|