Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server
正在显示
6 个修改的文件
包含
124 行增加
和
36 行删除
| @@ -171,6 +171,12 @@ class RelayInquiry extends Command | @@ -171,6 +171,12 @@ class RelayInquiry extends Command | ||
| 171 | protected $filter_phone = [30,12,58]; | 171 | protected $filter_phone = [30,12,58]; |
| 172 | 172 | ||
| 173 | /** | 173 | /** |
| 174 | + * 需要多个ip访问的国家 | ||
| 175 | + * @var | ||
| 176 | + */ | ||
| 177 | + protected $multiple_ip_visit_country = []; | ||
| 178 | + | ||
| 179 | + /** | ||
| 174 | * @return bool | 180 | * @return bool |
| 175 | */ | 181 | */ |
| 176 | public function handle() | 182 | public function handle() |
| @@ -224,7 +230,16 @@ class RelayInquiry extends Command | @@ -224,7 +230,16 @@ class RelayInquiry extends Command | ||
| 224 | try { | 230 | try { |
| 225 | $res = false; | 231 | $res = false; |
| 226 | foreach ($ad_task as $task){ | 232 | foreach ($ad_task as $task){ |
| 227 | - $res += $this->relayDetail($task, $val); | 233 | + //需要多个ip访问的国家 随机2-5次访问,只有一次询盘 |
| 234 | + if (in_array($val->country_name, $this->multiple_ip_visit_country)) { | ||
| 235 | + $times = mt_rand([2, 5]); //随机次数 | ||
| 236 | + $inquiry_time = mt_rand([1, $times]); //第几次询盘 | ||
| 237 | + for ($i = 1; $i <= $times; $i++) { | ||
| 238 | + $res += $this->relayDetail($task, $val, $inquiry_time == $i); | ||
| 239 | + } | ||
| 240 | + }else{ | ||
| 241 | + $res += $this->relayDetail($task, $val); | ||
| 242 | + } | ||
| 228 | $res += $this->relayShopDetail($task, $val); | 243 | $res += $this->relayShopDetail($task, $val); |
| 229 | $res += $this->relayFobDetail($task, $val); | 244 | $res += $this->relayFobDetail($task, $val); |
| 230 | } | 245 | } |
| @@ -287,7 +302,7 @@ class RelayInquiry extends Command | @@ -287,7 +302,7 @@ class RelayInquiry extends Command | ||
| 287 | * @param $form | 302 | * @param $form |
| 288 | * @return bool | 303 | * @return bool |
| 289 | */ | 304 | */ |
| 290 | - public function relayDetail($task, $form) | 305 | + public function relayDetail($task, $form, $is_inquiry = true) |
| 291 | { | 306 | { |
| 292 | $this->output('获取转发对象'); | 307 | $this->output('获取转发对象'); |
| 293 | if(empty($task['target'] )){ | 308 | if(empty($task['target'] )){ |
| @@ -361,7 +376,7 @@ class RelayInquiry extends Command | @@ -361,7 +376,7 @@ class RelayInquiry extends Command | ||
| 361 | 376 | ||
| 362 | $pre = 0; | 377 | $pre = 0; |
| 363 | $start_time = time(); | 378 | $start_time = time(); |
| 364 | - $seconds = rand(300, 3000); // 开始时间 从5-50分钟后开始 | 379 | + $seconds = rand(300, 7200); // 开始时间 从5-2小时后开始 |
| 365 | $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first(); | 380 | $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first(); |
| 366 | if($exists){ | 381 | if($exists){ |
| 367 | $this->output('转发站点邮件已存在'); | 382 | $this->output('转发站点邮件已存在'); |
| @@ -375,7 +390,7 @@ class RelayInquiry extends Command | @@ -375,7 +390,7 @@ class RelayInquiry extends Command | ||
| 375 | $seconds += rand(5,60); | 390 | $seconds += rand(5,60); |
| 376 | ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds)); | 391 | ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds)); |
| 377 | // 最后一次访问询盘 加上询盘 | 392 | // 最后一次访问询盘 加上询盘 |
| 378 | - if($k+1 >= count($urls)){ | 393 | + if($is_inquiry && $k+1 >= count($urls)){ |
| 379 | $seconds += rand(30,120); | 394 | $seconds += rand(30,120); |
| 380 | $pre++; | 395 | $pre++; |
| 381 | ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds)); | 396 | ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds)); |
| @@ -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 | } |
| @@ -34,6 +34,9 @@ class AiCommandLogic extends BaseLogic | @@ -34,6 +34,9 @@ class AiCommandLogic extends BaseLogic | ||
| 34 | if(strpos($prompt, '{keyword}') !== false) { | 34 | if(strpos($prompt, '{keyword}') !== false) { |
| 35 | $prompt = str_replace('{keyword}', $this->param['keywords'], $prompt); | 35 | $prompt = str_replace('{keyword}', $this->param['keywords'], $prompt); |
| 36 | } | 36 | } |
| 37 | + if(strpos($prompt, '{topic}') !== false) { | ||
| 38 | + $prompt = str_replace('{topic}', $this->param['keywords'], $prompt); | ||
| 39 | + } | ||
| 37 | if(strpos($prompt, '{company introduction}') !== false) { | 40 | if(strpos($prompt, '{company introduction}') !== false) { |
| 38 | $company_introduction = $this->getDeployOptimize('company_en_description'); | 41 | $company_introduction = $this->getDeployOptimize('company_en_description'); |
| 39 | $prompt = str_replace('{company introduction}', $company_introduction, $prompt); | 42 | $prompt = str_replace('{company introduction}', $company_introduction, $prompt); |
app/Models/Inquiry/ReInquiryConfig.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Inquiry; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +use App\Models\Base; | ||
| 7 | +use Illuminate\Support\Facades\Cache; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * Class ReInquiryConfig | ||
| 12 | + * @package App\Models\Inquiry | ||
| 13 | + * @author zbj | ||
| 14 | + * @date 2025/2/12 | ||
| 15 | + */ | ||
| 16 | +class ReInquiryConfig extends Base | ||
| 17 | +{ | ||
| 18 | + | ||
| 19 | + //设置关联表名 | ||
| 20 | + protected $table = 'gl_re_inquiry_config'; | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + public static function getDefaultConfigCache(){ | ||
| 24 | + $cache_key = 'ReInquiryDefaultConfigCache'; | ||
| 25 | + $data = Cache::get($cache_key); | ||
| 26 | + if(!$data){ | ||
| 27 | + $data = self::pluck('content', 'key'); | ||
| 28 | + if($data){ | ||
| 29 | + Cache::put($cache_key, $data); | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + return $data; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public static function delCache(){ | ||
| 36 | + $cache_key = 'ReInquiryDefaultConfigCache'; | ||
| 37 | + Cache::forget($cache_key); | ||
| 38 | + } | ||
| 39 | +} |
| @@ -29,36 +29,6 @@ class ReInquiryTask extends Base | @@ -29,36 +29,6 @@ class ReInquiryTask extends Base | ||
| 29 | const STATUS_OPEN = 1; | 29 | const STATUS_OPEN = 1; |
| 30 | const STATUS_CLOSE = 0; | 30 | const STATUS_CLOSE = 0; |
| 31 | 31 | ||
| 32 | - const DEFAULT_AI_PARAM = [ | ||
| 33 | - 'mkeywords' => '', | ||
| 34 | - 'characters' => '30 | ||
| 35 | -40 | ||
| 36 | -50 | ||
| 37 | -60 | ||
| 38 | -70 | ||
| 39 | -80 | ||
| 40 | -90 | ||
| 41 | -100 | ||
| 42 | -120 | ||
| 43 | -150', | ||
| 44 | - 'inkeywords' => 'OEM/ODM价格 | ||
| 45 | -FOB价格多少 | ||
| 46 | -最小起订量 | ||
| 47 | -批发价格多少 | ||
| 48 | -批发价格及价格梯度 | ||
| 49 | -本地是否招商 | ||
| 50 | -支持的支付方式 | ||
| 51 | -产品画册及类别 | ||
| 52 | -公司详细资质 | ||
| 53 | -能否WhatsApp直接联系 | ||
| 54 | -是否需求本地合作伙伴', | ||
| 55 | - 'suoxie' => 'Thanks 写成 Tks | ||
| 56 | -Please 写成 Pls | ||
| 57 | -As Soon As Possible 写成 ASAP | ||
| 58 | -For Your Information 写成 FYI | ||
| 59 | -How Much 写成 HM', | ||
| 60 | - ]; | ||
| 61 | - | ||
| 62 | /** | 32 | /** |
| 63 | * 创建询盘任务 | 33 | * 创建询盘任务 |
| 64 | * @param $id | 34 | * @param $id |
| @@ -122,6 +92,6 @@ How Much 写成 HM', | @@ -122,6 +92,6 @@ How Much 写成 HM', | ||
| 122 | 92 | ||
| 123 | public function getAiParamAttribute($value) | 93 | public function getAiParamAttribute($value) |
| 124 | { | 94 | { |
| 125 | - return Arr::s2a($value) ?: self::DEFAULT_AI_PARAM; | 95 | + return Arr::s2a($value) ?: ReInquiryConfig::getDefaultConfigCache(); |
| 126 | } | 96 | } |
| 127 | } | 97 | } |
| @@ -490,6 +490,8 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -490,6 +490,8 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 490 | // FB广告相关路由 | 490 | // FB广告相关路由 |
| 491 | Route::any('/fb_list', [Aside\Task\AdsController::class, 'fbAdsList'])->name('admin.fb_ads_task_list'); | 491 | Route::any('/fb_list', [Aside\Task\AdsController::class, 'fbAdsList'])->name('admin.fb_ads_task_list'); |
| 492 | Route::any('/fb_set', [Aside\Task\AdsController::class, 'setFbAds'])->name('admin.fb_ads_task_set'); | 492 | Route::any('/fb_set', [Aside\Task\AdsController::class, 'setFbAds'])->name('admin.fb_ads_task_set'); |
| 493 | + Route::any('/fb_default_set', [Aside\Task\AdsController::class, 'fbAdsDefaultSet'])->name('admin.fb_ads_default_set'); | ||
| 494 | + Route::any('/fb_set_batch', [Aside\Task\AdsController::class, 'fbAdsSetBatch'])->name('admin.fb_ads_set_batch'); | ||
| 493 | Route::any('/fb_set_site', [Aside\Task\AdsController::class, 'setRelaySite'])->name('admin.fb_set_site'); | 495 | Route::any('/fb_set_site', [Aside\Task\AdsController::class, 'setRelaySite'])->name('admin.fb_set_site'); |
| 494 | Route::any('/fb_check_domain', [Aside\Task\AdsController::class, 'checkDomain'])->name('admin.fb_check_domain'); | 496 | Route::any('/fb_check_domain', [Aside\Task\AdsController::class, 'checkDomain'])->name('admin.fb_check_domain'); |
| 495 | Route::any('/fb_inquiry_list', [Aside\Task\AdsController::class, 'fbInquiryList'])->name('admin.fb_ads_inquiry_list'); | 497 | Route::any('/fb_inquiry_list', [Aside\Task\AdsController::class, 'fbInquiryList'])->name('admin.fb_ads_inquiry_list'); |
-
请 注册 或 登录 后发表评论