setAppKeyToken($appKeyToken) ->setUserKeyToken($userKeyToken); $apiInstance = new DefaultApi( new GuzzleHttp\Client(), $config ); $result =$this->sendTest($apiInstance,$appId); $this->success('',$result); }*/ public function callbackWk() { $data =input(); $event_type = $data['event_type']; if(empty($event_type)){ echo '不处理'; exit; } $t =$data['t']; $k='longyiWkApp20240315143927'; $sign = MD5($k.$t); if($sign!=$data['sign']){ echo 'sign error'; exit; } $appId ='6bbd561f-4d8e-4d04-a6c4-dbef1bf99694'; $appKeyToken='MDMwZThjYWMtOWQ4ZC00YzU3LWIwNjktOGYzNTA2NjA3NTBh'; $userKeyToken='YTdmZGE5MGEtN2Y3Yi00Mzk0LTgyOGQtMGMzNDkzYTcxYmJh'; $config= Configuration::getDefaultConfiguration() ->setAppKeyToken($appKeyToken) ->setUserKeyToken($userKeyToken); $apiInstance = new DefaultApi( new GuzzleHttp\Client(), $config ); $result =$this->sendMessage($apiInstance,$appId); $this->success('',$result); } function createNotification($appId){ $title='Westkiss live is on air now🔔'; $template_dsc='What does the Live Stream have? Most popular wigs! Best price! Exclusive events! Join the live now!'; $content = new StringMap(); $content->setEn($template_dsc); $notification = new Notification(); $notification->setAppId($appId); $notification->setContents($content); $notification->setIosBadgeType('Increase'); $notification->setIosBadgeCount(1); $notification->setIsIos(true); $notification->setContentAvailable(true); $data['push_para']=''; $data['push_type']=888; $data['title']=$title; $data['message_id']=66888; $notification->setData($data); $notification->setMutableContent(true); $apns_alert['title']=$title; $notification->setApnsAlert($apns_alert); return $notification; } public function sendMessage($apiInstance,$appId){ $notification = $this->createNocation($appId); $re=array(); for($i=0;$i<10;$i++){ $dt = new DateTime(); $minute = 1+$i ; $dt->modify("+$minute minute"); $notification->setSendAfter($dt); $filters = [ // 可选,基于特定条件过滤用户 ['field' => 'tag', 'key' => 'SufixUid', 'relation' => '=', 'value' => $i] ]; $notification->setFilters($filters); $re[] = $apiInstance->createNotification($notification); } return $re; } }