where('jg_type',1)->where('jg_status',0)->limit(0,50)->order('id')->select(); foreach ($list as $v) { UserMessage::where(['id'=>$v['id']])->update(['jg_status'=>1]); Jpush($v['user_id'],$v['content']); } } /** * @title 标签推送[根据标签id] * @desc 标签推送 * @author qc * @url /api/Task/taskLabelMessage */ //按照标签推送 public function taskLabelMessage() { $list = LabelMessage::where('jg_status',0)->where('is_deleted',0)->select()->toArray(); foreach ($list as $v) { LabelMessage::where(['id'=>$v['id']])->update(['jg_status'=>1]); $user_list = User::field('id') ->where('label','like','%|'.$v['label_id'].'|%') ->where('status','=',1) ->where('type','=',1) ->where('is_deleted','=',0)->select()->toArray();; foreach ($user_list as $user_info) { $res = Jpush($user_info['id'],$v['content']); } } } }