作者 赵彬吉

update

@@ -352,7 +352,9 @@ class RelayInquiry extends Command @@ -352,7 +352,9 @@ 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 - 355 + $message = $form->message;
  356 + //开启文案替换
  357 + if($task['is_replace_text']) {
356 // 通过字符数量区分, 改成完全获取内置询盘内容 358 // 通过字符数量区分, 改成完全获取内置询盘内容
357 $use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray(); 359 $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(); 360 $text = ReInquiryText::whereNotIn('id', $use_ids)->where('status', ReInquiryText::STATUS_USABLE)->inRandomOrder()->first();
@@ -363,16 +365,17 @@ class RelayInquiry extends Command @@ -363,16 +365,17 @@ class RelayInquiry extends Command
363 $text->save(); 365 $text->save();
364 366
365 //原内容非英语,转为对应语种 367 //原内容非英语,转为对应语种
366 - if(is_numeric($form->message)){ //数字会被识别为中文 368 + if (is_numeric($form->message)) { //数字会被识别为中文
367 $lang = 'en'; 369 $lang = 'en';
368 - }else{ 370 + } else {
369 $translateSl = Translate::translateSl($form->message); 371 $translateSl = Translate::translateSl($form->message);
370 $lang = $translateSl['texts']['sl'] ?? 'en'; 372 $lang = $translateSl['texts']['sl'] ?? 'en';
371 } 373 }
372 374
373 - if($lang != 'en' || $lang != 'zh-CN'){ 375 + if ($lang != 'en' || $lang != 'zh-CN') {
374 $message = Translate::tran($message, $lang); 376 $message = Translate::tran($message, $lang);
375 } 377 }
  378 + }
376 379
377 $this->output('获取转发设备信息'); 380 $this->output('获取转发设备信息');
378 // 客户端 头信息 来源 381 // 客户端 头信息 来源
@@ -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 }