123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- declare (strict_types = 1);
- namespace app\txx\listener;
- use app\txx\model\Act;
- use think\facade\Cache;
- use think\facade\Log;
- class WxPush
- {
- 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'=>'oUFsgOfVNqavIzQKS9bT1as1miFNJ5-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'=>'魏莉',
- ];
- Log::info("推送数据".json_encode($temps,JSON_UNESCAPED_UNICODE));
- Cache::store('redis')->handler()->lPush('wxpush_queue',json_encode($temps));
- }
- }
|