appid = env('WECHAT.APPID'); $this->appsecret = env('WECHAT.APPSECRET'); $this->wechat = new \Wechat(['appid' => $this->appid, 'appsecret' => $this->appsecret]); } public function handle($event) { if($event==null)return; if($event['status']==3){ $act = Act::where(['actCode'=>$event['actCode']])->findOrEmpty(); if(!$act->isEmpty()){ $this->push($act->toArray()); } } } public function push($data){ $temps=[ 'code'=>$data['actCode'], 'belong'=>1, 'openId'=>'oOpc26OhvWzdO0JlL9Q37rXyu69I', 'template_id'=>'oUFsqOfVNgavlzQKs9bT1as1miFNJ5-Q-h68eFiiQ0Q', 'template_name'=>'系统单据处理通知', 'action_name'=>'泰行销活动审批推送', 'template_data'=>['thing8' => ['value' => '泰行销直播'], 'thing4' => ['value' => $data['actCode']], 'thing5' =>['value' => Act::$statusCn[$data['status']]??'未知'], 'thing17' =>['value' => $data['contactor']], 'thing20' =>['value' => $data['depart']] ], 'uid'=>106, 'uname'=>'魏莉', ]; Cache::store('redis')->handler()->lPush('wxpush_queue',json_encode($temps)); } }