|
@@ -92,6 +92,14 @@ class PushService
|
|
|
$client = new HwPushCommon($pushAppId, getProp($pushApp, 'app_secret'));
|
|
|
$client->subscribeTopic(PushConst::TOPIC_ALL, [$regId]);
|
|
|
}
|
|
|
+
|
|
|
+ // 针对OPPO用户需要主动订阅topic,方便后续全量推送
|
|
|
+ if ($provider === PushConst::PROVIDER_OPPO) {
|
|
|
+ $appKey = getProp($pushApp, 'app_key');
|
|
|
+ $masterSecret = getProp($pushApp, 'master_secret');
|
|
|
+ $client = new OPPOPushCommon($appKey, $masterSecret);
|
|
|
+ $client->subscribeTags($regId, PushConst::TOPIC_ALL);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 更新用户数据库中reg_id
|
|
@@ -211,7 +219,7 @@ class PushService
|
|
|
try {
|
|
|
// 针对渠道做不同处理
|
|
|
switch ($provider) {
|
|
|
- // 华为
|
|
|
+ // 华为
|
|
|
case PushConst::PROVIDER_HW:
|
|
|
// 开发状态还是生产状态
|
|
|
$target = env('APP_ENV') === 'production' ? 2 : 1;
|
|
@@ -225,18 +233,18 @@ class PushService
|
|
|
// 推送
|
|
|
$result = $client->sendPushMessage($title, $content, $url);
|
|
|
break;
|
|
|
- // 小米
|
|
|
+ // 小米
|
|
|
case PushConst::PROVIDER_MI:
|
|
|
$client = new MiPushCommon($package, $appSecret);
|
|
|
$result = $client->sendMessageToAll($title, $content, $url);
|
|
|
break;
|
|
|
- // OPPO
|
|
|
+ // OPPO
|
|
|
case PushConst::PROVIDER_OPPO:
|
|
|
$client = new OPPOPushCommon($appKey, $masterSecret);
|
|
|
$messageId = $client->getMessageId($title, $content, $url);
|
|
|
- $result = $client->broadCastAll($messageId);
|
|
|
+ $result = $client->broadCastAll($messageId, $topic);
|
|
|
break;
|
|
|
- // VIVO
|
|
|
+ // VIVO
|
|
|
case PushConst::PROVIDER_VIVO:
|
|
|
$client = new VPush($appId, $appKey, $appSecret);
|
|
|
$client->setPushData($title, $content, $url);
|