正在显示
3 个修改的文件
包含
26 行增加
和
21 行删除
| @@ -352,26 +352,29 @@ class RelayInquiry extends Command | @@ -352,26 +352,29 @@ class RelayInquiry extends Command | ||
| 352 | $country_name = $ip_data->ip_area; | 352 | $country_name = $ip_data->ip_area; |
| 353 | 353 | ||
| 354 | $this->output('转发内容'); | 354 | $this->output('转发内容'); |
| 355 | + $message = $form->message; | ||
| 356 | + //开启文案替换 | ||
| 357 | + if($task['is_replace_text']) { | ||
| 358 | + // 通过字符数量区分, 改成完全获取内置询盘内容 | ||
| 359 | + $use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray(); | ||
| 360 | + $text = ReInquiryText::whereNotIn('id', $use_ids)->where('status', ReInquiryText::STATUS_USABLE)->inRandomOrder()->first(); | ||
| 361 | + $message = $text->content; | ||
| 362 | + $message_id = $text->id; | ||
| 363 | + // 获取后,使用次数+1 | ||
| 364 | + $text->use_time += 1; | ||
| 365 | + $text->save(); | ||
| 366 | + | ||
| 367 | + //原内容非英语,转为对应语种 | ||
| 368 | + if (is_numeric($form->message)) { //数字会被识别为中文 | ||
| 369 | + $lang = 'en'; | ||
| 370 | + } else { | ||
| 371 | + $translateSl = Translate::translateSl($form->message); | ||
| 372 | + $lang = $translateSl['texts']['sl'] ?? 'en'; | ||
| 373 | + } | ||
| 355 | 374 | ||
| 356 | - // 通过字符数量区分, 改成完全获取内置询盘内容 | ||
| 357 | - $use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray(); | ||
| 358 | - $text = ReInquiryText::whereNotIn('id', $use_ids)->where('status', ReInquiryText::STATUS_USABLE)->inRandomOrder()->first(); | ||
| 359 | - $message = $text->content; | ||
| 360 | - $message_id = $text->id; | ||
| 361 | - // 获取后,使用次数+1 | ||
| 362 | - $text->use_time += 1; | ||
| 363 | - $text->save(); | ||
| 364 | - | ||
| 365 | - //原内容非英语,转为对应语种 | ||
| 366 | - if(is_numeric($form->message)){ //数字会被识别为中文 | ||
| 367 | - $lang = 'en'; | ||
| 368 | - }else{ | ||
| 369 | - $translateSl = Translate::translateSl($form->message); | ||
| 370 | - $lang = $translateSl['texts']['sl'] ?? 'en'; | ||
| 371 | - } | ||
| 372 | - | ||
| 373 | - if($lang != 'en' || $lang != 'zh-CN'){ | ||
| 374 | - $message = Translate::tran($message, $lang); | 375 | + if ($lang != 'en' || $lang != 'zh-CN') { |
| 376 | + $message = Translate::tran($message, $lang); | ||
| 377 | + } | ||
| 375 | } | 378 | } |
| 376 | 379 | ||
| 377 | $this->output('获取转发设备信息'); | 380 | $this->output('获取转发设备信息'); |
| @@ -81,10 +81,11 @@ class AdsController extends BaseController | @@ -81,10 +81,11 @@ class AdsController extends BaseController | ||
| 81 | $ad_img = trim($request->input('ad_img')); | 81 | $ad_img = trim($request->input('ad_img')); |
| 82 | $num = intval($request->input('num')); | 82 | $num = intval($request->input('num')); |
| 83 | $status = intval($request->input('status')); | 83 | $status = intval($request->input('status')); |
| 84 | + $is_replace_text = intval($request->input('is_replace_text')); | ||
| 84 | if (empty($title) || empty($ad_id)) | 85 | if (empty($title) || empty($ad_id)) |
| 85 | return $this->response('请填写完整信息!', Code::USER_ERROR, []); | 86 | return $this->response('请填写完整信息!', Code::USER_ERROR, []); |
| 86 | 87 | ||
| 87 | - ReInquiryTask::createTask($id, $title, $industry, $ad_id, $ad_url, $ad_img, $num, $status); | 88 | + ReInquiryTask::createTask($id, $title, $industry, $ad_id, $ad_url, $ad_img, $num, $status, $is_replace_text); |
| 88 | return $this->response('success', Code::SUCCESS, []); | 89 | return $this->response('success', Code::SUCCESS, []); |
| 89 | } | 90 | } |
| 90 | 91 |
| @@ -40,7 +40,7 @@ class ReInquiryTask extends Base | @@ -40,7 +40,7 @@ class ReInquiryTask extends Base | ||
| 40 | * @param int $status | 40 | * @param int $status |
| 41 | * @return ReInquiryTask | 41 | * @return ReInquiryTask |
| 42 | */ | 42 | */ |
| 43 | - public static function createTask($id, $title, $industry, $ad_id, $ad_url, $ad_img, $num, $status = self::STATUS_OPEN) | 43 | + public static function createTask($id, $title, $industry, $ad_id, $ad_url, $ad_img, $num, $status = self::STATUS_OPEN, $is_replace_text = 1) |
| 44 | { | 44 | { |
| 45 | $self = self::where(['id' => $id])->first(); | 45 | $self = self::where(['id' => $id])->first(); |
| 46 | if (empty($self)) | 46 | if (empty($self)) |
| @@ -52,6 +52,7 @@ class ReInquiryTask extends Base | @@ -52,6 +52,7 @@ class ReInquiryTask extends Base | ||
| 52 | $self->ad_img = $ad_img; | 52 | $self->ad_img = $ad_img; |
| 53 | $self->num = $num; | 53 | $self->num = $num; |
| 54 | $self->status = $status; | 54 | $self->status = $status; |
| 55 | + $self->is_replace_text = $is_replace_text; | ||
| 55 | $self->save(); | 56 | $self->save(); |
| 56 | return $self; | 57 | return $self; |
| 57 | } | 58 | } |
-
请 注册 或 登录 后发表评论