Wang Chen 4 年之前
父节点
当前提交
abf6240a78
共有 1 个文件被更改,包括 13 次插入2 次删除
  1. 13 2
      app/Console/Commands/Push/PushTagBind.php

+ 13 - 2
app/Console/Commands/Push/PushTagBind.php

@@ -50,15 +50,26 @@ class PushTagBind extends Command
             $groupUsers = collect($users)->groupBy('app_id')->all();
             foreach($groupUsers as $appId => $userList) {
                 $regIds = collect($userList)->pluck('reg_id')->all();
+                $app    = collect($apps)->firstWhere('app_id', $appId);
                 var_dump($appId, count($regIds));
+
+                // 初始化
+                $appKey       = getProp($app, 'app_key');
+                $masterSecret = getProp($app, 'master_secret');
+                $client       = new OPPOPushCommon($appKey, $masterSecret);
+
+                // 循环绑定
+                if ($regIds && $client) {
+                    foreach($regIds as $regId) {
+                        $client->subscribeTags($regId, $tag);
+                    }
+                }
             }
 
             # 分页id
             $len = count($users);
             $id  = $users[$len - 1]['id'];
             var_dump('next id:'.$id);
-
-            break;
         }
     }