|
@@ -40,17 +40,17 @@ class GoogleKeywordInsightLogic extends BaseLogic |
|
@@ -40,17 +40,17 @@ class GoogleKeywordInsightLogic extends BaseLogic |
|
40
|
$this->service = new RapIdApIService();
|
40
|
$this->service = new RapIdApIService();
|
|
41
|
$data = $this->service->requestUrl($this->param['keyword']);
|
41
|
$data = $this->service->requestUrl($this->param['keyword']);
|
|
42
|
if(!empty($data)){
|
42
|
if(!empty($data)){
|
|
43
|
-// DB::beginTransaction();
|
43
|
+ DB::beginTransaction();
|
|
44
|
//保存数据库
|
44
|
//保存数据库
|
|
45
|
-// try {
|
45
|
+ try {
|
|
46
|
$detailModel = new GoogleKeywordInsightDetail();
|
46
|
$detailModel = new GoogleKeywordInsightDetail();
|
|
47
|
$this->model->saveInsight($this->user['project_id'],$this->param['keyword'],$data);
|
47
|
$this->model->saveInsight($this->user['project_id'],$this->param['keyword'],$data);
|
|
48
|
$detailModel->saveInsightDetail($this->user['project_id'],$this->param['keyword'],$data);
|
48
|
$detailModel->saveInsightDetail($this->user['project_id'],$this->param['keyword'],$data);
|
|
49
|
-// DB::commit();
|
|
|
|
50
|
-// }catch (\Exception $e){
|
|
|
|
51
|
-// DB::rollBack();
|
|
|
|
52
|
-// $this->fail('保存失败,请联系管理员');
|
|
|
|
53
|
-// }
|
49
|
+ DB::commit();
|
|
|
|
50
|
+ }catch (\Exception $e){
|
|
|
|
51
|
+ DB::rollBack();
|
|
|
|
52
|
+ $this->fail('保存失败,请联系管理员');
|
|
|
|
53
|
+ }
|
|
54
|
}
|
54
|
}
|
|
55
|
}
|
55
|
}
|
|
56
|
return $this->success();
|
56
|
return $this->success();
|