mirror of
https://gitee.com/zoujingli/WeChatDeveloper.git
synced 2026-07-11 07:41:06 +08:00
Compare commits
No commits in common. "cd5ff0228e8bc31e76c2ef753b1313008d8c520f" and "f8f0adb3f1037f1ea7385c5cd488775def18ee39" have entirely different histories.
cd5ff0228e
...
f8f0adb3f1
287
WeChat/Card.php
287
WeChat/Card.php
@ -35,35 +35,38 @@ class Card extends BasicWeChat
|
||||
public function create(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/create?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置买单接口
|
||||
* @param string $cardId
|
||||
* @param bool $isOpen
|
||||
* @param string $card_id
|
||||
* @param bool $is_open
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function setPaycell($cardId, $isOpen = true)
|
||||
public function setPaycell($card_id, $is_open = true)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/paycell/set?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId, 'is_open' => $isOpen]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id, 'is_open' => $is_open]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自助核销接口
|
||||
* @param string $cardId
|
||||
* @param bool $isOpen
|
||||
* @param string $card_id
|
||||
* @param bool $is_open
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function setConsumeCell($cardId, $isOpen = true)
|
||||
public function setConsumeCell($card_id, $is_open = true)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/selfconsumecell/set?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId, 'is_open' => $isOpen]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id, 'is_open' => $is_open]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +79,8 @@ class Card extends BasicWeChat
|
||||
public function createQrc(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/qrcode/create?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,61 +93,66 @@ class Card extends BasicWeChat
|
||||
public function createLandingPage(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/landingpage/create?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入自定义code
|
||||
* @param string $cardId
|
||||
* @param string $card_id
|
||||
* @param array $code
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function deposit($cardId, array $code)
|
||||
public function deposit($card_id, array $code)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/code/deposit?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId, 'code' => $code]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id, 'code' => $code]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入code数目
|
||||
* @param string $cardId
|
||||
* @param string $card_id
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getDepositCount($cardId)
|
||||
public function getDepositCount($card_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/code/getdepositcount?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核查code接口
|
||||
* @param string $cardId 进行导入code的卡券ID
|
||||
* @param string $card_id 进行导入code的卡券ID
|
||||
* @param array $code 已经微信卡券后台的自定义code,上限为100个
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function checkCode($cardId, array $code)
|
||||
public function checkCode($card_id, array $code)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/code/checkcode?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId, 'code' => $code]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id, 'code' => $code]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图文消息群发卡券
|
||||
* @param string $cardId
|
||||
* @param string $card_id
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getNewsHtml($cardId)
|
||||
public function getNewsHtml($card_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/mpnews/gethtml?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,25 +166,27 @@ class Card extends BasicWeChat
|
||||
public function setTestWhiteList($openids = [], $usernames = [])
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/testwhitelist/set?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['openid' => $openids, 'username' => $usernames]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['openid' => $openids, 'username' => $usernames]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线下核销查询Code
|
||||
* @param string $code 单张卡券的唯一标准
|
||||
* @param string $cardId 卡券ID代表一类卡券。自定义code卡券必填
|
||||
* @param bool $checkConsume 是否校验code核销状态,填入true和false时的code异常状态返回数据不同
|
||||
* @param string $card_id 卡券ID代表一类卡券。自定义code卡券必填
|
||||
* @param bool $check_consume 是否校验code核销状态,填入true和false时的code异常状态返回数据不同
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCode($code, $cardId = null, $checkConsume = null)
|
||||
public function getCode($code, $card_id = null, $check_consume = null)
|
||||
{
|
||||
$data = ['code' => $code];
|
||||
is_null($cardId) || $data['card_id'] = $cardId;
|
||||
is_null($checkConsume) || $data['check_consume'] = $checkConsume;
|
||||
is_null($card_id) || $data['card_id'] = $card_id;
|
||||
is_null($check_consume) || $data['check_consume'] = $check_consume;
|
||||
$url = "https://api.weixin.qq.com/card/code/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,80 +202,86 @@ class Card extends BasicWeChat
|
||||
$data = ['code' => $code];
|
||||
is_null($card_id) || $data['card_id'] = $card_id;
|
||||
$url = "https://api.weixin.qq.com/card/code/consume?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code解码接口
|
||||
* @param string $encryptCode
|
||||
* @param string $encrypt_code
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function decrypt($encryptCode)
|
||||
public function decrypt($encrypt_code)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/code/decrypt?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['encrypt_code' => $encryptCode]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['encrypt_code' => $encrypt_code]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户已领取卡券接口
|
||||
* @param string $openid
|
||||
* @param null|string $cardId
|
||||
* @param null|string $card_id
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCardList($openid, $cardId = null)
|
||||
public function getCardList($openid, $card_id = null)
|
||||
{
|
||||
$data = ['openid' => $openid];
|
||||
is_null($cardId) || $data['card_id'] = $cardId;
|
||||
is_null($card_id) || $data['card_id'] = $card_id;
|
||||
$url = "https://api.weixin.qq.com/card/user/getcardlist?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看卡券详情
|
||||
* @param string $cardId
|
||||
* @param string $card_id
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCard($cardId)
|
||||
public function getCard($card_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询卡券列表
|
||||
* @param int $offset 查询卡列表的起始偏移量,从0开始,即offset: 5是指从从列表里的第六个开始读取
|
||||
* @param int $count 需要查询的卡片的数量(数量最大50)
|
||||
* @param array $statusList 支持开发者拉出指定状态的卡券列表
|
||||
* @param array $status_list 支持开发者拉出指定状态的卡券列表
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function batchGet($offset, $count = 50, array $statusList = [])
|
||||
public function batchGet($offset, $count = 50, array $status_list = [])
|
||||
{
|
||||
$data = ['offset' => $offset, 'count' => $count];
|
||||
empty($statusList) || $data['status_list'] = $statusList;
|
||||
empty($status_list) || $data['status_list'] = $status_list;
|
||||
$url = "https://api.weixin.qq.com/card/batchget?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改卡券信息接口
|
||||
* @param string $cardId
|
||||
* @param array $memberCard
|
||||
* @param string $card_id
|
||||
* @param array $member_card
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function updateCard($cardId, array $memberCard)
|
||||
public function updateCard($card_id, array $member_card)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/update?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId, 'member_card' => $memberCard]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id, 'member_card' => $member_card]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -279,10 +296,11 @@ class Card extends BasicWeChat
|
||||
public function modifyStock($card_id, $increase_stock_value = null, $reduce_stock_value = null)
|
||||
{
|
||||
$data = ['card_id' => $card_id];
|
||||
is_null($reduce_stock_value) || $data['reduce_stock_value'] = $reduce_stock_value;
|
||||
is_null($increase_stock_value) || $data['increase_stock_value'] = $increase_stock_value;
|
||||
is_null($reduce_stock_value) || $data['reduce_stock_value'] = $reduce_stock_value;
|
||||
$url = "https://api.weixin.qq.com/card/modifystock?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,71 +317,76 @@ class Card extends BasicWeChat
|
||||
$data = ['code' => $code, 'new_code' => $new_code];
|
||||
is_null($card_id) || $data['card_id'] = $card_id;
|
||||
$url = "https://api.weixin.qq.com/card/code/update?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除卡券接口
|
||||
* @param string $cardId
|
||||
* @param string $card_id
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function deleteCard($cardId)
|
||||
public function deleteCard($card_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/delete?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置卡券失效接口
|
||||
* @param string $code
|
||||
* @param string $cardId
|
||||
* @param string $card_id
|
||||
* @param null|string $reason
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function unAvailable($code, $cardId, $reason = null)
|
||||
public function unAvailable($code, $card_id, $reason = null)
|
||||
{
|
||||
$data = ['code' => $code, 'card_id' => $cardId];
|
||||
$data = ['code' => $code, 'card_id' => $card_id];
|
||||
is_null($reason) || $data['reason'] = $reason;
|
||||
$url = "https://api.weixin.qq.com/card/code/unavailable?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取卡券概况数据接口
|
||||
* @param string $beginDate 查询数据的起始时间
|
||||
* @param string $endDate 查询数据的截至时间
|
||||
* @param string $condSource 卡券来源(0为公众平台创建的卡券数据 1是API创建的卡券数据)
|
||||
* @param string $begin_date 查询数据的起始时间
|
||||
* @param string $end_date 查询数据的截至时间
|
||||
* @param string $cond_source 卡券来源(0为公众平台创建的卡券数据 1是API创建的卡券数据)
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCardBizuininfo($beginDate, $endDate, $condSource)
|
||||
public function getCardBizuininfo($begin_date, $end_date, $cond_source)
|
||||
{
|
||||
$data = ['begin_date' => $begin_date, 'end_date' => $end_date, 'cond_source' => $cond_source];
|
||||
$url = "https://api.weixin.qq.com/datacube/getcardbizuininfo?access_token=ACCESS_TOKEN";
|
||||
$data = ['begin_date' => $beginDate, 'end_date' => $endDate, 'cond_source' => $condSource];
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取免费券数据接口
|
||||
* @param string $beginDate 查询数据的起始时间
|
||||
* @param string $endDate 查询数据的截至时间
|
||||
* @param integer $condSource 卡券来源,0为公众平台创建的卡券数据、1是API创建的卡券数据
|
||||
* @param null $cardId 卡券ID
|
||||
* @param string $begin_date 查询数据的起始时间
|
||||
* @param string $end_date 查询数据的截至时间
|
||||
* @param integer $cond_source 卡券来源,0为公众平台创建的卡券数据、1是API创建的卡券数据
|
||||
* @param null $card_id 卡券ID
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCardCardinfo($beginDate, $endDate, $condSource, $cardId = null)
|
||||
public function getCardCardinfo($begin_date, $end_date, $cond_source, $card_id = null)
|
||||
{
|
||||
$data = ['begin_date' => $begin_date, 'end_date' => $end_date, 'cond_source' => $cond_source];
|
||||
is_null($card_id) || $data['card_id'] = $card_id;
|
||||
$url = "https://api.weixin.qq.com/datacube/getcardcardinfo?access_token=ACCESS_TOKEN";
|
||||
$data = ['begin_date' => $beginDate, 'end_date' => $endDate, 'cond_source' => $condSource];
|
||||
is_null($cardId) || $data['card_id'] = $cardId;
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
|
||||
@ -377,7 +400,8 @@ class Card extends BasicWeChat
|
||||
public function activateMemberCard(array $data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/card/membercard/activate?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -391,21 +415,23 @@ class Card extends BasicWeChat
|
||||
public function setActivateMemberCardUser(array $data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/card/membercard/activateuserform/set?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户提交资料
|
||||
* 根据activate_ticket获取到用户填写的信息
|
||||
* @param string $activateTicket
|
||||
* @param string $activate_ticket
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getActivateMemberCardTempinfo($activateTicket)
|
||||
public function getActivateMemberCardTempinfo($activate_ticket)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/card/membercard/activatetempinfo/get?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['activate_ticket' => $activateTicket]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['activate_ticket' => $activate_ticket]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -418,54 +444,58 @@ class Card extends BasicWeChat
|
||||
public function updateMemberCardUser(array $data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/card/membercard/updateuser?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取会员卡概况数据接口
|
||||
* @param string $beginDate 查询数据的起始时间
|
||||
* @param string $endDate 查询数据的截至时间
|
||||
* @param string $condSource 卡券来源(0为公众平台创建的卡券数据 1是API创建的卡券数据)
|
||||
* @param string $begin_date 查询数据的起始时间
|
||||
* @param string $end_date 查询数据的截至时间
|
||||
* @param string $cond_source 卡券来源(0为公众平台创建的卡券数据 1是API创建的卡券数据)
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCardMemberCardinfo($beginDate, $endDate, $condSource)
|
||||
public function getCardMemberCardinfo($begin_date, $end_date, $cond_source)
|
||||
{
|
||||
$data = ['begin_date' => $begin_date, 'end_date' => $end_date, 'cond_source' => $cond_source];
|
||||
$url = "https://api.weixin.qq.com/datacube/getcardmembercardinfo?access_token=ACCESS_TOKEN";
|
||||
$data = ['begin_date' => $beginDate, 'end_date' => $endDate, 'cond_source' => $condSource];
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取单张会员卡数据接口
|
||||
* @param string $beginDate 查询数据的起始时间
|
||||
* @param string $endDate 查询数据的截至时间
|
||||
* @param string $cardId 卡券id
|
||||
* @param string $begin_date 查询数据的起始时间
|
||||
* @param string $end_date 查询数据的截至时间
|
||||
* @param string $card_id 卡券id
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCardMemberCardDetail($beginDate, $endDate, $cardId)
|
||||
public function getCardMemberCardDetail($begin_date, $end_date, $card_id)
|
||||
{
|
||||
$data = ['begin_date' => $begin_date, 'end_date' => $end_date, 'card_id' => $card_id];
|
||||
$url = "https://api.weixin.qq.com/datacube/getcardmembercarddetail?access_token=ACCESS_TOKEN";
|
||||
$data = ['begin_date' => $beginDate, 'end_date' => $endDate, 'card_id' => $cardId];
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取会员信息(积分查询)接口
|
||||
* @param string $cardId 查询会员卡的cardid
|
||||
* @param string $card_id 查询会员卡的cardid
|
||||
* @param string $code 所查询用户领取到的code值
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCardMemberCard($cardId, $code)
|
||||
public function getCardMemberCard($card_id, $code)
|
||||
{
|
||||
$data = ['card_id' => $cardId, 'code' => $code];
|
||||
$data = ['card_id' => $card_id, 'code' => $code];
|
||||
$url = "https://api.weixin.qq.com/card/membercard/userinfo/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -478,33 +508,36 @@ class Card extends BasicWeChat
|
||||
public function payGiftCard(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/paygiftcard/add?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除支付后投放卡券规则
|
||||
* @param integer $ruleId 支付即会员的规则名称
|
||||
* @param integer $rule_id 支付即会员的规则名称
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function delPayGiftCard($ruleId)
|
||||
public function delPayGiftCard($rule_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/paygiftcard/add?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['rule_id' => $ruleId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['rule_id' => $rule_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付后投放卡券规则详情
|
||||
* @param integer $ruleId 要查询规则id
|
||||
* @param integer $rule_id 要查询规则id
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getPayGiftCard($ruleId)
|
||||
public function getPayGiftCard($rule_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/paygiftcard/getbyid?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['rule_id' => $ruleId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['rule_id' => $rule_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -518,9 +551,10 @@ class Card extends BasicWeChat
|
||||
*/
|
||||
public function batchGetPayGiftCard($offset = 0, $count = 10, $effective = true)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/paygiftcard/batchget?access_token=ACCESS_TOKEN";
|
||||
$data = ['type' => 'RULE_TYPE_PAY_MEMBER_CARD', 'offset' => $offset, 'count' => $count, 'effective' => $effective];
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/card/paygiftcard/batchget?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -533,7 +567,8 @@ class Card extends BasicWeChat
|
||||
public function addActivity(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/mkt/activity/create?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -545,21 +580,23 @@ class Card extends BasicWeChat
|
||||
public function payActivate()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/pay/activate?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对优惠券批价
|
||||
* @param string $cardId 需要来配置库存的card_id
|
||||
* @param string $card_id 需要来配置库存的card_id
|
||||
* @param integer $quantity 本次需要兑换的库存数目
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getPayprice($cardId, $quantity)
|
||||
public function getPayprice($card_id, $quantity)
|
||||
{
|
||||
$url = "POST https://api.weixin.qq.com/card/pay/getpayprice?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['card_id' => $cardId, 'quantity' => $quantity]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['card_id' => $card_id, 'quantity' => $quantity]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -571,49 +608,53 @@ class Card extends BasicWeChat
|
||||
public function getCoinsInfo()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/pay/getcoinsinfo?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认兑换库存接口
|
||||
* @param string $cardId 需要来兑换库存的card_id
|
||||
* @param string $card_id 需要来兑换库存的card_id
|
||||
* @param integer $quantity 本次需要兑换的库存数目
|
||||
* @param string $orderId 仅可以使用上面得到的订单号,保证批价有效性
|
||||
* @param string $order_id 仅可以使用上面得到的订单号,保证批价有效性
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function payConfirm($cardId, $quantity, $orderId)
|
||||
public function payConfirm($card_id, $quantity, $order_id)
|
||||
{
|
||||
$data = ['card_id' => $card_id, 'quantity' => $quantity, 'order_id' => $order_id];
|
||||
$url = "https://api.weixin.qq.com/card/pay/confirm?access_token=ACCESS_TOKEN";
|
||||
$data = ['card_id' => $cardId, 'quantity' => $quantity, 'order_id' => $orderId];
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值券点接口
|
||||
* @param integer $coinCount
|
||||
* @param integer $coin_count
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function payRecharge($coinCount)
|
||||
public function payRecharge($coin_count)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/pay/recharge?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['coin_count' => $coinCount]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['coin_count' => $coin_count]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单详情接口
|
||||
* @param string $orderId
|
||||
* @param string $order_id
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function payGetOrder($orderId)
|
||||
public function payGetOrder($order_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/pay/getorder?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['order_id' => $orderId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['order_id' => $order_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -626,6 +667,8 @@ class Card extends BasicWeChat
|
||||
public function payGetList(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/pay/getorderlist?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
}
|
||||
@ -126,28 +126,28 @@ abstract class BasicAliPay
|
||||
|
||||
/**
|
||||
* 查询支付宝订单状态
|
||||
* @param string $outTradeNo
|
||||
* @param string $out_trade_no
|
||||
* @return array|boolean
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function query($outTradeNo = '')
|
||||
public function query($out_trade_no = '')
|
||||
{
|
||||
$this->options->set('method', 'alipay.trade.query');
|
||||
return $this->getResult(['out_trade_no' => $outTradeNo]);
|
||||
return $this->getResult(['out_trade_no' => $out_trade_no]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝订单退款操作
|
||||
* @param array|string $options 退款参数或退款商户订单号
|
||||
* @param null $refundAmount 退款金额
|
||||
* @param null $refund_amount 退款金额
|
||||
* @return array|boolean
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function refund($options, $refundAmount = null)
|
||||
public function refund($options, $refund_amount = null)
|
||||
{
|
||||
if (!is_array($options)) $options = ['out_trade_no' => $options, 'refund_amount' => $refundAmount];
|
||||
if (!is_array($options)) $options = ['out_trade_no' => $options, 'refund_amount' => $refund_amount];
|
||||
$this->options->set('method', 'alipay.trade.refund');
|
||||
return $this->getResult($options);
|
||||
}
|
||||
|
||||
@ -36,49 +36,55 @@ class Custom extends BasicWeChat
|
||||
*/
|
||||
public function addAccount($kf_account, $nickname)
|
||||
{
|
||||
$data = ['kf_account' => $kf_account, 'nickname' => $nickname];
|
||||
$url = "https://api.weixin.qq.com/customservice/kfaccount/add?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['kf_account' => $kf_account, 'nickname' => $nickname]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客服帐号
|
||||
* @param string $kfAccount 客服账号
|
||||
* @param string $kf_account 客服账号
|
||||
* @param string $nickname 客服昵称
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function updateAccount($kfAccount, $nickname)
|
||||
public function updateAccount($kf_account, $nickname)
|
||||
{
|
||||
$data = ['kf_account' => $kf_account, 'nickname' => $nickname];
|
||||
$url = "https://api.weixin.qq.com/customservice/kfaccount/update?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['kf_account' => $kfAccount, 'nickname' => $nickname]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客服帐号
|
||||
* @param string $kfAccount 客服账号
|
||||
* @param string $kf_account 客服账号
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function deleteAccount($kfAccount)
|
||||
public function deleteAccount($kf_account)
|
||||
{
|
||||
$data = ['kf_account' => $kf_account];
|
||||
$url = "https://api.weixin.qq.com/customservice/kfaccount/del?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['kf_account' => $kfAccount]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请绑定客服帐号
|
||||
* @param string $kfAccount 完整客服帐号,格式为:帐号前缀@公众号微信号
|
||||
* @param string $kf_account 完整客服帐号,格式为:帐号前缀@公众号微信号
|
||||
* @param string $invite_wx 接收绑定邀请的客服微信号
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function inviteWorker($kfAccount, $invite_wx)
|
||||
public function inviteWorker($kf_account, $invite_wx)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/customservice/kfaccount/inviteworker?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['kf_account' => $kfAccount, 'invite_wx' => $invite_wx]);
|
||||
return $this->callPostApi($url, ['kf_account' => $kf_account, 'invite_wx' => $invite_wx]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +96,8 @@ class Custom extends BasicWeChat
|
||||
public function getAccountList()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,8 +110,9 @@ class Custom extends BasicWeChat
|
||||
*/
|
||||
public function uploadHeadimg($kf_account, $image)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token=ACCESS_TOKEN&kf_account={$kf_account}";
|
||||
return $this->callPostApi($url, ['media' => Tools::createCurlFile($image)], false);
|
||||
$url = "http://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token=ACCESS_TOKEN&kf_account={$kf_account}";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['media' => Tools::createCurlFile($image)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,7 +125,8 @@ class Custom extends BasicWeChat
|
||||
public function send(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,7 +140,8 @@ class Custom extends BasicWeChat
|
||||
public function typing($openid, $command = 'Typing')
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/custom/typing?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['touser' => $openid, 'command' => $command]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['touser' => $openid, 'command' => $command]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,7 +154,8 @@ class Custom extends BasicWeChat
|
||||
public function massSendAll(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,7 +168,8 @@ class Custom extends BasicWeChat
|
||||
public function massSend(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,7 +185,8 @@ class Custom extends BasicWeChat
|
||||
$data = ['msg_id' => $msg_id];
|
||||
is_null($article_idx) || $data['article_idx'] = $article_idx;
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/delete?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -186,20 +199,22 @@ class Custom extends BasicWeChat
|
||||
public function massPreview(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/preview?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询群发消息发送状态【订阅号与服务号认证后均可用】
|
||||
* @param integer $msgId 群发消息后返回的消息id
|
||||
* @param integer $msg_id 群发消息后返回的消息id
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function massGet($msgId)
|
||||
public function massGet($msg_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['msg_id' => $msgId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['msg_id' => $msg_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -211,7 +226,8 @@ class Custom extends BasicWeChat
|
||||
public function massGetSeed()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/speed/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, []);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, []);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -224,6 +240,9 @@ class Custom extends BasicWeChat
|
||||
public function massSetSeed($speed)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/speed/set?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['speed' => $speed]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['speed' => $speed]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -36,34 +36,38 @@ class Draft extends BasicWeChat
|
||||
public function add($articles)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/draft/add?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['articles' => $articles]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['articles' => $articles]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取草稿
|
||||
* @param string $mediaId
|
||||
* @param string $media_id
|
||||
* @param string $outType 返回处理函数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function get($mediaId, $outType = null)
|
||||
public function get($media_id, $outType = null)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/draft/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['media_id' => $mediaId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['media_id' => $media_id]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除草稿
|
||||
* @param string $mediaId
|
||||
* @param string $media_id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function delete($mediaId)
|
||||
public function delete($media_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/draft/delete?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['media_id' => $mediaId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['media_id' => $media_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +80,8 @@ class Draft extends BasicWeChat
|
||||
public function addNews($data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/material/add_news?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,9 +95,10 @@ class Draft extends BasicWeChat
|
||||
*/
|
||||
public function update($media_id, $index, $articles)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/draft/update?access_token=ACCESS_TOKEN";
|
||||
$data = ['media_id' => $media_id, 'index' => $index, 'articles' => $articles];
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/draft/update?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,21 +110,24 @@ class Draft extends BasicWeChat
|
||||
public function getCount()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/draft/count?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取草稿列表
|
||||
* @param int $offset 从全部素材的该偏移位置开始返回,0表示从第一个素材返回
|
||||
* @param int $count 返回素材的数量,取值在1到20之间
|
||||
* @param int $noContent 1 表示不返回 content 字段,0 表示正常返回,默认为 0
|
||||
* @param int $no_content 1 表示不返回 content 字段,0 表示正常返回,默认为 0
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function batchGet($offset = 0, $count = 20, $noContent = 0)
|
||||
public function batchGet($offset = 0, $count = 20, $no_content = 0)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/draft/batchget?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['no_content' => $noContent, 'offset' => $offset, 'count' => $count]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['no_content' => $no_content, 'offset' => $offset, 'count' => $count]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -29,70 +29,75 @@ class Freepublish extends BasicWeChat
|
||||
/**
|
||||
* 发布接口
|
||||
* 开发者需要先将图文素材以草稿的形式保存(见“草稿箱/新建草稿”,如需从已保存的草稿中选择,见“草稿箱/获取草稿列表”)
|
||||
* @param mixed $mediaId 选择要发布的草稿的media_id
|
||||
* @param mixed $media_id 选择要发布的草稿的media_id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function submit($mediaId)
|
||||
public function submit($media_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/freepublish/submit?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['media_id' => $mediaId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['media_id' => $media_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布状态轮询接口
|
||||
* @param mixed $publishId
|
||||
* @param mixed $publish_id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function get($publishId)
|
||||
public function get($publish_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/freepublish/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['publish_id' => $publishId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['publish_id' => $publish_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除发布
|
||||
* 发布成功之后,随时可以通过该接口删除。此操作不可逆,请谨慎操作。
|
||||
* @param mixed $articleId 成功发布时返回的 article_id
|
||||
* @param mixed $article_id 成功发布时返回的 article_id
|
||||
* @param int $index 要删除的文章在图文消息中的位置,第一篇编号为1,该字段不填或填0会删除全部文章
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function delete($articleId, $index = 0)
|
||||
public function delete($article_id, $index = 0)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/freepublish/delete?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['article_id' => $articleId, 'index' => $index]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['article_id' => $article_id, 'index' => $index]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 article_id 获取已发布文章
|
||||
* @param mixed $articleId 要获取的草稿的article_id
|
||||
* @param mixed $article_id 要获取的草稿的article_id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getArticle($articleId)
|
||||
public function getArticle($article_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/freepublish/getarticle?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['article_id' => $articleId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['article_id' => $article_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取成功发布列表
|
||||
* @param int $offset 从全部素材的该偏移位置开始返回,0表示从第一个素材返回
|
||||
* @param int $count 返回素材的数量,取值在1到20之间
|
||||
* @param int $noContent 1 表示不返回 content 字段,0 表示正常返回,默认为 0
|
||||
* @param int $no_content 1 表示不返回 content 字段,0 表示正常返回,默认为 0
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function batchGet($offset = 0, $count = 20, $noContent = 0)
|
||||
public function batchGet($offset = 0, $count = 20, $no_content = 0)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/freepublish/batchget?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['no_content' => $noContent, 'offset' => $offset, 'count' => $count]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['no_content' => $no_content, 'offset' => $offset, 'count' => $count]);
|
||||
}
|
||||
}
|
||||
@ -61,6 +61,7 @@ class Limit extends BasicWeChat
|
||||
public function getCallbackIp()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token=ACCESS_TOKEN';
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
}
|
||||
@ -41,7 +41,8 @@ class Media extends BasicWeChat
|
||||
throw new InvalidResponseException('Invalid Media Type.', '0');
|
||||
}
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type={$type}";
|
||||
return $this->callPostApi($url, ['media' => Tools::createCurlFile($filename)], false);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['media' => Tools::createCurlFile($filename)], false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,7 +57,7 @@ class Media extends BasicWeChat
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id={$media_id}";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
if ($outType == 'url') return $url;
|
||||
if($outType=='url') return $url;
|
||||
$result = Tools::get($url);
|
||||
if (is_array($json = json_decode($result, true))) {
|
||||
if (!$this->isTry && isset($json['errcode']) && in_array($json['errcode'], ['40014', '40001', '41001', '42001'])) {
|
||||
@ -78,7 +79,8 @@ class Media extends BasicWeChat
|
||||
public function addNews($data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/material/add_news?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,8 +94,10 @@ class Media extends BasicWeChat
|
||||
*/
|
||||
public function updateNews($media_id, $index, $news)
|
||||
{
|
||||
$data = ['media_id' => $media_id, 'index' => $index, 'articles' => $news];
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/material/update_news?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['media_id' => $media_id, 'index' => $index, 'articles' => $news]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +110,8 @@ class Media extends BasicWeChat
|
||||
public function uploadImg($filename)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['media' => Tools::createCurlFile($filename)], false);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['media' => Tools::createCurlFile($filename)], false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,7 +129,8 @@ class Media extends BasicWeChat
|
||||
throw new InvalidResponseException('Invalid Media Type.', '0');
|
||||
}
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type={$type}";
|
||||
return $this->callPostApi($url, ['media' => Tools::createCurlFile($filename), 'description' => Tools::arr2json($description)], false);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['media' => Tools::createCurlFile($filename), 'description' => Tools::arr2json($description)], false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,7 +145,7 @@ class Media extends BasicWeChat
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
if ($outType == 'url') return $url;
|
||||
if($outType=='url') return $url;
|
||||
$result = Tools::post($url, ['media_id' => $media_id]);
|
||||
if (is_array($json = json_decode($result, true))) {
|
||||
if (!$this->isTry && isset($json['errcode']) && in_array($json['errcode'], ['40014', '40001', '41001', '42001'])) {
|
||||
@ -153,15 +159,16 @@ class Media extends BasicWeChat
|
||||
|
||||
/**
|
||||
* 删除永久素材
|
||||
* @param string $mediaId
|
||||
* @param string $media_id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function delMaterial($mediaId)
|
||||
public function delMaterial($media_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/material/del_material?access_token=ACCESS_TOKEN";
|
||||
return $this->httpPostForJson($url, ['media_id' => $mediaId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['media_id' => $media_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,7 +180,8 @@ class Media extends BasicWeChat
|
||||
public function getMaterialCount()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,6 +199,7 @@ class Media extends BasicWeChat
|
||||
throw new InvalidResponseException('Invalid Media Type.', '0');
|
||||
}
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['type' => $type, 'offset' => $offset, 'count' => $count]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['type' => $type, 'offset' => $offset, 'count' => $count]);
|
||||
}
|
||||
}
|
||||
@ -35,7 +35,8 @@ class Menu extends BasicWeChat
|
||||
public function get()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,7 +48,8 @@ class Menu extends BasicWeChat
|
||||
public function delete()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,7 +62,8 @@ class Menu extends BasicWeChat
|
||||
public function create(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,7 +76,8 @@ class Menu extends BasicWeChat
|
||||
public function addConditional(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/menu/addconditional?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,7 +90,8 @@ class Menu extends BasicWeChat
|
||||
public function delConditional($menuid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/menu/delconditional?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['menuid' => $menuid]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['menuid' => $menuid]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,6 +104,7 @@ class Menu extends BasicWeChat
|
||||
public function tryConditional($openid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/menu/trymatch?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['user_id' => $openid]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['user_id' => $openid]);
|
||||
}
|
||||
}
|
||||
@ -72,30 +72,30 @@ class Oauth extends BasicWeChat
|
||||
|
||||
/**
|
||||
* 检验授权凭证(access_token)是否有效
|
||||
* @param string $accessToken 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同
|
||||
* @param string $access_token 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同
|
||||
* @param string $openid 用户的唯一标识
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function checkOauthAccessToken($accessToken, $openid)
|
||||
public function checkOauthAccessToken($access_token, $openid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/sns/auth?access_token={$accessToken}&openid={$openid}";
|
||||
$url = "https://api.weixin.qq.com/sns/auth?access_token={$access_token}&openid={$openid}";
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取用户信息(需scope为 snsapi_userinfo)
|
||||
* @param string $accessToken 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同
|
||||
* @param string $access_token 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同
|
||||
* @param string $openid 用户的唯一标识
|
||||
* @param string $lang 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getUserInfo($accessToken, $openid, $lang = 'zh_CN')
|
||||
public function getUserInfo($access_token, $openid, $lang = 'zh_CN')
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/sns/userinfo?access_token={$accessToken}&openid={$openid}&lang={$lang}";
|
||||
$url = "https://api.weixin.qq.com/sns/userinfo?access_token={$access_token}&openid={$openid}&lang={$lang}";
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,9 +36,10 @@ class Product extends BasicWeChat
|
||||
*/
|
||||
public function modStatus($keystandard, $keystr, $status = 'on')
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/modstatus?access_token=ACCESS_TOKEN";
|
||||
$data = ['keystandard' => $keystandard, 'keystr' => $keystr, 'status' => $status];
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/scan/product/modstatus?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,8 +52,10 @@ class Product extends BasicWeChat
|
||||
*/
|
||||
public function setTestWhiteList(array $openids = [], array $usernames = [])
|
||||
{
|
||||
$data = ['openid' => $openids, 'username' => $usernames];
|
||||
$url = "https://api.weixin.qq.com/scan/testwhitelist/set?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['openid' => $openids, 'username' => $usernames]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,10 +70,11 @@ class Product extends BasicWeChat
|
||||
*/
|
||||
public function getQrcode($keystandard, $keystr, $qrcode_size, $extinfo = [])
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/getqrcode?access_token=ACCESS_TOKEN";
|
||||
$data = ['keystandard' => $keystandard, 'keystr' => $keystr, 'qrcode_size' => $qrcode_size];
|
||||
empty($extinfo) || $data['extinfo'] = $extinfo;
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/scan/product/getqrcode?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,10 +87,11 @@ class Product extends BasicWeChat
|
||||
*/
|
||||
public function getProduct($keystandard, $keystr)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/get?access_token=ACCESS_TOKEN";
|
||||
$data = ['keystandard' => $keystandard, 'keystr' => $keystr];
|
||||
empty($extinfo) || $data['extinfo'] = $extinfo;
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/scan/product/get?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,11 +106,12 @@ class Product extends BasicWeChat
|
||||
*/
|
||||
public function getProductList($offset, $limit = 10, $status = null, $keystr = '')
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/get?access_token=ACCESS_TOKEN";
|
||||
$data = ['offset' => $offset, 'limit' => $limit];
|
||||
is_null($status) || $data['status'] = $status;
|
||||
empty($keystr) || $data['keystr'] = $keystr;
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/scan/product/get?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,7 +124,8 @@ class Product extends BasicWeChat
|
||||
public function updateProduct(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/update?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +139,8 @@ class Product extends BasicWeChat
|
||||
public function clearProduct($keystandard, $keystr)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/clear?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['keystandard' => $keystandard, 'keystr' => $keystr]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['keystandard' => $keystandard, 'keystr' => $keystr]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,7 +153,8 @@ class Product extends BasicWeChat
|
||||
public function scanTicketCheck($ticket)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/scanticket/check?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['ticket' => $ticket]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['ticket' => $ticket]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,8 +168,10 @@ class Product extends BasicWeChat
|
||||
*/
|
||||
public function clearScanticket($keystandard, $keystr, $extinfo)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/scanticket/check?access_token=ACCESS_TOKEN";
|
||||
$data = ['keystandard' => $keystandard, 'keystr' => $keystr, 'extinfo' => $extinfo];
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/scan/scanticket/check?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
}
|
||||
@ -48,7 +48,8 @@ class Qrcode extends BasicWeChat
|
||||
$data['action_name'] = is_integer($scene) ? 'QR_LIMIT_SCENE' : 'QR_LIMIT_STR_SCENE';
|
||||
}
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,6 +72,7 @@ class Qrcode extends BasicWeChat
|
||||
public function shortUrl($longUrl)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/shorturl?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['action' => 'long2short', 'long_url' => $longUrl]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['action' => 'long2short', 'long_url' => $longUrl]);
|
||||
}
|
||||
}
|
||||
@ -34,7 +34,8 @@ class Scan extends BasicWeChat
|
||||
public function getMerchantInfo()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/merchantinfo/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,7 +48,8 @@ class Scan extends BasicWeChat
|
||||
public function addProduct(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/create?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,9 +63,10 @@ class Scan extends BasicWeChat
|
||||
*/
|
||||
public function modProduct($keystandard, $keystr, $status = 'on')
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/modstatus?access_token=ACCESS_TOKEN";
|
||||
$data = ['keystandard' => $keystandard, 'keystr' => $keystr, 'status' => $status];
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/scan/product/modstatus?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,8 +79,10 @@ class Scan extends BasicWeChat
|
||||
*/
|
||||
public function setTestWhiteList($openids = [], $usernames = [])
|
||||
{
|
||||
$data = ['openid' => $openids, 'username' => $usernames];
|
||||
$url = "https://api.weixin.qq.com/scan/product/modstatus?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['openid' => $openids, 'username' => $usernames]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,10 +97,11 @@ class Scan extends BasicWeChat
|
||||
*/
|
||||
public function getQrc($keystandard, $keystr, $extinfo = null, $qrcode_size = 64)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/getqrcode?access_token=ACCESS_TOKEN";
|
||||
$data = ['keystandard' => $keystandard, 'keystr' => $keystr, 'qrcode_size' => $qrcode_size];
|
||||
is_null($extinfo) || $data['extinfo'] = $extinfo;
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/scan/product/getqrcode?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +115,8 @@ class Scan extends BasicWeChat
|
||||
public function getProductInfo($keystandard, $keystr)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['keystandard' => $keystandard, 'keystr' => $keystr]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['keystandard' => $keystandard, 'keystr' => $keystr]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,11 +131,12 @@ class Scan extends BasicWeChat
|
||||
*/
|
||||
public function getProductList($offset = 1, $limit = 10, $status = null, $keystr = null)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/getlist?access_token=ACCESS_TOKEN";
|
||||
$data = ['offset' => $offset, 'limit' => $limit];
|
||||
is_null($status) || $data['status'] = $status;
|
||||
is_null($keystr) || $data['keystr'] = $keystr;
|
||||
return $this->callPostApi($url, $data);
|
||||
$url = "https://api.weixin.qq.com/scan/product/getlist?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,7 +149,8 @@ class Scan extends BasicWeChat
|
||||
public function updateProduct(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/update?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,7 +164,8 @@ class Scan extends BasicWeChat
|
||||
public function clearProduct($keystandard, $keystr)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/product/clear?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['keystandard' => $keystandard, 'keystr' => $keystr]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['keystandard' => $keystandard, 'keystr' => $keystr]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -168,7 +178,8 @@ class Scan extends BasicWeChat
|
||||
public function checkTicket($ticket)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/scanticket/check?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['ticket' => $ticket]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['ticket' => $ticket]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,6 +194,8 @@ class Scan extends BasicWeChat
|
||||
public function clearScanTicket($keystandard, $keystr, $extinfo)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/scan/scanticket/check?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['keystandard' => $keystandard, 'keystr' => $keystr, 'extinfo' => $extinfo]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['keystandard' => $keystandard, 'keystr' => $keystr, 'extinfo' => $extinfo]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -36,7 +36,8 @@ class Shake extends BasicWeChat
|
||||
public function register(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/account/register?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,7 +49,8 @@ class Shake extends BasicWeChat
|
||||
public function auditStatus()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/account/auditstatus?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +69,8 @@ class Shake extends BasicWeChat
|
||||
is_null($poi_id) || $data['poi_id'] = $poi_id;
|
||||
is_null($comment) || $data['comment'] = $comment;
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/applyid?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,7 +83,8 @@ class Shake extends BasicWeChat
|
||||
public function getApplyStatus($applyId)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/applyid?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['apply_id' => $applyId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['apply_id' => $applyId]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,7 +97,8 @@ class Shake extends BasicWeChat
|
||||
public function updateApply(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/update?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +111,8 @@ class Shake extends BasicWeChat
|
||||
public function bindLocation(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/bindlocation?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,7 +125,8 @@ class Shake extends BasicWeChat
|
||||
public function search(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/search?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +139,8 @@ class Shake extends BasicWeChat
|
||||
public function createPage(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/page/add?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,7 +153,8 @@ class Shake extends BasicWeChat
|
||||
public function updatePage(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/page/update?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,20 +167,22 @@ class Shake extends BasicWeChat
|
||||
public function searchPage(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/page/search?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除页面
|
||||
* @param integer $pageId 指定页面的id
|
||||
* @param integer $page_id 指定页面的id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function deletePage($pageId)
|
||||
public function deletePage($page_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/page/delete?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['page_id' => $pageId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['page_id' => $page_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,7 +196,8 @@ class Shake extends BasicWeChat
|
||||
public function upload($filename, $type = 'icon')
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/material/add?access_token=ACCESS_TOKEN&type={$type}";
|
||||
return $this->callPostApi($url, ['media' => Tools::createCurlFile($filename)], false);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['media' => Tools::createCurlFile($filename)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -198,7 +210,8 @@ class Shake extends BasicWeChat
|
||||
public function bindPage(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/bindpage?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -211,7 +224,8 @@ class Shake extends BasicWeChat
|
||||
public function queryPage(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/relation/search?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -224,63 +238,68 @@ class Shake extends BasicWeChat
|
||||
public function totalDevice(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/statistics/device?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询设备统计数据接口
|
||||
* @param integer $date 指定查询日期时间戳,单位为秒
|
||||
* @param integer $pageIndex 指定查询的结果页序号;返回结果按摇周边人数降序排序,每50条记录为一页
|
||||
* @param integer $page_index 指定查询的结果页序号;返回结果按摇周边人数降序排序,每50条记录为一页
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function totalDeviceList($date, $pageIndex = 1)
|
||||
public function totalDeviceList($date, $page_index = 1)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/statistics/devicelist?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['date' => $date, 'page_index' => $pageIndex]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['date' => $date, 'page_index' => $page_index]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以页面为维度的数据统计接口
|
||||
* @param integer $pageId 指定页面的设备ID
|
||||
* @param integer $beginDate 起始日期时间戳,最长时间跨度为30天,单位为秒
|
||||
* @param integer $endDate 结束日期时间戳,最长时间跨度为30天,单位为秒
|
||||
* @param integer $page_id 指定页面的设备ID
|
||||
* @param integer $begin_date 起始日期时间戳,最长时间跨度为30天,单位为秒
|
||||
* @param integer $end_date 结束日期时间戳,最长时间跨度为30天,单位为秒
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function totalPage($pageId, $beginDate, $endDate)
|
||||
public function totalPage($page_id, $begin_date, $end_date)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/statistics/page?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['page_id' => $pageId, 'begin_date' => $beginDate, 'end_date' => $endDate]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['page_id' => $page_id, 'begin_date' => $begin_date, 'end_date' => $end_date]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑分组信息
|
||||
* @param integer $groupId 分组唯一标识,全局唯一
|
||||
* @param string $groupName 分组名称,不超过100汉字或200个英文字母
|
||||
* @param integer $group_id 分组唯一标识,全局唯一
|
||||
* @param string $group_name 分组名称,不超过100汉字或200个英文字母
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function updateGroup($groupId, $groupName)
|
||||
public function updateGroup($group_id, $group_name)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/group/update?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['group_id' => $groupId, 'group_name' => $groupName]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['group_id' => $group_id, 'group_name' => $group_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分组
|
||||
* @param integer $groupId 分组唯一标识,全局唯一
|
||||
* @param integer $group_id 分组唯一标识,全局唯一
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function deleteGroup($groupId)
|
||||
public function deleteGroup($group_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/group/delete?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['group_id' => $groupId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['group_id' => $group_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -294,7 +313,8 @@ class Shake extends BasicWeChat
|
||||
public function getGroupList($begin = 0, $count = 10)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/group/getlist?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['begin' => $begin, 'count' => $count]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['begin' => $begin, 'count' => $count]);
|
||||
}
|
||||
|
||||
|
||||
@ -310,7 +330,8 @@ class Shake extends BasicWeChat
|
||||
public function getGroupDetail($group_id, $begin = 0, $count = 100)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/group/getdetail?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['group_id' => $group_id, 'begin' => $begin, 'count' => $count]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['group_id' => $group_id, 'begin' => $begin, 'count' => $count]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -323,7 +344,8 @@ class Shake extends BasicWeChat
|
||||
public function addDeviceGroup(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/group/adddevice?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -336,6 +358,8 @@ class Shake extends BasicWeChat
|
||||
public function deleteDeviceGroup(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/shakearound/device/group/deletedevice?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
}
|
||||
@ -33,7 +33,8 @@ class Tags extends BasicWeChat
|
||||
public function getTags()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/tags/get?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -46,7 +47,8 @@ class Tags extends BasicWeChat
|
||||
public function createTags($name)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/tags/create?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['tag' => ['name' => $name]]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['tag' => ['name' => $name]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,7 +62,8 @@ class Tags extends BasicWeChat
|
||||
public function updateTags($id, $name)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/tags/update?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['tag' => ['name' => $name, 'id' => $id]]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['tag' => ['name' => $name, 'id' => $id]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,7 +76,8 @@ class Tags extends BasicWeChat
|
||||
public function deleteTags($tagId)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/tags/delete?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['tag' => ['id' => $tagId]]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['tag' => ['id' => $tagId]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,7 +91,8 @@ class Tags extends BasicWeChat
|
||||
public function batchTagging(array $openids, $tagId)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['openid_list' => $openids, 'tagid' => $tagId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['openid_list' => $openids, 'tagid' => $tagId]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,7 +106,8 @@ class Tags extends BasicWeChat
|
||||
public function batchUntagging(array $openids, $tagId)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['openid_list' => $openids, 'tagid' => $tagId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['openid_list' => $openids, 'tagid' => $tagId]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,6 +120,7 @@ class Tags extends BasicWeChat
|
||||
public function getUserTagId($openid)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['openid' => $openid]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['openid' => $openid]);
|
||||
}
|
||||
}
|
||||
@ -27,16 +27,17 @@ class Template extends BasicWeChat
|
||||
{
|
||||
/**
|
||||
* 设置所属行业
|
||||
* @param string $industryId1 公众号模板消息所属行业编号
|
||||
* @param string $industryId2 公众号模板消息所属行业编号
|
||||
* @param string $industry_id1 公众号模板消息所属行业编号
|
||||
* @param string $industry_id2 公众号模板消息所属行业编号
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function setIndustry($industryId1, $industryId2)
|
||||
public function setIndustry($industry_id1, $industry_id2)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['industry_id1' => $industryId1, 'industry_id2' => $industryId2]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['industry_id1' => $industry_id1, 'industry_id2' => $industry_id2]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,7 +49,8 @@ class Template extends BasicWeChat
|
||||
public function getIndustry()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,7 +64,8 @@ class Template extends BasicWeChat
|
||||
public function addTemplate($templateIdShort, $keywordNameList = [])
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['template_id_short' => $templateIdShort, 'keyword_name_list' => $keywordNameList]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['template_id_short' => $templateIdShort, 'keyword_name_list' => $keywordNameList]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,20 +77,22 @@ class Template extends BasicWeChat
|
||||
public function getAllPrivateTemplate()
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=ACCESS_TOKEN";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板ID
|
||||
* @param string $tplId 公众帐号下模板消息ID
|
||||
* @param string $tpl_id 公众帐号下模板消息ID
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function delPrivateTemplate($tplId)
|
||||
public function delPrivateTemplate($tpl_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/template/del_private_template?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['template_id' => $tplId]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['template_id' => $tpl_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,6 +105,9 @@ class Template extends BasicWeChat
|
||||
public function send(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -37,7 +37,8 @@ class User extends BasicWeChat
|
||||
public function updateMark($openid, $remark)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['openid' => $openid, 'remark' => $remark]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['openid' => $openid, 'remark' => $remark]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,7 +52,8 @@ class User extends BasicWeChat
|
||||
public function getUserInfo($openid, $lang = 'zh_CN')
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid={$openid}&lang={$lang}";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,7 +71,8 @@ class User extends BasicWeChat
|
||||
foreach ($openids as $openid) {
|
||||
$data['user_list'][] = ['openid' => $openid, 'lang' => $lang];
|
||||
}
|
||||
return $this->callPostApi($url, $data);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,34 +85,37 @@ class User extends BasicWeChat
|
||||
public function getUserList($next_openid = '')
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid={$next_openid}";
|
||||
return $this->callGetApi($url);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标签下粉丝列表
|
||||
* @param integer $tagid 标签ID
|
||||
* @param string $nextOpenid 第一个拉取的OPENID
|
||||
* @param string $next_openid 第一个拉取的OPENID
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getUserListByTag($tagid, $nextOpenid = '')
|
||||
public function getUserListByTag($tagid, $next_openid = '')
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['tagid' => $tagid, 'next_openid' => $nextOpenid]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['tagid' => $tagid, 'next_openid' => $next_openid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公众号的黑名单列表
|
||||
* @param string $beginOpenid
|
||||
* @param string $begin_openid
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getBlackList($beginOpenid = '')
|
||||
public function getBlackList($begin_openid = '')
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/tags/members/getblacklist?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['begin_openid' => $beginOpenid]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['begin_openid' => $begin_openid]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,7 +128,8 @@ class User extends BasicWeChat
|
||||
public function batchBlackList(array $openids)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchblacklist?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['openid_list' => $openids]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['openid_list' => $openids]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,6 +142,8 @@ class User extends BasicWeChat
|
||||
public function batchUnblackList(array $openids)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchunblacklist?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, ['openid_list' => $openids]);
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['openid_list' => $openids]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -27,33 +27,25 @@ use WeChat\Contracts\Tools;
|
||||
class Qrcode extends BasicWeChat
|
||||
{
|
||||
|
||||
/**
|
||||
* 默认线条颜色
|
||||
* @var string[]
|
||||
*/
|
||||
private $lineColor = ["r" => "0", "g" => "0", "b" => "0"];
|
||||
|
||||
/**
|
||||
* 获取小程序码(永久有效)
|
||||
* 接口A: 适用于需要的码数量较少的业务场景
|
||||
* @param string $path 不能为空,最大长度 128 字节
|
||||
* @param integer $width 二维码的宽度
|
||||
* @param bool $autoColor 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
|
||||
* @param null|array $lineColor auto_color 为 false 时生效
|
||||
* @param array $lineColor auto_color 为 false 时生效
|
||||
* @param boolean $isHyaline 透明底色
|
||||
* @param string|null $outType 输出类型
|
||||
* @param array $extra 其他参数
|
||||
* @return string|array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function createMiniPath($path, $width = 430, $autoColor = false, $lineColor = null, $isHyaline = true, $outType = null, array $extra = [])
|
||||
public function createMiniPath($path, $width = 430, $autoColor = false, $lineColor = ["r" => "0", "g" => "0", "b" => "0"], $isHyaline = true, $outType = null)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/getwxacode?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
$lineColor = empty($lineColor) ? $this->lineColor : $lineColor;
|
||||
$data = ['path' => $path, 'width' => $width, 'auto_color' => $autoColor, 'line_color' => $lineColor, 'is_hyaline' => $isHyaline];
|
||||
return $this->parseResult(Tools::post($url, Tools::arr2json(array_merge($data, $extra))), $outType);
|
||||
return $this->parseResult(Tools::post($url, Tools::arr2json($data)), $outType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,7 +55,7 @@ class Qrcode extends BasicWeChat
|
||||
* @param string $page 必须是已经发布的小程序存在的页面
|
||||
* @param integer $width 二维码的宽度
|
||||
* @param bool $autoColor 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
|
||||
* @param null|array $lineColor auto_color 为 false 时生效
|
||||
* @param array $lineColor auto_color 为 false 时生效
|
||||
* @param bool $isHyaline 是否需要透明底色
|
||||
* @param null|string $outType 输出类型
|
||||
* @param array $extra 其他参数
|
||||
@ -71,11 +63,10 @@ class Qrcode extends BasicWeChat
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function createMiniScene($scene, $page = '', $width = 430, $autoColor = false, $lineColor = null, $isHyaline = true, $outType = null, array $extra = [])
|
||||
public function createMiniScene($scene, $page = '', $width = 430, $autoColor = false, $lineColor = ["r" => "0", "g" => "0", "b" => "0"], $isHyaline = true, $outType = null, array $extra = [])
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
$lineColor = empty($lineColor) ? $this->lineColor : $lineColor;
|
||||
$data = ['scene' => $scene, 'width' => $width, 'page' => $page, 'auto_color' => $autoColor, 'line_color' => $lineColor, 'is_hyaline' => $isHyaline, 'check_path' => false];
|
||||
if (empty($page)) unset($data['page']);
|
||||
return $this->parseResult(Tools::post($url, Tools::arr2json(array_merge($data, $extra))), $outType);
|
||||
|
||||
@ -27,30 +27,30 @@ class Total extends BasicWeChat
|
||||
{
|
||||
/**
|
||||
* 数据分析接口
|
||||
* @param string $beginDate 开始日期
|
||||
* @param string $endDate 结束日期,限定查询1天数据,end_date允许设置的最大值为昨日
|
||||
* @param string $begin_date 开始日期
|
||||
* @param string $end_date 结束日期,限定查询1天数据,end_date允许设置的最大值为昨日
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getWeanalysisAppidDailySummarytrend($beginDate, $endDate)
|
||||
public function getWeanalysisAppidDailySummarytrend($begin_date, $end_date)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappiddailysummarytrend?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['begin_date' => $beginDate, 'end_date' => $endDate], true);
|
||||
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 访问分析
|
||||
* @param string $beginDate 开始日期
|
||||
* @param string $endDate 结束日期,限定查询1天数据,end_date允许设置的最大值为昨日
|
||||
* @param string $begin_date 开始日期
|
||||
* @param string $end_date 结束日期,限定查询1天数据,end_date允许设置的最大值为昨日
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getWeanalysisAppidDailyVisittrend($beginDate, $endDate)
|
||||
public function getWeanalysisAppidDailyVisittrend($begin_date, $end_date)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, ['begin_date' => $beginDate, 'end_date' => $endDate], true);
|
||||
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user