作者 赵彬吉

update

... ... @@ -352,26 +352,29 @@ class RelayInquiry extends Command
$country_name = $ip_data->ip_area;
$this->output('转发内容');
$message = $form->message;
//开启文案替换
if($task['is_replace_text']) {
// 通过字符数量区分, 改成完全获取内置询盘内容
$use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray();
$text = ReInquiryText::whereNotIn('id', $use_ids)->where('status', ReInquiryText::STATUS_USABLE)->inRandomOrder()->first();
$message = $text->content;
$message_id = $text->id;
// 获取后,使用次数+1
$text->use_time += 1;
$text->save();
//原内容非英语,转为对应语种
if (is_numeric($form->message)) { //数字会被识别为中文
$lang = 'en';
} else {
$translateSl = Translate::translateSl($form->message);
$lang = $translateSl['texts']['sl'] ?? 'en';
}
// 通过字符数量区分, 改成完全获取内置询盘内容
$use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray();
$text = ReInquiryText::whereNotIn('id', $use_ids)->where('status', ReInquiryText::STATUS_USABLE)->inRandomOrder()->first();
$message = $text->content;
$message_id = $text->id;
// 获取后,使用次数+1
$text->use_time += 1;
$text->save();
//原内容非英语,转为对应语种
if(is_numeric($form->message)){ //数字会被识别为中文
$lang = 'en';
}else{
$translateSl = Translate::translateSl($form->message);
$lang = $translateSl['texts']['sl'] ?? 'en';
}
if($lang != 'en' || $lang != 'zh-CN'){
$message = Translate::tran($message, $lang);
if ($lang != 'en' || $lang != 'zh-CN') {
$message = Translate::tran($message, $lang);
}
}
$this->output('获取转发设备信息');
... ...
... ... @@ -81,10 +81,11 @@ class AdsController extends BaseController
$ad_img = trim($request->input('ad_img'));
$num = intval($request->input('num'));
$status = intval($request->input('status'));
$is_replace_text = intval($request->input('is_replace_text'));
if (empty($title) || empty($ad_id))
return $this->response('请填写完整信息!', Code::USER_ERROR, []);
ReInquiryTask::createTask($id, $title, $industry, $ad_id, $ad_url, $ad_img, $num, $status);
ReInquiryTask::createTask($id, $title, $industry, $ad_id, $ad_url, $ad_img, $num, $status, $is_replace_text);
return $this->response('success', Code::SUCCESS, []);
}
... ...
... ... @@ -40,7 +40,7 @@ class ReInquiryTask extends Base
* @param int $status
* @return ReInquiryTask
*/
public static function createTask($id, $title, $industry, $ad_id, $ad_url, $ad_img, $num, $status = self::STATUS_OPEN)
public static function createTask($id, $title, $industry, $ad_id, $ad_url, $ad_img, $num, $status = self::STATUS_OPEN, $is_replace_text = 1)
{
$self = self::where(['id' => $id])->first();
if (empty($self))
... ... @@ -52,6 +52,7 @@ class ReInquiryTask extends Base
$self->ad_img = $ad_img;
$self->num = $num;
$self->status = $status;
$self->is_replace_text = $is_replace_text;
$self->save();
return $self;
}
... ...