|
@@ -140,6 +140,66 @@ class VPush
|
|
|
return $this->getData(config('push.server.vivo.sendAll'), $data);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 标签推
|
|
|
+ * @param $tag
|
|
|
+ * @return mixed
|
|
|
+ * @throws GuzzleException
|
|
|
+ */
|
|
|
+ public function tagPush($tag)
|
|
|
+ {
|
|
|
+ // 校验参数
|
|
|
+ $this->checkParam();
|
|
|
+ $data = [
|
|
|
+ 'requestId' => Utils::randCode(),
|
|
|
+ 'title' => $this->_title,
|
|
|
+ 'content' => $this->_content,
|
|
|
+ 'notifyType' => $this->_notifyType,
|
|
|
+ 'timeToLive' => $this->_timeToLive,
|
|
|
+ 'skipType' => $this->_skipType,
|
|
|
+ 'skipContent' => $this->_skipContent,
|
|
|
+ 'networkType' => $this->_networkType,
|
|
|
+ 'clientCustomMap' => (object)[],
|
|
|
+ 'tagExpression' => [
|
|
|
+ 'andTags' => [$tag],
|
|
|
+ 'notTags' => [],
|
|
|
+ 'orTags' => []
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+
|
|
|
+ return $this->getData(config('push.server.vivo.tagPush'), $data, 'POST');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增标签
|
|
|
+ * @param $tag
|
|
|
+ * @return false|mixed
|
|
|
+ * @throws GuzzleException
|
|
|
+ */
|
|
|
+ public function addTag($tag)
|
|
|
+ {
|
|
|
+ if (empty($tag)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // token授权
|
|
|
+ $this->getAccessToken();
|
|
|
+
|
|
|
+ // 拼接链接
|
|
|
+ $url = config('push.server.vivo.addTag');
|
|
|
+
|
|
|
+ return $this->getData($url, [
|
|
|
+ 'name' => $tag
|
|
|
+ ], 'POST');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 给用户绑定tag
|
|
|
+ * @param $tag
|
|
|
+ * @param $regIds
|
|
|
+ * @return false|mixed
|
|
|
+ * @throws GuzzleException
|
|
|
+ */
|
|
|
public function addTagForUsers($tag, $regIds)
|
|
|
{
|
|
|
if (empty($tag) || empty($regIds)) {
|
|
@@ -148,6 +208,15 @@ class VPush
|
|
|
|
|
|
// token授权
|
|
|
$this->getAccessToken();
|
|
|
+
|
|
|
+ // 拼接链接
|
|
|
+ $url = config('push.server.vivo.addMembers');
|
|
|
+
|
|
|
+ return $this->getData($url, [
|
|
|
+ 'name' => $tag,
|
|
|
+ 'type' => 1,
|
|
|
+ 'ids' => $regIds
|
|
|
+ ], 'POST');
|
|
|
}
|
|
|
|
|
|
/**
|