|
@@ -13,6 +13,7 @@ use App\Helper\QuanqiusouApi; |
|
@@ -13,6 +13,7 @@ use App\Helper\QuanqiusouApi; |
|
13
|
use App\Http\Controllers\Aside\BaseController;
|
13
|
use App\Http\Controllers\Aside\BaseController;
|
|
14
|
use App\Models\Channel\Channel;
|
14
|
use App\Models\Channel\Channel;
|
|
15
|
use App\Models\Domain\DomainInfo;
|
15
|
use App\Models\Domain\DomainInfo;
|
|
|
|
16
|
+use App\Models\Inquiry\ReInquiryConfig;
|
|
16
|
use App\Models\Inquiry\ReInquiryCost;
|
17
|
use App\Models\Inquiry\ReInquiryCost;
|
|
17
|
use App\Models\Inquiry\ReInquiryCount;
|
18
|
use App\Models\Inquiry\ReInquiryCount;
|
|
18
|
use App\Models\Inquiry\ReInquiryDetail;
|
19
|
use App\Models\Inquiry\ReInquiryDetail;
|
|
@@ -20,6 +21,7 @@ use App\Models\Inquiry\ReInquiryForm; |
|
@@ -20,6 +21,7 @@ use App\Models\Inquiry\ReInquiryForm; |
|
20
|
use App\Models\Inquiry\ReInquiryTask;
|
21
|
use App\Models\Inquiry\ReInquiryTask;
|
|
21
|
use App\Models\Project\Project;
|
22
|
use App\Models\Project\Project;
|
|
22
|
use App\Utils\HttpUtils;
|
23
|
use App\Utils\HttpUtils;
|
|
|
|
24
|
+use App\Utils\LogUtils;
|
|
23
|
use GuzzleHttp\Exception\GuzzleException;
|
25
|
use GuzzleHttp\Exception\GuzzleException;
|
|
24
|
use Illuminate\Http\Request;
|
26
|
use Illuminate\Http\Request;
|
|
25
|
use Illuminate\Support\Collection;
|
27
|
use Illuminate\Support\Collection;
|
|
@@ -96,7 +98,7 @@ class AdsController extends BaseController |
|
@@ -96,7 +98,7 @@ class AdsController extends BaseController |
|
96
|
$item['cost'] = ReInquiryCost::getCostByAdIds($item['ad_id']);
|
98
|
$item['cost'] = ReInquiryCost::getCostByAdIds($item['ad_id']);
|
|
97
|
}
|
99
|
}
|
|
98
|
$result['relay_site_total'] = $relay_site_total;
|
100
|
$result['relay_site_total'] = $relay_site_total;
|
|
99
|
- $result['default_ai_param'] = ReInquiryTask::DEFAULT_AI_PARAM;
|
101
|
+ $result['default_ai_param'] = ReInquiryConfig::getDefaultConfigCache();
|
|
100
|
|
102
|
|
|
101
|
return $this->response('success', Code::SUCCESS, $result);
|
103
|
return $this->response('success', Code::SUCCESS, $result);
|
|
102
|
}
|
104
|
}
|
|
@@ -380,4 +382,61 @@ class AdsController extends BaseController |
|
@@ -380,4 +382,61 @@ class AdsController extends BaseController |
|
380
|
|
382
|
|
|
381
|
return $this->response('success', Code::SUCCESS, $result);
|
383
|
return $this->response('success', Code::SUCCESS, $result);
|
|
382
|
}
|
384
|
}
|
|
|
|
385
|
+
|
|
|
|
386
|
+ /**
|
|
|
|
387
|
+ * 默认配置
|
|
|
|
388
|
+ * @author zbj
|
|
|
|
389
|
+ * @date 2025/2/12
|
|
|
|
390
|
+ */
|
|
|
|
391
|
+ public function fbAdsDefaultSet(){
|
|
|
|
392
|
+ $config = ReInquiryConfig::get();
|
|
|
|
393
|
+ if($this->request->isMethod('get')){
|
|
|
|
394
|
+ return $this->response('success', Code::SUCCESS, $config);
|
|
|
|
395
|
+ }
|
|
|
|
396
|
+
|
|
|
|
397
|
+ DB::beginTransaction();
|
|
|
|
398
|
+ try {
|
|
|
|
399
|
+ foreach ($config as $item){
|
|
|
|
400
|
+ if(empty($this->param[$item->key])){
|
|
|
|
401
|
+ throw new \Exception($item->title . '不能为空!');
|
|
|
|
402
|
+ }
|
|
|
|
403
|
+ $item->content = $this->param[$item->key];
|
|
|
|
404
|
+ $item->save();
|
|
|
|
405
|
+ }
|
|
|
|
406
|
+ ReInquiryConfig::delCache();
|
|
|
|
407
|
+ DB::commit();
|
|
|
|
408
|
+ }catch (\Exception $e){
|
|
|
|
409
|
+ DB::rollBack();
|
|
|
|
410
|
+ return $this->response($e->getMessage(), Code::USER_ERROR, []);
|
|
|
|
411
|
+ }
|
|
|
|
412
|
+ return $this->response('success', Code::SUCCESS, []);
|
|
|
|
413
|
+ }
|
|
|
|
414
|
+
|
|
|
|
415
|
+ /**
|
|
|
|
416
|
+ * 一键批量设置
|
|
|
|
417
|
+ * @author zbj
|
|
|
|
418
|
+ * @date 2025/2/12
|
|
|
|
419
|
+ */
|
|
|
|
420
|
+ public function fbAdsSetBatch(){
|
|
|
|
421
|
+ $config = ReInquiryConfig::find($this->param['id']);
|
|
|
|
422
|
+ if(!$config){
|
|
|
|
423
|
+ return $this->response('配置不存在', Code::USER_ERROR, []);
|
|
|
|
424
|
+ }
|
|
|
|
425
|
+ $tasks = ReInquiryTask::get();
|
|
|
|
426
|
+ DB::beginTransaction();
|
|
|
|
427
|
+ try {
|
|
|
|
428
|
+ foreach ($tasks as $task){
|
|
|
|
429
|
+ $ai_param = $task->ai_param;
|
|
|
|
430
|
+ $ai_param[$config['key']] = $config['content']?:"";
|
|
|
|
431
|
+ $task->ai_param = $ai_param;
|
|
|
|
432
|
+ $task->save();
|
|
|
|
433
|
+ }
|
|
|
|
434
|
+ DB::commit();
|
|
|
|
435
|
+ }catch (\Exception $e){
|
|
|
|
436
|
+ DB::rollBack();
|
|
|
|
437
|
+ LogUtils::error('fbAdsSetBatch error:' . $e->getMessage());
|
|
|
|
438
|
+ return $this->response('设置失败', Code::USER_ERROR, []);
|
|
|
|
439
|
+ }
|
|
|
|
440
|
+ return $this->response('success', Code::SUCCESS, []);
|
|
|
|
441
|
+ }
|
|
383
|
} |
442
|
} |