作者 赵彬吉

update

... ... @@ -37,6 +37,10 @@ class WorkchatMessageSend extends Command
foreach ($tasks as $task) {
$this->output('开始推送消息' . $task->id);
try {
//超过两小时 不推送了
if(time() - $task->send_time > 7200){
throw new \Exception('超时两小时未推送');
}
ProjectAssociationServices::getInstance()->sendMessage($task->friend_id, $task->content, $task->content_type);
$this->output('推送消息' . $task->id . '成功');
$task->status = MessagePush::STATUS_SUCCESS;
... ...
... ... @@ -63,10 +63,10 @@ class MessagePush extends Base
$model->type = self::TYPE_INQUIRY;
$model->ref_ids = $id;
$model->content = '[' . date('H:i', strtotime($submit_at)) . '] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!';
$model->send_time = $submit_at;
}else{
//定时发送时间
$send_time = $hour >= 9 ? date('Y-m-d 09:00:00', strtotime('+1 day')) : date('Y-m-d 09:00:00');
$send_time = $hour >= 9 ? date('Y-m-d 09:00:00', strtotime($submit_at . '+1 day')) : date('Y-m-d 09:00:00', strtotime($submit_at));
$model = self::where('project_id', $project_id)->where('type', self::TYPE_INQUIRY)->where('send_time', $send_time)->first();
if(!$model){
$model = new self();
... ...