|
@@ -93,6 +93,7 @@ class Wechat
|
|
|
const GROUP_CREATE_URL='/groups/create?';
|
|
|
const GROUP_UPDATE_URL='/groups/update?';
|
|
|
const GROUP_MEMBER_UPDATE_URL='/groups/members/update?';
|
|
|
+ const GROUP_MEMBER_BATCHUPDATE_URL='/groups/members/batchupdate?';
|
|
|
const CUSTOM_SEND_URL='/message/custom/send?';
|
|
|
const MEDIA_UPLOADNEWS_URL = '/media/uploadnews?';
|
|
|
const MASS_SEND_URL = '/message/mass/send?';
|
|
@@ -1721,17 +1722,18 @@ class Wechat
|
|
|
|
|
|
/**
|
|
|
* 创建二维码ticket
|
|
|
- * @param int $scene_id 自定义追踪id
|
|
|
- * @param int $type 0:临时二维码;1:永久二维码(此时expire参数无效)
|
|
|
+ * @param int|string $scene_id 自定义追踪id,临时二维码只能用数值型
|
|
|
+ * @param int $type 0:临时二维码;1:永久二维码(此时expire参数无效);2:永久二维码(此时expire参数无效)
|
|
|
* @param int $expire 临时二维码有效期,最大为1800秒
|
|
|
* @return array('ticket'=>'qrcode字串','expire_seconds'=>1800,'url'=>'二维码图片解析后的地址')
|
|
|
*/
|
|
|
public function getQRCode($scene_id,$type=0,$expire=1800){
|
|
|
if (!$this->access_token && !$this->checkAuth()) return false;
|
|
|
+ $type = ($type && is_string($scene_id))?2:$type;
|
|
|
$data = array(
|
|
|
- 'action_name'=>$type?"QR_LIMIT_SCENE":"QR_SCENE",
|
|
|
+ 'action_name'=>$type?($type == 2?"QR_LIMIT_STR_SCENE":"QR_LIMIT_SCENE"):"QR_SCENE",
|
|
|
'expire_seconds'=>$expire,
|
|
|
- 'action_info'=>array('scene'=>array('scene_id'=>$scene_id))
|
|
|
+ 'action_info'=>array('scene'=>($type == 2?array('scene_str'=>$scene_id):array('scene_id'=>$scene_id)))
|
|
|
);
|
|
|
if ($type == 1) {
|
|
|
unset($data['expire_seconds']);
|
|
@@ -2002,6 +2004,32 @@ class Wechat
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 批量移动用户分组
|
|
|
+ * @param int $groupid 分组id
|
|
|
+ * @param string $openid_list 用户openid数组,一次不能超过50个
|
|
|
+ * @return boolean|array
|
|
|
+ */
|
|
|
+ public function batchUpdateGroupMembers($groupid,$openid_list){
|
|
|
+ if (!$this->access_token && !$this->checkAuth()) return false;
|
|
|
+ $data = array(
|
|
|
+ 'openid_list'=>$openid_list,
|
|
|
+ 'to_groupid'=>$groupid
|
|
|
+ );
|
|
|
+ $result = $this->http_post(self::API_URL_PREFIX.self::GROUP_MEMBER_BATCHUPDATE_URL.'access_token='.$this->access_token,self::json_encode($data));
|
|
|
+ if ($result)
|
|
|
+ {
|
|
|
+ $json = json_decode($result,true);
|
|
|
+ if (!$json || !empty($json['errcode'])) {
|
|
|
+ $this->errCode = $json['errcode'];
|
|
|
+ $this->errMsg = $json['errmsg'];
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return $json;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 发送客服消息
|
|
|
* @param array $data 消息结构{"touser":"OPENID","msgtype":"news","news":{...}}
|
|
|
* @return boolean|array
|