移除小程序接口重复注入的问题

This commit is contained in:
Anyon 2022-04-06 17:37:27 +08:00
parent 7e463a0c80
commit 34412f58fb
22 changed files with 319 additions and 391 deletions

View File

@ -82,7 +82,6 @@ class Custom extends BasicWeChat
public function inviteWorker($kf_account, $invite_wx)
{
$url = 'https://api.weixin.qq.com/customservice/kfaccount/inviteworker?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['kf_account' => $kf_account, 'invite_wx' => $invite_wx]);
}

View File

@ -33,7 +33,6 @@ class Limit extends BasicWeChat
public function clearQuota()
{
$url = 'https://api.weixin.qq.com/cgi-bin/clear_quota?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['appid' => $this->config->get('appid')]);
}
@ -48,7 +47,6 @@ class Limit extends BasicWeChat
public function ping($action = 'all', $operator = 'DEFAULT')
{
$url = 'https://api.weixin.qq.com/cgi-bin/callback/check?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['action' => $action, 'check_operator' => $operator]);
}

View File

@ -18,6 +18,8 @@ use WeChat\Contracts\BasicWeChat;
use WeChat\Contracts\Tools;
use WeChat\Exceptions\InvalidDecryptException;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
use WXBizDataCrypt;
/**
@ -38,7 +40,7 @@ class Crypt extends BasicWeChat
public function decode($iv, $sessionKey, $encryptedData)
{
require_once __DIR__ . DIRECTORY_SEPARATOR . 'crypt' . DIRECTORY_SEPARATOR . 'wxBizDataCrypt.php';
$pc = new \WXBizDataCrypt($this->config->get('appid'), $sessionKey);
$pc = new WXBizDataCrypt($this->config->get('appid'), $sessionKey);
$errCode = $pc->decryptData($encryptedData, $iv, $data);
if ($errCode == 0) {
return json_decode($data, true);
@ -50,7 +52,7 @@ class Crypt extends BasicWeChat
* 登录凭证校验
* @param string $code 登录时获取的 code
* @return array
* @throws \WeChat\Exceptions\LocalCacheException
* @throws LocalCacheException
*/
public function session($code)
{
@ -68,7 +70,7 @@ class Crypt extends BasicWeChat
* @return array
* @throws InvalidDecryptException
* @throws InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws LocalCacheException
*/
public function userInfo($code, $iv, $encryptedData)
{
@ -83,6 +85,20 @@ class Crypt extends BasicWeChat
return array_merge($result, $userinfo);
}
/**
* 通过授权码换取手机号
* @param string $code
* @return array
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getPhoneNumber($code)
{
$url = 'https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, ['code' => $code], true);
}
/**
* 用户支付完成后,获取该用户的 UnionId
* @param string $openid 支付用户唯一标识
@ -90,8 +106,8 @@ class Crypt extends BasicWeChat
* @param null|string $mch_id 微信支付分配的商户号,和商户订单号配合使用
* @param null|string $out_trade_no 微信支付商户订单号,和商户号配合使用
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getPaidUnionId($openid, $transaction_id = null, $mch_id = null, $out_trade_no = null)
{

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序即时配送
@ -28,13 +30,12 @@ class Delivery extends BasicWeChat
* 异常件退回商家商家确认收货接口
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function abnormalConfirm($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/confirm_return?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -42,13 +43,12 @@ class Delivery extends BasicWeChat
* 下配送单接口
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addOrder($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/add?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -56,13 +56,12 @@ class Delivery extends BasicWeChat
* 可以对待接单状态的订单增加小费
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addTip($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/addtips?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -70,13 +69,12 @@ class Delivery extends BasicWeChat
* 取消配送单接口
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function cancelOrder($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/cancel?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -84,13 +82,12 @@ class Delivery extends BasicWeChat
* 获取已支持的配送公司列表接口
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getAllImmeDelivery($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/delivery/getall?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -98,13 +95,12 @@ class Delivery extends BasicWeChat
* 拉取已绑定账号
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getBindAccount($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/shop/get?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -112,13 +108,12 @@ class Delivery extends BasicWeChat
* 拉取配送单信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getOrder($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/get?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -126,13 +121,12 @@ class Delivery extends BasicWeChat
* 模拟配送公司更新配送单状态
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function mockUpdateOrder($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/test_update_order?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -140,13 +134,12 @@ class Delivery extends BasicWeChat
* 预下配送单接口
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function preAddOrder($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/pre_add?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -154,8 +147,8 @@ class Delivery extends BasicWeChat
* 预取消配送单接口
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function preCancelOrder($data)
{
@ -168,8 +161,8 @@ class Delivery extends BasicWeChat
* 重新下单
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function reOrder($data)
{

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序导购助手
@ -27,13 +29,12 @@ class Guide extends BasicWeChat
* 服务号添加导购
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addGuideAcct($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/addguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -41,13 +42,12 @@ class Guide extends BasicWeChat
* 服务号删除导购
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function delGuideAcct($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/delguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -55,26 +55,24 @@ class Guide extends BasicWeChat
* 服务号获取导购信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideAcct($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 获取服务号的敏感词信息与自动回复信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideAcctConfig()
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacctconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, [], true);
}
@ -83,13 +81,12 @@ class Guide extends BasicWeChat
* @param integer $page
* @param integer $num
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideAcctList($page = 0, $num = 10)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacctconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['page' => $page, 'num' => $num], true);
}
@ -97,13 +94,12 @@ class Guide extends BasicWeChat
* 获取导购聊天记录
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideBuyerChatRecord($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -111,13 +107,12 @@ class Guide extends BasicWeChat
* 获取导购快捷回复信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideConfig($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -125,26 +120,24 @@ class Guide extends BasicWeChat
* 生成导购二维码
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function guideCreateQrCode($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/guidecreateqrcode?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function pushShowWxaPathMenu($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/pushshowwxapathmenu?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -152,13 +145,12 @@ class Guide extends BasicWeChat
* 为服务号设置敏感词与自动回复
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function setGuideAcctConfig($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideacctconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -166,13 +158,12 @@ class Guide extends BasicWeChat
* 设置导购快捷回复信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function setGuideConfig($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -180,13 +171,12 @@ class Guide extends BasicWeChat
* 更新导购昵称或者头像
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function updateGuideAcct($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -194,13 +184,12 @@ class Guide extends BasicWeChat
* 添加展示标签信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addGuideBuyerDisplayTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidebuyerdisplaytag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -208,13 +197,12 @@ class Guide extends BasicWeChat
* 为粉丝添加可查询标签
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addGuideBuyerTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidebuyertag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -222,13 +210,12 @@ class Guide extends BasicWeChat
* 添加标签可选值
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addGuideTagOption($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidetagoption?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -237,13 +224,12 @@ class Guide extends BasicWeChat
* 删除粉丝标签
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function delGuideBuyerTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/delguidebuyertag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -251,13 +237,12 @@ class Guide extends BasicWeChat
* 查询展示标签信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideBuyerDisplayTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerdisplaytag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -265,26 +250,24 @@ class Guide extends BasicWeChat
* 查询粉丝标签
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideBuyerTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyertag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 查询标签可选值信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideTagOption()
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidetagoption?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, [], true);
}
@ -292,13 +275,12 @@ class Guide extends BasicWeChat
* 新建可查询标签类型,支持新建4类可查询标签
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function newGuideTagOption($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/newguidetagoption?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -306,8 +288,8 @@ class Guide extends BasicWeChat
* 根据标签值筛选粉丝
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function queryGuideBuyerByTag($data)
{
@ -320,8 +302,8 @@ class Guide extends BasicWeChat
* 为服务号导购添加粉丝
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addGuideBuyerRelation($data)
{
@ -334,8 +316,8 @@ class Guide extends BasicWeChat
* 删除导购的粉丝
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function delGuideBuyerRelation($data)
{
@ -348,8 +330,8 @@ class Guide extends BasicWeChat
* 查询某一个粉丝与导购的绑定关系
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideBuyerRelation($data)
{
@ -362,8 +344,8 @@ class Guide extends BasicWeChat
* 通过粉丝信息查询该粉丝与导购的绑定关系
* @param string $openid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideBuyerRelationByBuyer($openid)
{
@ -376,8 +358,8 @@ class Guide extends BasicWeChat
* 拉取导购的粉丝列表
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideBuyerRelationList($data)
{
@ -390,8 +372,8 @@ class Guide extends BasicWeChat
* 将粉丝从一个导购迁移到另外一个导购下
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function rebindGuideAcctForBuyer($data)
{
@ -404,8 +386,8 @@ class Guide extends BasicWeChat
* 更新粉丝昵称
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function updateGuideBuyerRelation($data)
{
@ -418,8 +400,8 @@ class Guide extends BasicWeChat
* 删除小程序卡片素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function delGuideCardMaterial($data)
{
@ -432,8 +414,8 @@ class Guide extends BasicWeChat
* 删除图片素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function delGuideImageMaterial($data)
{
@ -446,8 +428,8 @@ class Guide extends BasicWeChat
* 删除文字素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function delGuideWordMaterial($data)
{
@ -460,8 +442,8 @@ class Guide extends BasicWeChat
* 获取小程序卡片素材信息
* @param integer $type
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideCardMaterial($type = 0)
{
@ -476,8 +458,8 @@ class Guide extends BasicWeChat
* @param integer $start 分页查询,起始位置
* @param integer $num 分页查询,查询个数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideImageMaterial($type = 0, $start = 0, $num = 10)
{
@ -492,8 +474,8 @@ class Guide extends BasicWeChat
* @param integer $start 分页查询,起始位置
* @param integer $num 分页查询,查询个数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGuideWordMaterial($type = 0, $start = 0, $num = 10)
{
@ -506,8 +488,8 @@ class Guide extends BasicWeChat
* 添加小程序卡片素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function setGuideCardMaterial($data)
{
@ -520,8 +502,8 @@ class Guide extends BasicWeChat
* 添加图片素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function setGuideImageMaterial($data)
{
@ -534,8 +516,8 @@ class Guide extends BasicWeChat
* 为服务号添加文字素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function setGuideWordMaterial($data)
{

View File

@ -16,6 +16,7 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序图像处理
@ -31,12 +32,11 @@ class Image extends BasicWeChat
* @param string $img form-data 中媒体文件标识有filename、filelength、content-type等信息传这个则不用穿 img_url
* @return array
* @throws InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws LocalCacheException
*/
public function aiCrop($img_url, $img)
{
$url = "https://api.weixin.qq.com/cv/img/aicrop?access_token=ACCESS_TOCKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['img_url' => $img_url, 'img' => $img], true);
}
@ -46,12 +46,11 @@ class Image extends BasicWeChat
* @param string $img form-data 中媒体文件标识有filename、filelength、content-type等信息传这个则不用穿 img_url
* @return array
* @throws InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws LocalCacheException
*/
public function scanQRCode($img_url, $img)
{
$url = "https://api.weixin.qq.com/cv/img/qrcode?img_url=ENCODE_URL&access_token=ACCESS_TOCKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['img_url' => $img_url, 'img' => $img], true);
}
@ -61,12 +60,11 @@ class Image extends BasicWeChat
* @param string $img form-data 中媒体文件标识有filename、filelength、content-type等信息传这个则不用穿 img_url
* @return array
* @throws InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws LocalCacheException
*/
public function superresolution($img_url, $img)
{
$url = "https://api.weixin.qq.com/cv/img/qrcode?img_url=ENCODE_URL&access_token=ACCESS_TOCKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['img_url' => $img_url, 'img' => $img], true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序直播接口
@ -27,13 +29,12 @@ class Live extends BasicWeChat
* 创建直播间
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function create($data)
{
$url = 'https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -42,13 +43,12 @@ class Live extends BasicWeChat
* @param integer $start 起始拉取房间
* @param integer $limit 每次拉取的个数上限
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getLiveList($start = 0, $limit = 10)
{
$url = 'https://api.weixin.qq.com/wxa/business/getliveinfo?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['start' => $start, 'limit' => $limit], true);
}
@ -56,13 +56,12 @@ class Live extends BasicWeChat
* 获取回放源视频
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getLiveInfo($data = [])
{
$url = 'https://api.weixin.qq.com/wxa/business/getliveinfo?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -70,13 +69,12 @@ class Live extends BasicWeChat
* 直播间导入商品
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addLiveGoods($data = [])
{
$url = 'https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -84,13 +82,12 @@ class Live extends BasicWeChat
* 商品添加并提审
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addGoods($data)
{
$url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/add?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -98,13 +95,12 @@ class Live extends BasicWeChat
* 商品撤回审核
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function resetAuditGoods($data)
{
$url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/resetaudit?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -112,13 +108,12 @@ class Live extends BasicWeChat
* 重新提交审核
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function auditGoods($data)
{
$url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/audit?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -126,13 +121,12 @@ class Live extends BasicWeChat
* 删除商品
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function deleteGoods($data)
{
$url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -140,13 +134,12 @@ class Live extends BasicWeChat
* 更新商品
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function updateGoods($data)
{
$url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/update?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -154,8 +147,8 @@ class Live extends BasicWeChat
* 获取商品状态
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function stateGoods($data)
{
@ -168,8 +161,8 @@ class Live extends BasicWeChat
* 获取商品列表
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getGoods($data)
{

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序物流助手
@ -27,13 +29,12 @@ class Logistics extends BasicWeChat
* 生成运单
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addOrder($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/order/add?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -41,26 +42,24 @@ class Logistics extends BasicWeChat
* 取消运单
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function cancelOrder($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/order/cancel?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 获取支持的快递公司列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getAllDelivery()
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/delivery/getall?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callGetApi($url);
}
@ -68,13 +67,12 @@ class Logistics extends BasicWeChat
* 获取运单数据
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getOrder($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/order/get?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -82,26 +80,24 @@ class Logistics extends BasicWeChat
* 查询运单轨迹
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getPath($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 获取打印员。若需要使用微信打单 PC 软件,才需要调用
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getPrinter()
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/printer/getall?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callGetApi($url);
}
@ -109,13 +105,12 @@ class Logistics extends BasicWeChat
* 获取电子面单余额。仅在使用加盟类快递公司时,才可以调用
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getQuota($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -123,13 +118,12 @@ class Logistics extends BasicWeChat
* 模拟快递公司更新订单状态, 该接口只能用户测试
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function testUpdateOrder($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/test_update_order?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -137,13 +131,12 @@ class Logistics extends BasicWeChat
* 配置面单打印员,若需要使用微信打单 PC 软件,才需要调用
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function updatePrinter($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/printer/update?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -151,13 +144,12 @@ class Logistics extends BasicWeChat
* 获取面单联系人信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getContact($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/contact/get?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -165,13 +157,12 @@ class Logistics extends BasicWeChat
* 预览面单模板。用于调试面单模板使用
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function previewTemplate($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/template/preview?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -179,13 +170,12 @@ class Logistics extends BasicWeChat
* 更新商户审核结果
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function updateBusiness($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/service/business/update?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -193,14 +183,12 @@ class Logistics extends BasicWeChat
* 更新运单轨迹
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function updatePath($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/path/update?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序动态消息
@ -27,13 +29,12 @@ class Message extends BasicWeChat
* 动态消息,创建被分享动态消息的 activity_id
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function createActivityId($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/activityid/create?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -41,13 +42,12 @@ class Message extends BasicWeChat
* 动态消息,修改被分享的动态消息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function setUpdatableMsg($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/updatablemsg/send?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -55,13 +55,12 @@ class Message extends BasicWeChat
* 下发小程序和公众号统一的服务消息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function uniformSend($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 公众号小程序订阅消息支持
@ -27,39 +29,36 @@ class Newtmpl extends BasicWeChat
* 获取小程序账号的类目
* @param array $data 类目信息列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addCategory($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/addcategory?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 获取小程序账号的类目
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getCategory()
{
$url = 'https://api.weixin.qq.com/wxaapi/newtmpl/getcategory?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callGetApi($url);
}
/**
* 获取小程序账号的类目
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function deleteCategory()
{
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/deletecategory?access_token=TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, [], true);
}
@ -67,14 +66,13 @@ class Newtmpl extends BasicWeChat
* 获取帐号所属类目下的公共模板标题
* @param string $ids 类目 id多个用逗号隔开
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getPubTemplateTitleList($ids)
{
$url = 'https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=ACCESS_TOKEN';
$url .= '&' . http_build_query(['ids' => $ids, 'start' => '0', 'limit' => '30']);
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callGetApi($url);
}
@ -82,14 +80,13 @@ class Newtmpl extends BasicWeChat
* 获取模板标题下的关键词列表
* @param string $tid 模板标题 id可通过接口获取
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getPubTemplateKeyWordsById($tid)
{
$url = 'https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords?access_token=ACCESS_TOKEN';
$url .= '&' . http_build_query(['tid' => $tid]);
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callGetApi($url);
}
@ -99,26 +96,24 @@ class Newtmpl extends BasicWeChat
* @param array $kidList 开发者自行组合好的模板关键词列表,关键词顺序可以自由搭配(例如 [3,5,4] [4,5,3]最多支持5个最少2个关键词组合
* @param string $sceneDesc 服务场景描述15个字以内
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addTemplate($tid, array $kidList, $sceneDesc = '')
{
$url = 'https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['tid' => $tid, 'kidList' => $kidList, 'sceneDesc' => $sceneDesc], false);
}
/**
* 获取当前帐号下的个人模板列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getTemplateList()
{
$url = 'https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callGetApi($url);
}
@ -126,13 +121,12 @@ class Newtmpl extends BasicWeChat
* 删除帐号下的个人模板
* @param string $priTmplId 要删除的模板id
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function delTemplate($priTmplId)
{
$url = 'https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['priTmplId' => $priTmplId], true);
}
@ -140,14 +134,12 @@ class Newtmpl extends BasicWeChat
* 发送订阅消息
* @param array $data 发送的消息对象数组
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function send(array $data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序ORC服务
@ -27,13 +29,12 @@ class Ocr extends BasicWeChat
* 本接口提供基于小程序的银行卡 OCR 识别
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function bankcard($data)
{
$url = 'https://api.weixin.qq.com/cv/ocr/bankcard?access_token=ACCESS_TOCKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -41,13 +42,12 @@ class Ocr extends BasicWeChat
* 本接口提供基于小程序的营业执照 OCR 识别
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function businessLicense($data)
{
$url = 'https://api.weixin.qq.com/cv/ocr/bizlicense?access_token=ACCESS_TOCKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -55,13 +55,12 @@ class Ocr extends BasicWeChat
* 本接口提供基于小程序的驾驶证 OCR 识别
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function driverLicense($data)
{
$url = 'https://api.weixin.qq.com/cv/ocr/drivinglicense?access_token=ACCESS_TOCKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -69,13 +68,12 @@ class Ocr extends BasicWeChat
* 本接口提供基于小程序的身份证 OCR 识别
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function idcard($data)
{
$url = 'https://api.weixin.qq.com/cv/ocr/idcard?access_token=ACCESS_TOCKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -83,13 +81,12 @@ class Ocr extends BasicWeChat
* 本接口提供基于小程序的通用印刷体 OCR 识别
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function printedText($data)
{
$url = 'https://api.weixin.qq.com/cv/ocr/comm?access_token=ACCESS_TOCKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -97,14 +94,12 @@ class Ocr extends BasicWeChat
* 本接口提供基于小程序的行驶证 OCR 识别
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function vehicleLicense($data)
{
$url = 'https://api.weixin.qq.com/cv/ocr/driving?access_token=ACCESS_TOCKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序运维中心
@ -28,14 +30,12 @@ class Operation extends BasicWeChat
* 实时日志查询
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function realtimelogSearch($data)
{
$url = 'https://api.weixin.qq.com/wxaapi/userlog/userlog_search?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 微信小程序插件管理
@ -27,26 +29,24 @@ class Plugs extends BasicWeChat
* 1.申请使用插件
* @param string $plugin_appid 插件appid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function apply($plugin_appid)
{
$url = 'https://api.weixin.qq.com/wxa/plugin?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['action' => 'apply', 'plugin_appid' => $plugin_appid], true);
}
/**
* 2.查询已添加的插件
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getList()
{
$url = 'https://api.weixin.qq.com/wxa/plugin?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['action' => 'list'], true);
}
@ -54,13 +54,12 @@ class Plugs extends BasicWeChat
* 3.删除已添加的插件
* @param string $plugin_appid 插件appid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function unbind($plugin_appid)
{
$url = 'https://api.weixin.qq.com/wxa/plugin?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['action' => 'unbind', 'plugin_appid' => $plugin_appid], true);
}
@ -69,13 +68,12 @@ class Plugs extends BasicWeChat
* 修改插件使用申请的状态
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function devplugin($data)
{
$url = 'https://api.weixin.qq.com/wxa/devplugin?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -84,13 +82,12 @@ class Plugs extends BasicWeChat
* @param integer $page 拉取第page页的数据
* @param integer $num 表示每页num条记录
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function devApplyList($page = 1, $num = 10)
{
$url = 'https://api.weixin.qq.com/wxa/plugin?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
$data = ['action' => 'dev_apply_list', 'page' => $page, 'num' => $num];
return $this->callPostApi($url, $data, true);
}
@ -99,14 +96,12 @@ class Plugs extends BasicWeChat
* 5.修改插件使用申请的状态(供插件开发者调用)
* @param string $action dev_agree同意申请dev_refuse拒绝申请dev_delete删除已拒绝的申请者
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function devAgree($action = 'dev_agree')
{
$url = 'https://api.weixin.qq.com/wxa/plugin?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['action' => $action], true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 微信小程序地址管理
@ -30,13 +32,12 @@ class Poi extends BasicWeChat
* @param string $related_address 经营资质地址
* @param string $related_proof_material 相关证明材料照片临时素材mediaid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addBearByPoi($related_name, $related_credential, $related_address, $related_proof_material)
{
$url = 'https://api.weixin.qq.com/wxa/addnearbypoi?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
$data = [
'related_name' => $related_name, 'related_credential' => $related_credential,
'related_address' => $related_address, 'related_proof_material' => $related_proof_material,
@ -49,13 +50,12 @@ class Poi extends BasicWeChat
* @param integer $page 起始页id从1开始计数
* @param integer $page_rows 每页展示个数最多1000个
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getNearByPoiList($page = 1, $page_rows = 1000)
{
$url = "https://api.weixin.qq.com/wxa/getnearbypoilist?page={$page}&page_rows={$page_rows}&access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callGetApi($url);
}
@ -63,13 +63,12 @@ class Poi extends BasicWeChat
* 删除地点
* @param string $poi_id 附近地点ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function delNearByPoiList($poi_id)
{
$url = "https://api.weixin.qq.com/wxa/delnearbypoi?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['poi_id' => $poi_id], true);
}
@ -78,14 +77,12 @@ class Poi extends BasicWeChat
* @param string $poi_id 附近地点ID
* @param string $status 0取消展示1展示
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function setNearByPoiShowStatus($poi_id, $status)
{
$url = "https://api.weixin.qq.com/wxa/setnearbypoishowstatus?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['poi_id' => $poi_id, 'status' => $status], true);
}
}

View File

@ -16,6 +16,8 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Contracts\Tools;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 微信小程序二维码管理
@ -35,8 +37,8 @@ class Qrcode extends BasicWeChat
* @param boolean $is_hyaline 是否需要透明底色
* @param null|string $outType 输出类型
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function createMiniPath($path, $width = 430, $auto_color = false, $line_color = ["r" => "0", "g" => "0", "b" => "0"], $is_hyaline = true, $outType = null)
{
@ -65,8 +67,8 @@ class Qrcode extends BasicWeChat
* @param boolean $is_hyaline 是否需要透明底色
* @param null|string $outType 输出类型
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function createMiniScene($scene, $page, $width = 430, $auto_color = false, $line_color = ["r" => "0", "g" => "0", "b" => "0"], $is_hyaline = true, $outType = null)
{
@ -91,8 +93,8 @@ class Qrcode extends BasicWeChat
* @param integer $width 二维码的宽度
* @param null|string $outType 输出类型
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function createDefault($path, $width = 430, $outType = null)
{
@ -108,5 +110,4 @@ class Qrcode extends BasicWeChat
}
return is_null($outType) ? $result : $outType($result);
}
}

View File

@ -3,6 +3,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序 URL-Scheme
@ -16,13 +18,12 @@ class Scheme extends BasicWeChat
* 创建 URL-Scheme
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function create($data)
{
$url = 'https://api.weixin.qq.com/wxa/generatescheme?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -30,13 +31,12 @@ class Scheme extends BasicWeChat
* 查询 URL-Scheme
* @param string $scheme
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function query($scheme)
{
$url = 'https://api.weixin.qq.com/wxa/queryscheme?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['scheme' => $scheme], true);
}
@ -44,13 +44,12 @@ class Scheme extends BasicWeChat
* 创建 URL-Link
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function urlLink($data)
{
$url = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=ACCESS_TOKEN";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
@ -58,13 +57,12 @@ class Scheme extends BasicWeChat
* 查询 URL-Link
* @param string $urllink
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function urlQuery($urllink)
{
$url = 'https://api.weixin.qq.com/wxa/query_urllink?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['url_link' => $urllink], true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序搜索
@ -27,14 +29,12 @@ class Search extends BasicWeChat
* 提交小程序页面url及参数信息
* @param array $pages
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function submitPages($pages)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['pages' => $pages], true);
}
}

View File

@ -16,6 +16,7 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序内容安全
@ -29,13 +30,12 @@ class Security extends BasicWeChat
* 校验一张图片是否含有违法违规内容
* @param string $media 要检测的图片文件格式支持PNG、JPEG、JPG、GIF图片尺寸不超过 750px x 1334px
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function imgSecCheck($media)
{
$url = 'https://api.weixin.qq.com/wxa/img_sec_check?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['media' => $media], false);
}
@ -45,12 +45,11 @@ class Security extends BasicWeChat
* @param string $media_type
* @return array
* @throws InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws LocalCacheException
*/
public function mediaCheckAsync($media_url, $media_type)
{
$url = 'https://api.weixin.qq.com/wxa/media_check_async?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['media_url' => $media_url, 'media_type' => $media_type], true);
}
@ -59,12 +58,11 @@ class Security extends BasicWeChat
* @param string $content
* @return array
* @throws InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws LocalCacheException
*/
public function msgSecCheck($content)
{
$url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['content' => $content], true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 小程序生物认证
@ -27,14 +29,12 @@ class Soter extends BasicWeChat
* SOTER 生物认证秘钥签名验证
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function verifySignature($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/soter/verify_signature?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 公众号小程序模板消息支持
@ -27,13 +29,12 @@ class Template extends BasicWeChat
/**
* 获取小程序模板库标题列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getTemplateLibraryList()
{
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/template/library/list?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['offset' => '0', 'count' => '20'], true);
}
@ -41,13 +42,12 @@ class Template extends BasicWeChat
* 获取模板库某个模板标题下关键词库
* @param string $template_id 模板标题id可通过接口获取也可登录小程序后台查看获取
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getTemplateLibrary($template_id)
{
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/template/library/get?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['id' => $template_id], true);
}
@ -56,26 +56,24 @@ class Template extends BasicWeChat
* @param string $template_id 模板标题id可通过接口获取也可登录小程序后台查看获取
* @param array $keyword_id_list 开发者自行组合好的模板关键词列表,关键词顺序可以自由搭配(例如[3,5,4][4,5,3]最多支持10个关键词组合
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function addTemplate($template_id, array $keyword_id_list)
{
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/template/add?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['id' => $template_id, 'keyword_id_list' => $keyword_id_list], true);
}
/**
* 获取帐号下已存在的模板列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getTemplateList()
{
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/template/list?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['offset' => '0', 'count' => '20'], true);
}
@ -83,13 +81,12 @@ class Template extends BasicWeChat
* 删除模板消息
* @param string $template_id 要删除的模板id
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function delTemplate($template_id)
{
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/template/del?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['template_id' => $template_id], true);
}
@ -97,14 +94,12 @@ class Template extends BasicWeChat
* 发送模板消息
* @param array $data 发送的消息对象数组
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function send(array $data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -15,6 +15,8 @@
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
use WeChat\Exceptions\InvalidResponseException;
use WeChat\Exceptions\LocalCacheException;
/**
* 微信小程序数据接口
@ -28,13 +30,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期
* @param string $end_date 结束日期限定查询1天数据end_date允许设置的最大值为昨日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidDailySummarytrend($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappiddailysummarytrend?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
@ -43,13 +44,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期
* @param string $end_date 结束日期限定查询1天数据end_date允许设置的最大值为昨日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidDailyVisittrend($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
@ -58,13 +58,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期,为周一日期
* @param string $end_date 结束日期,为周日日期,限定查询一周数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidWeeklyVisittrend($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappidweeklyvisittrend?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
@ -73,13 +72,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期,为自然月第一天
* @param string $end_date 结束日期,为自然月最后一天,限定查询一个月数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidMonthlyVisittrend($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyvisittrend?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
@ -88,13 +86,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期
* @param string $end_date 结束日期限定查询1天数据end_date允许设置的最大值为昨日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidVisitdistribution($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappidvisitdistribution?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
@ -103,13 +100,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期
* @param string $end_date 结束日期限定查询1天数据end_date允许设置的最大值为昨日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidDailyRetaininfo($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappiddailyretaininfo?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
@ -118,13 +114,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期,为周一日期
* @param string $end_date 结束日期,为周日日期,限定查询一周数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidWeeklyRetaininfo($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappidweeklyretaininfo?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
@ -133,13 +128,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期,为自然月第一天
* @param string $end_date 结束日期,为自然月最后一天,限定查询一个月数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidMonthlyRetaininfo($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyretaininfo?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
@ -148,13 +142,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期
* @param string $end_date 结束日期限定查询1天数据end_date允许设置的最大值为昨日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidVisitPage($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappidvisitpage?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
@ -163,14 +156,12 @@ class Total extends BasicWeChat
* @param string $begin_date 开始日期
* @param string $end_date 结束日期开始日期与结束日期相差的天数限定为0/6/29分别表示查询最近1/7/30天数据end_date允许设置的最大值为昨日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws InvalidResponseException
* @throws LocalCacheException
*/
public function getWeanalysisAppidUserportrait($begin_date, $end_date)
{
$url = 'https://api.weixin.qq.com/datacube/getweanalysisappiduserportrait?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
}
}

View File

@ -33,24 +33,24 @@ class WXBizDataCrypt
public function decryptData($encryptedData, $iv, &$data)
{
if (strlen($this->sessionKey) != 24) {
return \ErrorCode::$IllegalAesKey;
return ErrorCode::$IllegalAesKey;
}
$aesKey = base64_decode($this->sessionKey);
if (strlen($iv) != 24) {
return \ErrorCode::$IllegalIv;
return ErrorCode::$IllegalIv;
}
$aesIV = base64_decode($iv);
$aesCipher = base64_decode($encryptedData);
$result = openssl_decrypt($aesCipher, "AES-128-CBC", $aesKey, 1, $aesIV);
$dataObj = json_decode($result);
if ($dataObj == null) {
return \ErrorCode::$IllegalBuffer;
return ErrorCode::$IllegalBuffer;
}
if ($dataObj->watermark->appid != $this->appid) {
return \ErrorCode::$IllegalBuffer;
return ErrorCode::$IllegalBuffer;
}
$data = $result;
return \ErrorCode::$OK;
return ErrorCode::$OK;
}
}