|
...
|
...
|
@@ -13,6 +13,7 @@ use App\Helper\QuanqiusouApi; |
|
|
|
use App\Http\Controllers\Aside\BaseController;
|
|
|
|
use App\Models\Channel\Channel;
|
|
|
|
use App\Models\Domain\DomainInfo;
|
|
|
|
use App\Models\Inquiry\ReInquiryConfig;
|
|
|
|
use App\Models\Inquiry\ReInquiryCost;
|
|
|
|
use App\Models\Inquiry\ReInquiryCount;
|
|
|
|
use App\Models\Inquiry\ReInquiryDetail;
|
|
...
|
...
|
@@ -20,6 +21,7 @@ use App\Models\Inquiry\ReInquiryForm; |
|
|
|
use App\Models\Inquiry\ReInquiryTask;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Utils\HttpUtils;
|
|
|
|
use App\Utils\LogUtils;
|
|
|
|
use GuzzleHttp\Exception\GuzzleException;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Collection;
|
|
...
|
...
|
@@ -96,7 +98,7 @@ class AdsController extends BaseController |
|
|
|
$item['cost'] = ReInquiryCost::getCostByAdIds($item['ad_id']);
|
|
|
|
}
|
|
|
|
$result['relay_site_total'] = $relay_site_total;
|
|
|
|
$result['default_ai_param'] = ReInquiryTask::DEFAULT_AI_PARAM;
|
|
|
|
$result['default_ai_param'] = ReInquiryConfig::getDefaultConfigCache();
|
|
|
|
|
|
|
|
return $this->response('success', Code::SUCCESS, $result);
|
|
|
|
}
|
|
...
|
...
|
@@ -380,4 +382,61 @@ class AdsController extends BaseController |
|
|
|
|
|
|
|
return $this->response('success', Code::SUCCESS, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 默认配置
|
|
|
|
* @author zbj
|
|
|
|
* @date 2025/2/12
|
|
|
|
*/
|
|
|
|
public function fbAdsDefaultSet(){
|
|
|
|
$config = ReInquiryConfig::get();
|
|
|
|
if($this->request->isMethod('get')){
|
|
|
|
return $this->response('success', Code::SUCCESS, $config);
|
|
|
|
}
|
|
|
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
foreach ($config as $item){
|
|
|
|
if(empty($this->param[$item->key])){
|
|
|
|
throw new \Exception($item->title . '不能为空!');
|
|
|
|
}
|
|
|
|
$item->content = $this->param[$item->key];
|
|
|
|
$item->save();
|
|
|
|
}
|
|
|
|
ReInquiryConfig::delCache();
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
return $this->response($e->getMessage(), Code::USER_ERROR, []);
|
|
|
|
}
|
|
|
|
return $this->response('success', Code::SUCCESS, []);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 一键批量设置
|
|
|
|
* @author zbj
|
|
|
|
* @date 2025/2/12
|
|
|
|
*/
|
|
|
|
public function fbAdsSetBatch(){
|
|
|
|
$config = ReInquiryConfig::find($this->param['id']);
|
|
|
|
if(!$config){
|
|
|
|
return $this->response('配置不存在', Code::USER_ERROR, []);
|
|
|
|
}
|
|
|
|
$tasks = ReInquiryTask::get();
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
foreach ($tasks as $task){
|
|
|
|
$ai_param = $task->ai_param;
|
|
|
|
$ai_param[$config['key']] = $config['content']?:"";
|
|
|
|
$task->ai_param = $ai_param;
|
|
|
|
$task->save();
|
|
|
|
}
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
LogUtils::error('fbAdsSetBatch error:' . $e->getMessage());
|
|
|
|
return $this->response('设置失败', Code::USER_ERROR, []);
|
|
|
|
}
|
|
|
|
return $this->response('success', Code::SUCCESS, []);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|