|
...
|
...
|
@@ -14,6 +14,7 @@ use App\Http\Logic\Bside\BaseLogic; |
|
|
|
use App\Models\GoogleKeywordInsight\GoogleKeywordInsight;
|
|
|
|
use App\Models\GoogleKeywordInsight\GoogleKeywordInsightDetail;
|
|
|
|
use App\Services\GoogleKeywordInsightService;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class GoogleKeywordInsightLogic extends BaseLogic
|
|
|
|
{
|
|
...
|
...
|
@@ -39,10 +40,17 @@ class GoogleKeywordInsightLogic extends BaseLogic |
|
|
|
$this->service = new GoogleKeywordInsightService();
|
|
|
|
$data = $this->service->requestUrl($this->param['keyword']);
|
|
|
|
if(!empty($data)){
|
|
|
|
DB::beginTransaction();
|
|
|
|
//保存数据库
|
|
|
|
$detailModel = new GoogleKeywordInsightDetail();
|
|
|
|
$this->model->saveInsight($this->user['project_id'],$this->param['keyword'],$data);
|
|
|
|
$detailModel->saveInsightDetail($this->user['project_id'],$this->param['keyword'],$data);
|
|
|
|
try {
|
|
|
|
$detailModel = new GoogleKeywordInsightDetail();
|
|
|
|
$this->model->saveInsight($this->user['project_id'],$this->param['keyword'],$data);
|
|
|
|
$detailModel->saveInsightDetail($this->user['project_id'],$this->param['keyword'],$data);
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
$this->fail('保存失败,请联系管理员');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
...
|
...
|
|