bianjunhui 1 rok temu
rodzic
commit
27ec388041
1 zmienionych plików z 24 dodań i 2 usunięć
  1. 24 2
      application/api/controller/Apmessage.php

+ 24 - 2
application/api/controller/Apmessage.php

@@ -96,7 +96,29 @@ class Apmessage extends Api
 
     public function send($one_push){
         $notification = $this->createNotification($one_push);
-        $result = $this->apiInstance->createNotification($notification);
+        $result=array();
+        for($i=0;$i<=11;$i++){
+            $dt = new DateTime();
+            $minute = 1+$i ;
+            $dt->modify("+$minute minute");
+            $notification->setSendAfter($dt);
+            $val=$i;
+            if($i==10){
+                $val='-';
+            }
+            if($i==11){
+                $filters = [ // 可选,基于特定条件过滤用户
+                    ['field' => 'tag', 'key' => 'SufixUid', 'relation' => 'not_exists']
+                ];
+            }else{
+                $filters = [ // 可选,基于特定条件过滤用户
+                    ['field' => 'tag', 'key' => 'SufixUid', 'relation' => '=', 'value' => $val]
+                ];
+            }
+            $notification->setFilters($filters);
+            $result[] = $this->apiInstance->createNotification($notification);
+        }
+
         return $result;
     }
 
@@ -185,7 +207,7 @@ class Apmessage extends Api
                     $post['addtime']=time();
                     $re = Db::name('message_read')->insertGetId($post);
                     if($re){
-                        $msg='success';
+                        $msg='';
                         if($list['coupon']){
                             $msg = 'Coupons will be in your account within 5mins!';
                         }