作者 赵彬吉

update

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