作者 Your Name
... ... @@ -11,8 +11,10 @@ use App\Models\Com\KeywordVideoTaskLog;
use App\Models\Domain\DomainInfo;
use App\Models\Domain\DomainRedirectTask;
use App\Models\Product\Keyword;
use App\Models\Project\Project;
use App\Models\Visit\SyncSubmitTask;
use App\Models\Visit\Visit;
use App\Models\Workchat\MessagePush;
use App\Services\ProjectServer;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
... ... @@ -168,4 +170,27 @@ class NoticeController extends BaseController
return $this->success();
}
/**
* 升级项目询盘hook
* 通知发送群提醒
* @param Request $request
* @return false|string
*/
public function upgradeProjectInquiryHook(Request $request)
{
$domain = trim($request->input('domain'));
$country = trim($request->input('country'));
$name = trim($request->input('name'));
$submit = trim($request->input('submit_at'));
if (empty($domain) || empty($country) || empty($name) || empty($submit))
return $this->error('参数不完整!');
$project = Project::getProjectByDomain($domain);
if (empty($project))
return $this->success();
MessagePush::addInquiryMessage(0, $project->id, $country, $name, $submit);
return $this->success();
}
}
... ...
... ... @@ -335,4 +335,17 @@ class PrivateController extends BaseController
}
return $this->success($result);
}
/**
* 获取升级项目域名
* @return false|string
*/
public function upgradeProjectDomain()
{
$domain = Project::leftJoin('gl_domain_info', 'gl_project.id', '=', 'gl_domain_info.project_id')
->where(['gl_project.is_upgrade' => Project::IS_UPGRADE_TRUE, 'gl_project.delete_status' => Project::IS_DEL_FALSE, ''])
->pluck('domain')
->toArray();
return $this->success($domain);
}
}
... ...
... ... @@ -57,7 +57,7 @@ class MessagePush extends Base
}
//特殊处理, 要求任何时候收到询盘都要及时推送到群里面
$special_project_ids = [650];
$special_project_ids = [650, 2045];
//9-21 点,每条消息及时通知
//21-第二天 9 点,整合一起通知
$hour = date('H', strtotime($submit_at));
... ... @@ -79,20 +79,27 @@ class MessagePush extends Base
$model->friend_id = $friend_id;
$model->type = self::TYPE_INQUIRY;
$model->ref_ids = $id;
$model->countries = $country;
$model->send_time = $send_time;
$model->content = '[09:00] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!';
}else{
$ref_ids = explode(',', $model->ref_ids);
$ref_ids[] = $id;
$model->ref_ids = implode(',', $ref_ids);
$countries = InquiryFormData::whereIn('id', $ref_ids)->pluck('country')->toArray();
$countries = explode(',', $model->countries);
$countries[] = $country;
$model->countries = implode(',', $countries);
// 升级项目部分询盘无法监控, 会通过接口通知, 但是ID会值为固定值0,在数据库查不到, 无法获取对应国家
$count = count($countries);
if ($countries) {
$countries = array_unique($countries);
if(count($countries) > 3){
$country = implode(',', array_slice($countries, 0, 3)) . '...';
}else{
$country = implode(',', $countries);
}
}
$model->content = '[09:00] 您的全球搜网站收到来自【' . $country . '】'.$count.'条询盘信息,请登录后台或APP进行查看!';
}
}
... ...