Compare commits

..

7 Commits

Author SHA1 Message Date
Anyon
5aff97be52 fix: Add PHP version guard for OpenSSL key cleanup 2026-03-07 09:46:36 +08:00
Anyon
cc5fc5569d fix: 更新小程序Custom接口 2026-01-28 13:28:20 +08:00
Anyon
550c2def40 fix: 增加参数检测及处理 2025-12-12 09:33:53 +08:00
Anyon
d923c00feb fix: 修改代码注释 2025-12-12 09:29:31 +08:00
Anyon
780e1fcedb fix: 修复一处判断逻辑问题 2025-12-12 09:24:45 +08:00
Anyon
f27a6c7b1d fix: 修改php代码兼容5.4 2025-12-12 09:24:30 +08:00
Anyon
955cb28427 fix: 批量更新代码,同时增加通用接口调用 2025-12-11 16:23:29 +08:00
137 changed files with 3949 additions and 2466 deletions

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,15 +20,14 @@ use WeChat\Contracts\BasicAliPay;
/**
* 支付宝App支付网关
* Class App
* @package AliPay
*/
class App extends BasicAliPay
{
/**
* App constructor.
* @param array $options
* 构造函数
* @param array $options 支付宝配置参数
*/
public function __construct(array $options)
{
@ -38,9 +37,9 @@ class App extends BasicAliPay
}
/**
* 创建数据操作
* @param array $options
* @return string
* 生成APP支付参数字符串
* @param array $options 订单参数out_trade_no, total_amount, subject等
* @return string URL编码后的参数字符串用于APP调起支付
*/
public function apply($options)
{

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicAliPay;
/**
* 支付宝电子面单下载
* Class Bill
* @package AliPay
*/
class Bill extends BasicAliPay
{
/**
* Bill constructor.
* @param array $options
* 构造函数
* @param array $options 支付宝配置参数
*/
public function __construct(array $options)
{
@ -36,9 +35,9 @@ class Bill extends BasicAliPay
}
/**
* 创建数据操作
* @param array $options
* @return array|bool
* 获取账单下载地址
* @param array $options 账单参数bill_type, bill_date 等)
* @return array 包含 bill_download_url 的响应数据
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicAliPay;
/**
* 支付宝刷卡支付
* Class Pos
* @package AliPay
*/
class Pos extends BasicAliPay
{
/**
* Pos constructor.
* @param array $options
* 构造函数
* @param array $options 支付宝配置参数
*/
public function __construct(array $options)
{
@ -37,9 +36,9 @@ class Pos extends BasicAliPay
}
/**
* 创建数据操作
* @param array $options
* @return array|bool
* 刷卡支付(条码/声波)下单
* @param array $options 订单参数out_trade_no, auth_code, subject, total_amount 等)
* @return array 支付结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicAliPay;
/**
* 支付宝扫码支付
* Class Scan
* @package AliPay
*/
class Scan extends BasicAliPay
{
/**
* Scan constructor.
* @param array $options
* 构造函数
* @param array $options 支付宝配置参数
*/
public function __construct(array $options)
{
@ -36,9 +35,9 @@ class Scan extends BasicAliPay
}
/**
* 创建数据操作
* @param array $options
* @return array|bool
* 预创建扫码支付订单(返回二维码地址)
* @param array $options 订单参数out_trade_no, subject, total_amount 等)
* @return array 包含 qr_code 的预下单结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,15 +20,14 @@ use WeChat\Contracts\BasicAliPay;
/**
* 支付宝标准接口
* Class Trade
* @package AliPay
*/
class Trade extends BasicAliPay
{
/**
* 设置交易接口地址
* @param string $method
* 设置交易接口方法名
* @param string $method alipay.trade.close
* @return $this
*/
public function setMethod($method)
@ -38,7 +37,7 @@ class Trade extends BasicAliPay
}
/**
* 获取交易接口地址
* 获取当前交易接口方法名
* @return string
*/
public function getMethod()
@ -47,8 +46,8 @@ class Trade extends BasicAliPay
}
/**
* 设置接口公共参数
* @param array $option
* 设置公共参数(透传到 options
* @param array $option key-value 公共参数
* @return Trade
*/
public function setOption($option = [])
@ -60,7 +59,7 @@ class Trade extends BasicAliPay
}
/**
* 获取接口公共参数
* 获取当前公共参数
* @return array|string|null
*/
public function getOption()
@ -69,9 +68,9 @@ class Trade extends BasicAliPay
}
/**
* 执行通过接口
* @param array $options
* @return array|boolean
* 执行当前设置的交易接口
* @param array $options 业务参数(写入 biz_content
* @return array 接口返回结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,16 +20,15 @@ use WeChat\Contracts\BasicAliPay;
/**
* 支付宝转账到账户
* Class Transfer
* @package AliPay
*/
class Transfer extends BasicAliPay
{
/**
* 旧版 向指定支付宝账户转账
* @param array $options
* @return array|bool
* 旧版向支付宝账户转账toaccount.transfer
* @param array $options 转账参数out_biz_no, payee_type, payee_account, amount, remark 等)
* @return array 转账结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -40,9 +39,9 @@ class Transfer extends BasicAliPay
}
/**
* 新版 向指定支付宝账户转账
* @param array $options
* @return array|bool
* 新版统一转账接口uni.transfer
* @param array $options 转账参数out_biz_no, trans_amount, product_code, payee_info 等)
* @return array 转账结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -53,9 +52,9 @@ class Transfer extends BasicAliPay
}
/**
* 新版 转账业务单据查询接口
* @param array $options
* @return array|bool
* 新版:转账业务单据查询
* @param array $options 查询参数out_biz_no order_id
* @return array 查询结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -66,9 +65,9 @@ class Transfer extends BasicAliPay
}
/**
* 新版 支付宝资金账户资产查询接口
* @param array $options
* @return array|bool
* 新版:资金账户余额查询
* @param array $options 查询参数alipay_user_id user_id可选 account_type
* @return array 账户余额等信息
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicAliPay;
/**
* 手机WAP网站支付支持
* Class Wap
* @package AliPay
*/
class Wap extends BasicAliPay
{
/**
* Wap constructor.
* @param array $options
* 构造函数
* @param array $options 支付宝配置参数
*/
public function __construct(array $options)
{
@ -37,9 +36,9 @@ class Wap extends BasicAliPay
}
/**
* 创建数据操作
* @param array $options
* @return string
* 生成 WAP 支付表单 HTML
* @param array $options 订单参数out_trade_no, total_amount, subject, quit_url, return_url 等)
* @return string 自动提交的支付表单 HTML
*/
public function apply($options)
{

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicAliPay;
/**
* 支付宝网站支付
* Class Web
* @package AliPay
*/
class Web extends BasicAliPay
{
/**
* Web constructor.
* @param array $options
* 构造函数
* @param array $options 支付宝配置参数
*/
public function __construct(array $options)
{
@ -37,9 +36,9 @@ class Web extends BasicAliPay
}
/**
* 创建数据操作
* @param array $options
* @return string
* 生成网站支付表单HTML
* @param array $options 订单参数out_trade_no, total_amount, subject等
* @return string 支付表单HTML自动提交到支付宝
*/
public function apply($options)
{

5
We.php
View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,7 +20,6 @@ use WeChat\Exceptions\InvalidInstanceException;
/**
* 加载缓存器
*
* Class We
* @library WeChatDeveloper
* @author Anyon<zoujingli@qq.com>
* @date 2018/05/24 13:23
@ -59,7 +58,7 @@ use WeChat\Exceptions\InvalidInstanceException;
* ----- WeMini -----
* @method \WeMini\Crypt WeMiniCrypt($options = []) static 小程序数据加密处理
* @method \WeMini\Delivery WeMiniDelivery($options = []) static 小程序即时配送
* @method \WeMini\Shipping WeMiniShipping($options = []) satic 小程序发货信息
* @method \WeMini\Shipping WeMiniShipping($options = []) static 小程序发货信息
* @method \WeMini\Guide WeMiniGuide($options = []) static 小程序导购助手
* @method \WeMini\Image WeMiniImage($options = []) static 小程序图像处理
* @method \WeMini\Live WeMiniLive($options = []) static 小程序直播接口

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 卡券管理
* Class Card
* @package WeChat
*/
class Card extends BasicWeChat
{
/**
* 创建卡券
* @param array $data
* @param array $data 卡券数据card 对象)
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -39,9 +38,9 @@ class Card extends BasicWeChat
}
/**
* 设置买单接口
* @param string $cardId
* @param bool $isOpen
* 设置买单开关
* @param string $cardId 卡券ID
* @param bool $isOpen 是否开启
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -53,9 +52,9 @@ class Card extends BasicWeChat
}
/**
* 设置自助核销接口
* @param string $cardId
* @param bool $isOpen
* 设置自助核销
* @param string $cardId 卡券ID
* @param bool $isOpen 是否开启
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -67,8 +66,8 @@ class Card extends BasicWeChat
}
/**
* 创建二维码接口
* @param array $data
* 创建卡券二维码
* @param array $data 二维码参数action_name, card 等)
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -80,8 +79,8 @@ class Card extends BasicWeChat
}
/**
* 创建货架接口
* @param array $data
* 创建卡券货架
* @param array $data 货架参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -93,9 +92,9 @@ class Card extends BasicWeChat
}
/**
* 导入自定义code
* @param string $cardId
* @param array $code
* 导入自定义 code
* @param string $cardId 卡券ID
* @param array $code code 列表最多10万
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -107,8 +106,8 @@ class Card extends BasicWeChat
}
/**
* 查询导入code数目
* @param string $cardId
* 查询已导入 code 数量
* @param string $cardId 卡券ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -120,9 +119,9 @@ class Card extends BasicWeChat
}
/**
* 核查code接口
* @param string $cardId 进行导入code的卡券ID
* @param array $code 已经微信卡券后台的自定义code上限为100个
* 校验导入的 code
* @param string $cardId 卡券ID
* @param array $code 自定义 code 列表(<=100
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -134,8 +133,8 @@ class Card extends BasicWeChat
}
/**
* 图文消息群发卡券
* @param string $cardId
* 获取图文群发卡券HTML
* @param string $cardId 卡券ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -148,8 +147,8 @@ class Card extends BasicWeChat
/**
* 设置测试白名单
* @param array $openids
* @param array $usernames
* @param array $openids 测试 openid 列表
* @param array $usernames 测试微信号列表
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -161,10 +160,10 @@ class Card extends BasicWeChat
}
/**
* 线下核销查询Code
* @param string $code 单张卡券的唯一标准
* @param string $cardId 卡券ID代表一类卡券。自定义code卡券必填
* @param bool $checkConsume 是否校验code核销状态填入true和false时的code异常状态返回数据不同
* 查询 Code 状态
* @param string $code 卡券 code
* @param string $cardId 卡券ID(自定义 code 必填)
* @param bool $checkConsume 是否校验核销状态
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -179,9 +178,9 @@ class Card extends BasicWeChat
}
/**
* 线下核销核销Code
* @param string $code 需核销的Code码
* @param null $card_id 券ID。创建卡券时use_custom_code填写true时必填。非自定义Code不必填写
* 核销 Code
* @param string $code 待核销的 code
* @param null|string $card_id 卡券ID自定义 code 必填)
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -195,8 +194,8 @@ class Card extends BasicWeChat
}
/**
* Code解码接口
* @param string $encryptCode
* 解码加密 Code
* @param string $encryptCode 加密 code
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -208,9 +207,9 @@ class Card extends BasicWeChat
}
/**
* 获取用户已领取卡券接口
* @param string $openid
* @param null|string $cardId
* 获取用户已领取卡券
* @param string $openid 用户 openid
* @param null|string $cardId 卡券ID可选
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -225,7 +224,7 @@ class Card extends BasicWeChat
/**
* 查看卡券详情
* @param string $cardId
* @param string $cardId 卡券ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -237,10 +236,10 @@ class Card extends BasicWeChat
}
/**
* 批量查询卡券列表
* @param int $offset 查询卡列表的起始偏移量从0开始即offset: 5是指从从列表里的第六个开始读取
* @param int $count 需要查询的卡片的数量数量最大50
* @param array $statusList 支持开发者拉出指定状态的卡券列表
* 批量查询卡券
* @param int $offset 起始偏移量
* @param int $count 拉取数量(<=50
* @param array $statusList 状态过滤
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -254,9 +253,9 @@ class Card extends BasicWeChat
}
/**
* 改卡券信息接口
* @param string $cardId
* @param array $memberCard
* 新会员卡信息
* @param string $cardId 卡券ID
* @param array $memberCard 会员卡内容
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -268,10 +267,10 @@ class Card extends BasicWeChat
}
/**
* 修改库存接口
* 修改库存
* @param string $card_id 卡券ID
* @param null|integer $increase_stock_value 增加多少库存支持不填或填0
* @param null|integer $reduce_stock_value 减少多少库存可以不填或填0
* @param int|null $increase_stock_value 增加库存
* @param int|null $reduce_stock_value 减少库存
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -286,9 +285,9 @@ class Card extends BasicWeChat
}
/**
* 更改Code接口
* @param string $code 需变更的Code码
* @param string $new_code 变更后的有效Code码
* 变更 Code
* @param string $code code
* @param string $new_code code
* @param null|string $card_id 卡券ID
* @return array
* @throws Exceptions\InvalidResponseException
@ -303,8 +302,8 @@ class Card extends BasicWeChat
}
/**
* 删除卡券接口
* @param string $cardId
* 删除卡券
* @param string $cardId 卡券ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -316,10 +315,10 @@ class Card extends BasicWeChat
}
/**
* 设置卡券失效接口
* @param string $code
* @param string $cardId
* @param null|string $reason
* 设置卡券失效
* @param string $code 卡券 code
* @param string $cardId 卡券ID
* @param null|string $reason 失效原因
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -333,10 +332,10 @@ class Card extends BasicWeChat
}
/**
* 拉取卡券概况数据接口
* @param string $beginDate 查询数据的起始时间
* @param string $endDate 查询数据的截至时间
* @param string $condSource 卡券来源(0为公众平台创建的卡券数据 1是API创建的卡券数据)
* 拉取卡券概况数据
* @param string $beginDate 开始日期
* @param string $endDate 结束日期
* @param string $condSource 卡券来源 0|1
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -349,11 +348,11 @@ class Card extends BasicWeChat
}
/**
* 获取免费券数据接口
* @param string $beginDate 查询数据的起始时间
* @param string $endDate 查询数据的截至时间
* @param integer $condSource 卡券来源0为公众平台创建的卡券数据、1是API创建的卡券数据
* @param null $cardId 卡券ID
* 获取免费券数据
* @param string $beginDate 开始日期
* @param string $endDate 结束日期
* @param int $condSource 卡券来源 0|1
* @param null|string $cardId 卡券ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -369,7 +368,7 @@ class Card extends BasicWeChat
/**
* 激活会员卡
* @param array $data
* @param array $data 激活参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -381,9 +380,8 @@ class Card extends BasicWeChat
}
/**
* 设置开卡字段接口
* 用户激活时需要填写的选项
* @param array $data
* 设置开卡字段(激活表单)
* @param array $data 表单字段
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -395,9 +393,8 @@ class Card extends BasicWeChat
}
/**
* 获取用户提交资料
* 根据activate_ticket获取到用户填写的信息
* @param string $activateTicket
* 获取用户提交的激活资料
* @param string $activateTicket 激活 ticket
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -410,7 +407,7 @@ class Card extends BasicWeChat
/**
* 更新会员信息
* @param array $data
* @param array $data 更新参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -422,10 +419,10 @@ class Card extends BasicWeChat
}
/**
* 拉取会员卡概况数据接口
* @param string $beginDate 查询数据的起始时间
* @param string $endDate 查询数据的截至时间
* @param string $condSource 卡券来源(0为公众平台创建的卡券数据 1是API创建的卡券数据)
* 拉取会员卡概况数据
* @param string $beginDate 开始日期
* @param string $endDate 结束日期
* @param string $condSource 卡券来源 0|1
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -438,10 +435,10 @@ class Card extends BasicWeChat
}
/**
* 拉取单张会员卡数据接口
* @param string $beginDate 查询数据的起始时间
* @param string $endDate 查询数据的截至时间
* @param string $cardId 卡券id
* 拉取单张会员卡数据
* @param string $beginDate 开始日期
* @param string $endDate 结束日期
* @param string $cardId 卡券ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -454,9 +451,9 @@ class Card extends BasicWeChat
}
/**
* 拉取会员信息(积分查询)接口
* @param string $cardId 查询会员卡的cardid
* @param string $code 所查询用户领取到的code值
* 查询会员信息(积分)
* @param string $cardId 会员卡ID
* @param string $code 用户 code
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -469,8 +466,8 @@ class Card extends BasicWeChat
}
/**
* 设置支付后投放卡券接口
* @param array $data
* 支付后投放卡券规则
* @param array $data 规则参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -483,7 +480,7 @@ class Card extends BasicWeChat
/**
* 删除支付后投放卡券规则
* @param integer $ruleId 支付即会员的规则名称
* @param int $ruleId 规则ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -495,8 +492,8 @@ class Card extends BasicWeChat
}
/**
* 查询支付后投放卡券规则详情
* @param integer $ruleId 要查询规则id
* 查询支付后投放卡券规则
* @param int $ruleId 规则ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -508,10 +505,10 @@ class Card extends BasicWeChat
}
/**
* 批量查询支付后投放卡券规则
* @param integer $offset 起始偏移
* @param integer $count 查询的数量
* @param bool $effective 是否仅查询生效规则
* 批量查询支付后投放规则
* @param int $offset 起始偏移
* @param int $count 数量
* @param bool $effective 是否仅查询生效规则
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -524,8 +521,8 @@ class Card extends BasicWeChat
}
/**
* 创建支付后领取立减金活动
* @param array $data
* 创建支付后立减金活动
* @param array $data 活动参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -537,7 +534,7 @@ class Card extends BasicWeChat
}
/**
* 开通券点账户接口
* 开通券点账户
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -549,9 +546,9 @@ class Card extends BasicWeChat
}
/**
* 对优惠券批价
* @param string $cardId 需要来配置库存的card_id
* @param integer $quantity 本次需要兑换的库存数目
* 预估优惠券库存价格
* @param string $cardId 卡券ID
* @param int $quantity 兑换数量
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -563,7 +560,7 @@ class Card extends BasicWeChat
}
/**
* 查询券点余额接口
* 查询券点余额
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -575,10 +572,10 @@ class Card extends BasicWeChat
}
/**
* 确认兑换库存接口
* @param string $cardId 需要来兑换库存的card_id
* @param integer $quantity 本次需要兑换的库存数目
* @param string $orderId 仅可以使用上面得到的订单号,保证批价有效性
* 确认兑换库存
* @param string $cardId 卡券ID
* @param int $quantity 数量
* @param string $orderId 批价返回的订单号
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -591,8 +588,8 @@ class Card extends BasicWeChat
}
/**
* 充值券点接口
* @param integer $coinCount
* 充值券点
* @param int $coinCount 充值数量
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -604,8 +601,8 @@ class Card extends BasicWeChat
}
/**
* 查询订单详情接口
* @param string $orderId
* 查询券点订单详情
* @param string $orderId 订单号
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -617,8 +614,8 @@ class Card extends BasicWeChat
}
/**
* 查询券点流水详情接口
* @param array $data
* 查询券点流水
* @param array $data 查询参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -631,7 +628,7 @@ class Card extends BasicWeChat
/**
* 获取开卡插件参数
* @param array $data
* @param array $data 入口参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -21,36 +21,31 @@ use WeChat\Exceptions\InvalidResponseException;
/**
* 支付宝支付基类
* Class AliPay
* @package AliPay\Contracts
* @package WeChat\Contracts
*/
abstract class BasicAliPay
{
/**
* 支持配置
* @var DataArray
*/
protected $config;
/**
* 当前请求数据
* @var DataArray
*/
protected $options;
/**
* DzContent数据
* @var DataArray
*/
protected $params;
/**
* 静态缓存
* @var static
*/
protected static $cache;
/**
* 支持配置
* @var DataArray
*/
protected $config;
/**
* 当前请求数据
* @var DataArray
*/
protected $options;
/**
* DzContent数据
* @var DataArray
*/
protected $params;
/**
* 正常请求网关
* @var string
@ -58,8 +53,8 @@ abstract class BasicAliPay
protected $gateway = 'https://openapi.alipay.com/gateway.do?charset=utf-8';
/**
* AliPay constructor.
* @param array $options
* 构造函数
* @param array $options 必填appid、public_key、private_key可选app_cert、root_cert、cache_path
*/
public function __construct($options)
{
@ -126,8 +121,8 @@ abstract class BasicAliPay
/**
* 查询支付宝订单状态
* @param string $outTradeNo
* @return array|boolean
* @param string $outTradeNo 商户订单号
* @return array 订单查询结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -137,11 +132,194 @@ abstract class BasicAliPay
return $this->getResult(['out_trade_no' => $outTradeNo]);
}
/**
* 请求接口并验证访问数据
* @param array $options 请求参数
* @return array 接口响应数据
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
protected function getResult($options)
{
$this->applyData($options);
$method = str_replace('.', '_', $this->options['method']) . '_response';
$data = json_decode(Tools::get($this->gateway, $this->options->get()), true);
if (!isset($data[$method]['code']) || $data[$method]['code'] !== '10000') {
throw new InvalidResponseException(
"Error: " .
(empty($data[$method]['code']) ? '' : "{$data[$method]['msg']} [{$data[$method]['code']}]\r\n") .
(empty($data[$method]['sub_code']) ? '' : "{$data[$method]['sub_msg']} [{$data[$method]['sub_code']}]\r\n"),
$data[$method]['code'], $data
);
}
return $data[$method];
// 返回结果签名检查
// return $this->verify($data[$method], $data['sign']);
}
/**
* 数据包生成及数据签名
* @param array $options
*/
protected function applyData($options)
{
if ($this->config->get('app_cert') && $this->config->get('root_cert')) {
$this->setAppCertSnAndRootCertSn();
}
$this->options->set('biz_content', json_encode($this->params->merge($options), 256));
$this->options->set('sign', $this->getSign());
}
/**
* 新版 设置网关应用公钥证书SN、支付宝根证书SN
*/
protected function setAppCertSnAndRootCertSn()
{
if (!($appCert = $this->config->get('app_cert'))) {
throw new InvalidArgumentException('Missing Config -- [app_cert|app_cert_path]');
}
if (!($rootCert = $this->config->get('root_cert'))) {
throw new InvalidArgumentException('Missing Config -- [root_cert|alipay_root_path]');
}
$this->options->set('app_cert_sn', $this->getAppCertSN($appCert));
$this->options->set('alipay_root_cert_sn', $this->getRootCertSN($rootCert));
if (!$this->options->get('app_cert_sn')) {
throw new InvalidArgumentException('Missing options -- [app_cert_sn]');
}
if (!$this->options->get('alipay_root_cert_sn')) {
throw new InvalidArgumentException('Missing options -- [alipay_root_cert_sn]');
}
}
/**
* 新版 从证书中提取序列号
* @param string $sign
* @return string
*/
private function getAppCertSN($sign)
{
$ssl = openssl_x509_parse($sign, true);
$issuer = isset($ssl['issuer']) && is_array($ssl['issuer']) ? $ssl['issuer'] : [];
return md5($this->_arr2str(array_reverse($issuer)) . $ssl['serialNumber']);
}
/**
* 新版 数组转字符串
* @param array $array
* @return string
*/
private function _arr2str($array)
{
$string = [];
if ($array && is_array($array)) {
foreach ($array as $key => $value) {
$string[] = $key . '=' . $value;
}
}
return join(',', $string);
}
/**
* 新版 提取根证书序列号
* @param string $sign
* @return string|null
*/
private function getRootCertSN($sign)
{
if (strlen($sign) < 500 && file_exists($sign)) {
$sign = file_get_contents($sign);
}
$sn = null;
$array = explode('-----END CERTIFICATE-----', $sign);
for ($i = 0; $i < count($array) - 1; $i++) {
$ssl[$i] = openssl_x509_parse($array[$i] . '-----END CERTIFICATE-----', true);
if (strpos($ssl[$i]['serialNumber'], '0x') === 0) {
$ssl[$i]['serialNumber'] = $this->_hex2dec($ssl[$i]['serialNumberHex']);
}
if ($ssl[$i]['signatureTypeLN'] == 'sha1WithRSAEncryption' || $ssl[$i]['signatureTypeLN'] == 'sha256WithRSAEncryption') {
$issuer = isset($ssl[$i]['issuer']) && is_array($ssl[$i]['issuer']) ? $ssl[$i]['issuer'] : [];
if ($sn == null) {
$sn = md5($this->_arr2str(array_reverse($issuer)) . $ssl[$i]['serialNumber']);
} else {
$sn = $sn . '_' . md5($this->_arr2str(array_reverse($issuer)) . $ssl[$i]['serialNumber']);
}
}
}
return $sn;
}
/**
* 新版 0x转高精度数字
* @param string $hex
* @return int|string
*/
private function _hex2dec($hex)
{
list($dec, $len) = [0, strlen($hex)];
for ($i = 1; $i <= $len; $i++) {
$dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
}
return $dec;
}
/**
* 获取数据签名
* @return string
*/
protected function getSign()
{
if ($this->options->get('sign_type') === 'RSA2') {
openssl_sign($this->getSignContent($this->options->get(), true), $sign, $this->getAppPrivateKey(), OPENSSL_ALGO_SHA256);
} else {
openssl_sign($this->getSignContent($this->options->get(), true), $sign, $this->getAppPrivateKey(), OPENSSL_ALGO_SHA1);
}
return base64_encode($sign);
}
/**
* 数据签名处理
* @param array $data 需要进行签名数据
* @param boolean $needSignType 是否需要sign_type字段
* @return string
*/
private function getSignContent(array $data, $needSignType = false)
{
ksort($data);
$attrs = array();
if (isset($data['sign'])) unset($data['sign']);
if (empty($needSignType)) unset($data['sign_type']);
foreach ($data as $key => $value) {
if ($value === '' || is_null($value)) continue;
$attrs[] = "{$key}={$value}";
}
return join('&', $attrs);
}
/**
* 获取应用私钥内容
* @return string
*/
private function getAppPrivateKey()
{
$content = wordwrap($this->trimCert($this->config->get('private_key')), 64, "\n", true);
return "-----BEGIN RSA PRIVATE KEY-----\n{$content}\n-----END RSA PRIVATE KEY-----";
}
/**
* 去除证书前后内容及空白
* @param string $sign
* @return string
*/
protected function trimCert($sign)
{
return preg_replace(['/\s+/', '/-{5}.*?-{5}/'], '', $sign);
}
/**
* 支付宝订单退款操作
* @param array|string $options 退款参数或退款商户订单号
* @param null $refundAmount 退款金额
* @return array|boolean
* @param string|null $refundAmount 退款金额
* @return array 退款结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -156,7 +334,7 @@ abstract class BasicAliPay
* 支付宝订单退款查询
* @param array|string $options 退款参数或退款商户订单号
* @param array|null $queryOptions 查询选项
* @return array|bool
* @return array 退款查询结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -170,8 +348,8 @@ abstract class BasicAliPay
/**
* 关闭支付宝进行中的订单
* @param array|string $options
* @return array|boolean
* @param array|string $options 订单参数或商户订单号
* @return array 关闭结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -204,6 +382,116 @@ abstract class BasicAliPay
return $data;
}
/**
* 获取支付公钥内容
* @return string
*/
public function getAliPublicKey()
{
$cert = $this->config->get('public_key');
if (strpos(trim($cert), '-----BEGIN CERTIFICATE-----') !== false) {
$pkey = openssl_pkey_get_public($cert);
$keyData = openssl_pkey_get_details($pkey);
return trim($keyData['key']);
} else {
$content = wordwrap($this->trimCert($cert), 64, "\n", true);
return "-----BEGIN PUBLIC KEY-----\n{$content}\n-----END PUBLIC KEY-----";
}
}
/**
* 应用数据操作
* @param array $options
* @return mixed
*/
abstract public function apply($options);
/**
* 通用接口调用(支付宝开放平台)
* @param string $apiMethod API 方法名(如 alipay.trade.query必填
* @param array|string $data 业务参数,数组会写入 biz_content字符串尝试解析为 JSON
* @param string $method GET|POST|PUT|DELETE|PATCH默认 GETPOST 会放入表单)
* @param bool $verify 是否验证返回签名
* @return array 返回解析后的响应体
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function callApi($apiMethod, $data = [], $method = 'GET', $verify = false)
{
$method = strtoupper($method);
// 验证API方法名必填
if (empty($apiMethod)) {
throw new \WeChat\Exceptions\InvalidArgumentException("Missing required parameter -- [apiMethod]");
}
// 使用gateway作为URL
$url = $this->gateway;
// 设置API方法
$this->options->set('method', $apiMethod);
// 处理数据格式并合并参数
$params = [];
if (is_array($data)) {
$params = $data;
} elseif (is_string($data) && !empty($data)) {
$decoded = json_decode($data, true);
if (json_last_error() === JSON_ERROR_NONE) {
$params = $decoded;
}
}
if (!empty($params)) {
$this->params->merge($params);
}
// 处理签名(默认自动签名)
if ($this->config->get('app_cert') && $this->config->get('root_cert')) {
$this->setAppCertSnAndRootCertSn();
}
$this->options->set('biz_content', json_encode($this->params->get(), 256));
$this->options->set('sign', $this->getSign());
// 统一处理响应(减少重复代码)
$methodKey = str_replace('.', '_', $this->options->get('method')) . '_response';
$self = $this;
$processResponse = function ($response) use ($verify, $methodKey, $self) {
$data = json_decode($response, true);
if (json_last_error() !== JSON_ERROR_NONE) {
return $response; // JSON解析失败返回原始响应
}
// 验证响应签名
if ($verify && isset($data['sign']) && isset($data[$methodKey])) {
return $self->verify($data[$methodKey], $data['sign']);
}
// 检查错误
if (isset($data[$methodKey])) {
if (isset($data[$methodKey]['code']) && $data[$methodKey]['code'] !== '10000') {
$msg = isset($data[$methodKey]['msg']) ? "{$data[$methodKey]['msg']} [{$data[$methodKey]['code']}]\r\n" : '';
$subMsg = isset($data[$methodKey]['sub_msg']) ? "{$data[$methodKey]['sub_msg']} [{$data[$methodKey]['sub_code']}]\r\n" : '';
throw new InvalidResponseException("Error: " . $msg . $subMsg, $data[$methodKey]['code'], $data);
}
return $data[$methodKey];
}
return $data;
};
// GET/HEAD/OPTIONS请求
if (in_array($method, ['GET', 'HEAD', 'OPTIONS'])) {
$queryParams = array_merge($this->options->get(), $params);
$response = Tools::get($url, $queryParams);
return $processResponse($response);
}
// POST/PUT/PATCH/DELETE请求
$postData = array_merge($this->options->get(), $params);
$response = Tools::doRequest($method, $url, ['data' => $postData]);
return $processResponse($response);
}
/**
* 验证接口返回的数据签名
* @param array $data 通知数据
@ -226,86 +514,6 @@ abstract class BasicAliPay
return $data;
}
/**
* 获取数据签名
* @return string
*/
protected function getSign()
{
if ($this->options->get('sign_type') === 'RSA2') {
openssl_sign($this->getSignContent($this->options->get(), true), $sign, $this->getAppPrivateKey(), OPENSSL_ALGO_SHA256);
} else {
openssl_sign($this->getSignContent($this->options->get(), true), $sign, $this->getAppPrivateKey(), OPENSSL_ALGO_SHA1);
}
return base64_encode($sign);
}
/**
* 去除证书前后内容及空白
* @param string $sign
* @return string
*/
protected function trimCert($sign)
{
return preg_replace(['/\s+/', '/-{5}.*?-{5}/'], '', $sign);
}
/**
* 数据签名处理
* @param array $data 需要进行签名数据
* @param boolean $needSignType 是否需要sign_type字段
* @return string
*/
private function getSignContent(array $data, $needSignType = false)
{
list($attrs,) = [[], ksort($data)];
if (isset($data['sign'])) unset($data['sign']);
if (empty($needSignType)) unset($data['sign_type']);
foreach ($data as $key => $value) {
if ($value === '' || is_null($value)) continue;
$attrs[] = "{$key}={$value}";
}
return join('&', $attrs);
}
/**
* 数据包生成及数据签名
* @param array $options
*/
protected function applyData($options)
{
if ($this->config->get('app_cert') && $this->config->get('root_cert')) {
$this->setAppCertSnAndRootCertSn();
}
$this->options->set('biz_content', json_encode($this->params->merge($options), 256));
$this->options->set('sign', $this->getSign());
}
/**
* 请求接口并验证访问数据
* @param array $options
* @return array|boolean
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
protected function getResult($options)
{
$this->applyData($options);
$method = str_replace('.', '_', $this->options['method']) . '_response';
$data = json_decode(Tools::get($this->gateway, $this->options->get()), true);
if (!isset($data[$method]['code']) || $data[$method]['code'] !== '10000') {
throw new InvalidResponseException(
"Error: " .
(empty($data[$method]['code']) ? '' : "{$data[$method]['msg']} [{$data[$method]['code']}]\r\n") .
(empty($data[$method]['sub_code']) ? '' : "{$data[$method]['sub_msg']} [{$data[$method]['sub_code']}]\r\n"),
$data[$method]['code'], $data
);
}
return $data[$method];
// 返回结果签名检查
// return $this->verify($data[$method], $data['sign']);
}
/**
* 生成支付HTML代码
* @return string
@ -320,128 +528,4 @@ abstract class BasicAliPay
$html .= "<input type='submit' value='ok' style='display:none;'></form>";
return "{$html}<script>document.forms['alipaysubmit'].submit();</script>";
}
/**
* 获取应用私钥内容
* @return string
*/
private function getAppPrivateKey()
{
$content = wordwrap($this->trimCert($this->config->get('private_key')), 64, "\n", true);
return "-----BEGIN RSA PRIVATE KEY-----\n{$content}\n-----END RSA PRIVATE KEY-----";
}
/**
* 获取支付公钥内容
* @return string
*/
public function getAliPublicKey()
{
$cert = $this->config->get('public_key');
if (strpos(trim($cert), '-----BEGIN CERTIFICATE-----') !== false) {
$pkey = openssl_pkey_get_public($cert);
$keyData = openssl_pkey_get_details($pkey);
return trim($keyData['key']);
} else {
$content = wordwrap($this->trimCert($cert), 64, "\n", true);
return "-----BEGIN PUBLIC KEY-----\n{$content}\n-----END PUBLIC KEY-----";
}
}
/**
* 新版 从证书中提取序列号
* @param string $sign
* @return string
*/
private function getAppCertSN($sign)
{
$ssl = openssl_x509_parse($sign, true);
return md5($this->_arr2str(array_reverse($ssl['issuer'])) . $ssl['serialNumber']);
}
/**
* 新版 提取根证书序列号
* @param string $sign
* @return string|null
*/
private function getRootCertSN($sign)
{
if (strlen($sign) < 500 && file_exists($sign)) {
$sign = file_get_contents($sign);
}
$sn = null;
$array = explode('-----END CERTIFICATE-----', $sign);
for ($i = 0; $i < count($array) - 1; $i++) {
$ssl[$i] = openssl_x509_parse($array[$i] . '-----END CERTIFICATE-----', true);
if (strpos($ssl[$i]['serialNumber'], '0x') === 0) {
$ssl[$i]['serialNumber'] = $this->_hex2dec($ssl[$i]['serialNumberHex']);
}
if ($ssl[$i]['signatureTypeLN'] == 'sha1WithRSAEncryption' || $ssl[$i]['signatureTypeLN'] == 'sha256WithRSAEncryption') {
if ($sn == null) {
$sn = md5($this->_arr2str(array_reverse($ssl[$i]['issuer'])) . $ssl[$i]['serialNumber']);
} else {
$sn = $sn . '_' . md5($this->_arr2str(array_reverse($ssl[$i]['issuer'])) . $ssl[$i]['serialNumber']);
}
}
}
return $sn;
}
/**
* 新版 设置网关应用公钥证书SN、支付宝根证书SN
*/
protected function setAppCertSnAndRootCertSn()
{
if (!($appCert = $this->config->get('app_cert'))) {
throw new InvalidArgumentException('Missing Config -- [app_cert|app_cert_path]');
}
if (!($rootCert = $this->config->get('root_cert'))) {
throw new InvalidArgumentException('Missing Config -- [root_cert|alipay_root_path]');
}
$this->options->set('app_cert_sn', $this->getAppCertSN($appCert));
$this->options->set('alipay_root_cert_sn', $this->getRootCertSN($rootCert));
if (!$this->options->get('app_cert_sn')) {
throw new InvalidArgumentException('Missing options -- [app_cert_sn]');
}
if (!$this->options->get('alipay_root_cert_sn')) {
throw new InvalidArgumentException('Missing options -- [alipay_root_cert_sn]');
}
}
/**
* 新版 数组转字符串
* @param array $array
* @return string
*/
private function _arr2str($array)
{
$string = [];
if ($array && is_array($array)) {
foreach ($array as $key => $value) {
$string[] = $key . '=' . $value;
}
}
return join(',', $string);
}
/**
* 新版 0x转高精度数字
* @param string $hex
* @return int|string
*/
private function _hex2dec($hex)
{
list($dec, $len) = [0, strlen($hex)];
for ($i = 1; $i <= $len; $i++) {
$dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
}
return $dec;
}
/**
* 应用数据操作
* @param array $options
* @return mixed
*/
abstract public function apply($options);
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -23,7 +23,6 @@ use WeChat\Prpcrypt\Prpcrypt;
/**
* 微信通知处理基本类
* Class BasicPushEvent
* @package WeChat\Contracts
*/
class BasicPushEvent
@ -118,6 +117,30 @@ class BasicPushEvent
}
}
/**
* 消息是否需要加密
* @return boolean
*/
public function isEncrypt()
{
return $this->encryptType === 'aes';
}
/**
* 验证来自微信服务器
* @return bool
*/
private function checkSignature()
{
$nonce = $this->input->get('nonce');
$timestamp = $this->input->get('timestamp');
$msg_signature = $this->input->get('msg_signature');
$signature = empty($msg_signature) ? $this->input->get('signature') : $msg_signature;
$tmpArr = [$this->config->get('token'), $timestamp, $nonce, ''];
sort($tmpArr, SORT_STRING);
return sha1(implode($tmpArr)) === $signature;
}
/**
* 获取回显字串
* @return string
@ -131,15 +154,6 @@ class BasicPushEvent
}
}
/**
* 消息是否需要加密
* @return boolean
*/
public function isEncrypt()
{
return $this->encryptType === 'aes';
}
/**
* 回复消息
* @param array $data 消息内容
@ -171,21 +185,6 @@ class BasicPushEvent
echo $xml;
}
/**
* 验证来自微信服务器
* @return bool
*/
private function checkSignature()
{
$nonce = $this->input->get('nonce');
$timestamp = $this->input->get('timestamp');
$msg_signature = $this->input->get('msg_signature');
$signature = empty($msg_signature) ? $this->input->get('signature') : $msg_signature;
$tmpArr = [$this->config->get('token'), $timestamp, $nonce, ''];
sort($tmpArr, SORT_STRING);
return sha1(implode($tmpArr)) === $signature;
}
/**
* 获取公众号推送对象
* @param null|string $field 指定获取字段

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,42 +20,37 @@ use WeChat\Exceptions\InvalidArgumentException;
use WeChat\Exceptions\InvalidResponseException;
/**
* Class BasicWeChat
* 微信基础类
* @package WeChat\Contracts
*/
class BasicWeChat
{
/**
* 静态缓存
* @var static
*/
protected static $cache;
/**
* 当前微信配置
* @var DataArray
*/
public $config;
/**
* 访问AccessToken
* @var string
*/
public $access_token = '';
/**
* 当前请求方法参数
* @var array
*/
protected $currentMethod = [];
/**
* 当前模式
* @var bool
*/
protected $isTry = false;
/**
* 静态缓存
* @var static
*/
protected static $cache;
/**
* 注册代替函数
* @var string
@ -63,8 +58,8 @@ class BasicWeChat
protected $GetAccessTokenCallback;
/**
* BasicWeChat constructor.
* @param array $options
* 构造函数
* @param array $options 必填appid、appsecret可选GetAccessTokenCallback、cache_path
*/
public function __construct(array $options)
{
@ -85,7 +80,7 @@ class BasicWeChat
/**
* 静态创建对象
* @param array $config
* @param array $config 配置appid、appsecret 等)
* @return static
*/
public static function instance(array $config)
@ -95,6 +90,37 @@ class BasicWeChat
return self::$cache[$key] = new static($config);
}
/**
* 接口通用POST请求方法
* @param string $url 接口URL
* @param array $data POST提交接口参数
* @param bool $toJson 是否转换为JSON参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function callPostApi($url, array $data, $toJson = true, array $options = [])
{
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data, $toJson, $options);
}
/**
* 注册当前请求接口(自动处理 ACCESS_TOKEN
* @param string $url 接口地址(引用传递,会被修改)
* @param string $method 当前接口方法名
* @param array $arguments 请求参数
* @return string 替换 ACCESS_TOKEN 后的 URL
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
protected function registerApi(&$url, $method, $arguments = [])
{
$this->currentMethod = ['method' => $method, 'arguments' => $arguments];
if (empty($this->access_token)) $this->access_token = $this->getAccessToken();
return $url = str_replace('ACCESS_TOKEN', urlencode($this->access_token), $url);
}
/**
* 获取访问 AccessToken
* @return string
@ -147,38 +173,6 @@ class BasicWeChat
Tools::setCache($cache, $this->access_token = $accessToken);
}
/**
* 清理删除 AccessToken
* @return bool
*/
public function delAccessToken()
{
$this->access_token = '';
return Tools::delCache($this->config->get('appid') . '_access_token');
}
/**
* 以GET获取接口数据并转为数组
* @param string $url 接口地址
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
protected function httpGetForJson($url)
{
try {
return Tools::json2arr(Tools::get($url));
} catch (InvalidResponseException $exception) {
if (isset($this->currentMethod['method']) && empty($this->isTry)) {
if (in_array($exception->getCode(), ['40014', '40001', '41001', '42001'])) {
[$this->delAccessToken(), $this->isTry = true];
return call_user_func_array([$this, $this->currentMethod['method']], $this->currentMethod['arguments']);
}
}
throw new InvalidResponseException($exception->getMessage(), $exception->getCode());
}
}
/**
* 以POST获取接口数据并转为数组
* @param string $url 接口地址
@ -197,7 +191,8 @@ class BasicWeChat
return Tools::json2arr(Tools::post($url, $toJson ? Tools::arr2json($data) : $data, $options));
} catch (InvalidResponseException $exception) {
if (!$this->isTry && in_array($exception->getCode(), ['40014', '40001', '41001', '42001'])) {
[$this->delAccessToken(), $this->isTry = true];
$this->delAccessToken();
$this->isTry = true;
return call_user_func_array([$this, $this->currentMethod['method']], $this->currentMethod['arguments']);
}
throw new InvalidResponseException($exception->getMessage(), $exception->getCode());
@ -205,39 +200,18 @@ class BasicWeChat
}
/**
* 注册当前请求接口
* @param string $url 接口地址
* @param string $method 当前接口方法
* @param array $arguments 请求参数
* @return string
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* 清理删除 AccessToken
* @return bool
*/
protected function registerApi(&$url, $method, $arguments = [])
public function delAccessToken()
{
$this->currentMethod = ['method' => $method, 'arguments' => $arguments];
if (empty($this->access_token)) $this->access_token = $this->getAccessToken();
return $url = str_replace('ACCESS_TOKEN', urlencode($this->access_token), $url);
$this->access_token = '';
return Tools::delCache($this->config->get('appid') . '_access_token');
}
/**
* 接口通用POST请求方法
* @param string $url 接口URL
* @param array $data POST提交接口参数
* @param bool $toJson 是否转换为JSON参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function callPostApi($url, array $data, $toJson = true, array $options = [])
{
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data, $toJson, $options);
}
/**
* 接口通用GET请求方法
* @param string $url 接口URL
* 通用 GET 请求(自动处理 ACCESS_TOKEN
* @param string $url 接口 URL
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -248,4 +222,71 @@ class BasicWeChat
return $this->httpGetForJson($url);
}
/**
* 以GET获取接口数据并转为数组
* @param string $url 接口地址
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
protected function httpGetForJson($url)
{
try {
return Tools::json2arr(Tools::get($url));
} catch (InvalidResponseException $exception) {
if (isset($this->currentMethod['method']) && empty($this->isTry)) {
if (in_array($exception->getCode(), ['40014', '40001', '41001', '42001'])) {
$this->delAccessToken();
$this->isTry = true;
return call_user_func_array([$this, $this->currentMethod['method']], $this->currentMethod['arguments']);
}
}
throw new InvalidResponseException($exception->getMessage(), $exception->getCode());
}
}
/**
* 通用接口调用
* @param string $url 完整 URL 或相对路径,支持 ACCESS_TOKEN 占位符自动替换
* @param array|string $data GET 参数或请求体,数组自动 JSON字符串原样发送
* @param string $method GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS默认 GET
* @return array 解析后的数组
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function callApi($url, $data = [], $method = 'GET')
{
$method = strtoupper($method);
// 自动处理ACCESS_TOKEN
if (strpos($url, 'ACCESS_TOKEN') !== false) {
if (empty($this->access_token)) {
$this->access_token = $this->getAccessToken();
}
$url = str_replace('ACCESS_TOKEN', urlencode($this->access_token), $url);
}
// GET/HEAD/OPTIONS请求无请求体
if (in_array($method, ['GET', 'HEAD', 'OPTIONS'])) {
if (!empty($data) && is_array($data)) {
$url .= (strpos($url, '?') !== false ? '&' : '?') . http_build_query($data);
}
return $this->httpGetForJson($url);
}
// POST/PUT/PATCH/DELETE请求有请求体
$postData = is_array($data) ? $data : [];
$toJson = is_array($data);
// POST请求使用原有方法支持自动重试
if ($method === 'POST') {
return $this->httpPostForJson($url, $postData, $toJson, []);
}
// PUT/PATCH/DELETE请求直接调用
$requestData = is_string($data) ? $data : Tools::arr2json($postData);
$response = Tools::doRequest($method, $url, ['data' => $requestData]);
return Tools::json2arr($response);
}
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -21,17 +21,20 @@ use WeChat\Exceptions\InvalidResponseException;
/**
* 微信支付基础类
* Class BasicPay
* @package WeChat\Contracts
*/
class BasicWePay
{
/**
* 静态缓存
* @var static
*/
protected static $cache;
/**
* 商户配置
* @var DataArray
*/
protected $config;
/**
* 当前请求数据
* @var DataArray
@ -39,14 +42,8 @@ class BasicWePay
protected $params;
/**
* 静态缓存
* @var static
*/
protected static $cache;
/**
* WeChat constructor.
* @param array $options
* 构造函数
* @param array $options 必填appid、mch_id、mch_key可选sub_appid、sub_mch_id、cache_path
*/
public function __construct(array $options)
{
@ -80,7 +77,7 @@ class BasicWePay
/**
* 静态创建对象
* @param array $config
* @param array $config 商户配置
* @return static
*/
public static function instance(array $config)
@ -91,9 +88,9 @@ class BasicWePay
}
/**
* 获取微信支付通知
* @param string|array $xml
* @return array
* 获取微信支付异步通知并验签
* @param string|array $xml 可选,默认读取原始输入
* @return array 验签通过的通知数据
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function getNotify($xml = '')
@ -105,21 +102,12 @@ class BasicWePay
throw new InvalidResponseException('Invalid Notify.', '0');
}
/**
* 获取微信支付通知回复内容
* @return string
*/
public function getNotifySuccessReply()
{
return Tools::arr2xml(['return_code' => 'SUCCESS', 'return_msg' => 'OK']);
}
/**
* 生成支付签名
* @param array $data 参与签名的数据
* @param string $signType 参与签名的类型
* @param string $buff 参与签名字符串前缀
* @return string
* @param array $data 待签名数据
* @param string $signType MD5|HMAC-SHA256
* @param string $buff 签名前缀(内部使用)
* @return string 大写签名
*/
public function getPaySign(array $data, $signType = 'MD5', $buff = '')
{
@ -137,8 +125,17 @@ class BasicWePay
}
/**
* 转换短链接
* @param string $longUrl 需要转换的URL签名用原串传输需URLencode
* 获取微信支付通知成功回复 XML
* @return string
*/
public function getNotifySuccessReply()
{
return Tools::arr2xml(['return_code' => 'SUCCESS', 'return_msg' => 'OK']);
}
/**
* 转换短链接tools/shorturl
* @param string $longUrl 需转换的URL签名用原串传输需URLencode
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -150,27 +147,14 @@ class BasicWePay
}
/**
* 数组直接转xml数据输出
* @param array $data
* @param bool $isReturn
* @return string|void
*/
public function toXml(array $data, $isReturn = false)
{
$xml = Tools::arr2xml($data);
if ($isReturn) return $xml;
echo $xml;
}
/**
* Post 请求接口
* @param string $url 请求
* 基础 POST 调用(自动签名,可选双向证书)
* @param string $url 请求地址
* @param array $data 接口参数
* @param bool $isCert 是否需要使用双向证书
* @param string $signType 数据签名类型 MD5|SHA256
* @param bool $needSignType 是否需要传签名类型参数
* @param bool $needNonceStr
* @return array
* @param bool $isCert 是否需要双向证书(退款等场景)
* @param string $signType MD5|HMAC-SHA256
* @param bool $needSignType 是否追加 sign_type 字段
* @param bool $needNonceStr 是否自动附加 nonce_str
* @return array XML 解析结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -205,4 +189,92 @@ class BasicWePay
}
return $result;
}
/**
* 数组转 XML 输出
* @param array $data 待转换数据
* @param bool $isReturn true 返回字符串false 直接输出
* @return string|void
*/
public function toXml(array $data, $isReturn = false)
{
$xml = Tools::arr2xml($data);
if ($isReturn) return $xml;
echo $xml;
}
/**
* 通用接口V2调用
* @param string $url 完整 URL
* @param array|string $data 请求参数,数组自动补全商户参数并签名;字符串原样发送
* @param string $method GET|POST|PUT|DELETE|PATCH默认 POSTGET/HEAD/OPTIONS 不带签名)
* @param bool $isCert 是否启用双向证书
* @param string $signType MD5|HMAC-SHA256默认 HMAC-SHA256
* @return array XML 解析结果
* @throws \WeChat\Exceptions\InvalidArgumentException
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function callApi($url, $data = [], $method = 'POST', $isCert = false, $signType = 'HMAC-SHA256')
{
$method = strtoupper($method);
// 处理数据格式
$requestData = is_array($data) ? $data : (is_string($data) ? $data : []);
// GET/HEAD/OPTIONS请求无请求体不签名
if (in_array($method, ['GET', 'HEAD', 'OPTIONS'])) {
if (!empty($requestData) && is_array($requestData)) {
$url .= (strpos($url, '?') !== false ? '&' : '?') . http_build_query($requestData);
}
$response = Tools::get($url);
$result = Tools::xml2arr($response);
if (isset($result['return_code']) && $result['return_code'] !== 'SUCCESS') {
throw new InvalidResponseException($result['return_msg'], '0');
}
return $result;
}
// POST/PUT/PATCH/DELETE请求有请求体
$option = [];
if ($isCert) {
$option['ssl_p12'] = $this->config->get('ssl_p12');
$option['ssl_cer'] = $this->config->get('ssl_cer');
$option['ssl_key'] = $this->config->get('ssl_key');
if (is_string($option['ssl_p12']) && file_exists($option['ssl_p12'])) {
$content = file_get_contents($option['ssl_p12']);
if (openssl_pkcs12_read($content, $certs, $this->config->get('mch_id'))) {
$option['ssl_key'] = Tools::pushFile(md5($certs['pkey']) . '.pem', $certs['pkey']);
$option['ssl_cer'] = Tools::pushFile(md5($certs['cert']) . '.pem', $certs['cert']);
} else {
throw new InvalidArgumentException("P12 certificate does not match MCH_ID --- ssl_p12");
}
}
if (empty($option['ssl_cer']) || !file_exists($option['ssl_cer'])) {
throw new InvalidArgumentException("Missing Config -- ssl_cer", '0');
}
if (empty($option['ssl_key']) || !file_exists($option['ssl_key'])) {
throw new InvalidArgumentException("Missing Config -- ssl_key", '0');
}
}
// 合并参数并处理签名(默认自动签名)
if (is_array($requestData)) {
$params = $this->params->merge($requestData);
$params['sign_type'] = strtoupper($signType);
$params['sign'] = $this->getPaySign($params, $signType);
$option['data'] = Tools::arr2xml($params);
} else {
$option['data'] = $requestData;
}
// 使用doRequest支持PUT/DELETE/PATCH
$response = Tools::doRequest($method, $url, $option);
$result = Tools::xml2arr($response);
if (isset($result['return_code']) && $result['return_code'] !== 'SUCCESS') {
throw new InvalidResponseException($result['return_msg'], '0');
}
return $result;
}
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -18,7 +18,6 @@ namespace WeChat\Contracts;
/**
* 企业微信基础类
* Class BasicWeWork
* @package WeChat\Contracts
*/
class BasicWeWork extends BasicWeChat

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,8 +19,8 @@ namespace WeChat\Contracts;
use ArrayAccess;
/**
* Class DataArray
* @package WeChat
* 数据处理类
* @package WeChat\Contracts
*/
class DataArray implements ArrayAccess
{
@ -50,6 +50,22 @@ class DataArray implements ArrayAccess
$this->offsetSet($offset, $value);
}
/**
* 设置配置项值
* @param string $offset
* @param string|array|null|integer $value
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->config[] = $value;
} else {
$this->config[$offset] = $value;
}
}
/**
* 获取配置项参数
* @param string|null $offset
@ -60,6 +76,18 @@ class DataArray implements ArrayAccess
return $this->offsetGet($offset);
}
/**
* 获取配置项参数
* @param string|null $offset
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset = null)
{
if (is_null($offset)) return $this->config;
return isset($this->config[$offset]) ? $this->config[$offset] : null;
}
/**
* 合并数据到对象
* @param array $data 需要合并的数据
@ -74,22 +102,6 @@ class DataArray implements ArrayAccess
return array_merge($this->config, $data);
}
/**
* 设置配置项值
* @param string $offset
* @param string|array|null|integer $value
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->config[] = $value;
} else {
$this->config[$offset] = $value;
}
}
/**
* 判断配置Key是否存在
* @param string $offset
@ -115,16 +127,4 @@ class DataArray implements ArrayAccess
unset($this->config[$offset]);
}
}
/**
* 获取配置项参数
* @param string|null $offset
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset = null)
{
if (is_null($offset)) return $this->config;
return isset($this->config[$offset]) ? $this->config[$offset] : null;
}
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -18,7 +18,6 @@ namespace WeChat\Contracts;
/**
* 错误消息处理
* Class DataError
* @package WeChat\Contracts
*/
class DataError

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -18,7 +18,6 @@ namespace WeChat\Contracts;
/**
* 自定义CURL文件类
* Class MyCurlFile
* @package WeChat\Contracts
*/
class MyCurlFile extends \stdClass

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -48,7 +48,6 @@ use WeChat\Exceptions\LocalCacheException;
/**
* 网络请求支持
* Class Tools
* @package WeChat\Contracts
*/
class Tools
@ -114,61 +113,6 @@ class Tools
$GLOBALS['HTTP_RAW_POST_DATA'] = $rawInput;
}
/**
* 根据文件后缀获取文件类型
* @param string|array $ext 文件后缀
* @param array $mine 文件后缀MINE信息
* @return string
* @throws \WeChat\Exceptions\LocalCacheException
*/
public static function getExtMine($ext, $mine = [])
{
$mines = self::getMines();
foreach (is_string($ext) ? explode(',', $ext) : $ext as $e) {
$mine[] = isset($mines[strtolower($e)]) ? $mines[strtolower($e)] : 'application/octet-stream';
}
return join(',', array_unique($mine));
}
/**
* 获取所有文件扩展的类型
* @return array
* @throws \WeChat\Exceptions\LocalCacheException
*/
private static function getMines()
{
$mines = self::getCache('all_ext_mine');
if (empty($mines)) {
$content = file_get_contents('http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types');
preg_match_all('#^([^\s]{2,}?)\s+(.+?)$#ism', $content, $matches, PREG_SET_ORDER);
foreach ($matches as $match) foreach (explode(" ", $match[2]) as $ext) $mines[$ext] = $match[1];
self::setCache('all_ext_mine', $mines);
}
return $mines;
}
/**
* 创建CURL文件对象
* @param mixed $filename
* @param string $mimetype
* @param string $postname
* @return \CURLFile|string
* @throws \WeChat\Exceptions\LocalCacheException
*/
public static function createCurlFile($filename, $mimetype = null, $postname = null)
{
if (is_string($filename) && file_exists($filename)) {
if (is_null($postname)) $postname = basename($filename);
if (is_null($mimetype)) $mimetype = self::getExtMine(pathinfo($filename, 4));
if (class_exists('CURLFile')) {
return new \CURLFile($filename, $mimetype, $postname);
} else {
return "@{$filename};filename={$postname};type={$mimetype}";
}
}
return $filename;
}
/**
* 数组转XML内容
* @param array $data
@ -202,6 +146,17 @@ class Tools
return $content;
}
/**
* 解析XML文本内容
* @param string $xml
* @return array|false
*/
public static function xml3arr($xml)
{
$state = xml_parse($parser = xml_parser_create(), $xml, true);
return xml_parser_free($parser) && $state ? self::xml2arr($xml) : false;
}
/**
* 解析XML内容到数组
* @param string $xml
@ -219,17 +174,6 @@ class Tools
return json_decode(json_encode($data), true);
}
/**
* 解析XML文本内容
* @param string $xml
* @return array|false
*/
public static function xml3arr($xml)
{
$state = xml_parse($parser = xml_parser_create(), $xml, true);
return xml_parser_free($parser) && $state ? self::xml2arr($xml) : false;
}
/**
* 数组转xml内容
* @param array $data
@ -260,6 +204,18 @@ class Tools
return $data;
}
/**
* Emoji原形转换为String
* @param string $content
* @return string
*/
public static function emojiEncode($content)
{
return json_decode(preg_replace_callback("/(\\\u[ed][0-9a-f]{3})/i", function ($string) {
return addslashes($string[0]);
}, json_encode($content)));
}
/**
* 数组对象Emoji反解析处理
* @param array $data
@ -279,18 +235,6 @@ class Tools
return $data;
}
/**
* Emoji原形转换为String
* @param string $content
* @return string
*/
public static function emojiEncode($content)
{
return json_decode(preg_replace_callback("/(\\\u[ed][0-9a-f]{3})/i", function ($string) {
return addslashes($string[0]);
}, json_encode($content)));
}
/**
* Emoji字符串转换为原形
* @param string $content
@ -335,20 +279,6 @@ class Tools
return self::doRequest('get', $url, $options);
}
/**
* 以post访问模拟访问
* @param string $url 访问URL
* @param array $data POST数据
* @param array $options
* @return boolean|string
* @throws \WeChat\Exceptions\LocalCacheException
*/
public static function post($url, $data = [], $options = [])
{
$options['data'] = $data;
return self::doRequest('post', $url, $options);
}
/**
* CURL模拟网络请求
* @param string $method 请求方法
@ -368,9 +298,14 @@ class Tools
if (!empty($options['headers'])) {
curl_setopt($curl, CURLOPT_HTTPHEADER, $options['headers']);
}
// POST数据设置
if (strtolower($method) === 'post') {
curl_setopt($curl, CURLOPT_POST, true);
// POST/PUT/PATCH/DELETE数据设置
$methodLower = strtolower($method);
if (in_array($methodLower, ['post', 'put', 'patch', 'delete'])) {
if ($methodLower === 'post') {
curl_setopt($curl, CURLOPT_POST, true);
} else {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, strtoupper($method));
}
curl_setopt($curl, CURLOPT_POSTFIELDS, self::_buildHttpData($options['data']));
}
// 证书文件设置
@ -384,7 +319,7 @@ class Tools
curl_setopt($curl, CURLOPT_SSLKEY, $options['ssl_key']);
} else throw new InvalidArgumentException("Certificate files that do not exist. --- [ssl_key]");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_TIMEOUT, isset($options['timeout']) ? intval($options['timeout']) : 60);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
@ -431,43 +366,58 @@ class Tools
}
/**
* 写入文件
* @param string $name 文件名称
* @param string $content 文件内容
* @return string
* 创建CURL文件对象
* @param mixed $filename
* @param string $mimetype
* @param string $postname
* @return \CURLFile|string
* @throws \WeChat\Exceptions\LocalCacheException
*/
public static function pushFile($name, $content)
public static function createCurlFile($filename, $mimetype = null, $postname = null)
{
if (is_callable(self::$cache_callable['put'])) {
return call_user_func_array(self::$cache_callable['put'], func_get_args());
if (is_string($filename) && file_exists($filename)) {
if (is_null($postname)) $postname = basename($filename);
if (is_null($mimetype)) $mimetype = self::getExtMine(pathinfo($filename, 4));
if (class_exists('CURLFile')) {
return new \CURLFile($filename, $mimetype, $postname);
} else {
return "@{$filename};filename={$postname};type={$mimetype}";
}
}
$file = self::_getCacheName($name);
if (!file_put_contents($file, $content)) {
throw new LocalCacheException('local file write error.', '0');
}
return $file;
return $filename;
}
/**
* 缓存配置与存储
* @param string $name 缓存名称
* @param string $value 缓存内容
* @param int $expired 缓存时间(0表示永久缓存)
* 根据文件后缀获取文件类型
* @param string|array $ext 文件后缀
* @param array $mine 文件后缀MINE信息
* @return string
* @throws \WeChat\Exceptions\LocalCacheException
*/
public static function setCache($name, $value = '', $expired = 3600)
public static function getExtMine($ext, $mine = [])
{
if (is_callable(self::$cache_callable['set'])) {
return call_user_func_array(self::$cache_callable['set'], func_get_args());
$mines = self::getMines();
foreach (is_string($ext) ? explode(',', $ext) : $ext as $e) {
$mine[] = isset($mines[strtolower($e)]) ? $mines[strtolower($e)] : 'application/octet-stream';
}
$file = self::_getCacheName($name);
$data = ['name' => $name, 'value' => $value, 'expired' => time() + intval($expired)];
if (!file_put_contents($file, serialize($data))) {
throw new LocalCacheException('local cache error.', '0');
return join(',', array_unique($mine));
}
/**
* 获取所有文件扩展的类型
* @return array
* @throws \WeChat\Exceptions\LocalCacheException
*/
private static function getMines()
{
$mines = self::getCache('all_ext_mine');
if (empty($mines)) {
$content = file_get_contents('http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types');
preg_match_all('#^([^\s]{2,}?)\s+(.+?)$#ism', $content, $matches, PREG_SET_ORDER);
foreach ($matches as $match) foreach (explode(" ", $match[2]) as $ext) $mines[$ext] = $match[1];
self::setCache('all_ext_mine', $mines);
}
return $file;
return $mines;
}
/**
@ -491,6 +441,23 @@ class Tools
return null;
}
/**
* 应用缓存目录
* @param string $name
* @return string
*/
private static function _getCacheName($name)
{
if (empty(self::$cache_path)) {
self::$cache_path = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR;
}
$cachePath = rtrim((string)self::$cache_path, '/\\') . DIRECTORY_SEPARATOR;
if (!file_exists($cachePath)) {
mkdir($cachePath, 0755, true);
}
return $cachePath . $name;
}
/**
* 移除缓存文件
* @param string $name 缓存名称
@ -506,17 +473,56 @@ class Tools
}
/**
* 应用缓存目录
* @param string $name
* 缓存配置与存储
* @param string $name 缓存名称
* @param string $value 缓存内容
* @param int $expired 缓存时间(0表示永久缓存)
* @return string
* @throws \WeChat\Exceptions\LocalCacheException
*/
private static function _getCacheName($name)
public static function setCache($name, $value = '', $expired = 3600)
{
if (empty(self::$cache_path)) {
self::$cache_path = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR;
if (is_callable(self::$cache_callable['set'])) {
return call_user_func_array(self::$cache_callable['set'], func_get_args());
}
self::$cache_path = rtrim(self::$cache_path, '/\\') . DIRECTORY_SEPARATOR;
file_exists(self::$cache_path) || mkdir(self::$cache_path, 0755, true);
return self::$cache_path . $name;
$file = self::_getCacheName($name);
$data = ['name' => $name, 'value' => $value, 'expired' => time() + intval($expired)];
if (!file_put_contents($file, serialize($data))) {
throw new LocalCacheException('local cache error.', '0');
}
return $file;
}
/**
* 以post访问模拟访问
* @param string $url 访问URL
* @param array $data POST数据
* @param array $options
* @return boolean|string
* @throws \WeChat\Exceptions\LocalCacheException
*/
public static function post($url, $data = [], $options = [])
{
$options['data'] = $data;
return self::doRequest('post', $url, $options);
}
/**
* 写入文件
* @param string $name 文件名称
* @param string $content 文件内容
* @return string
* @throws \WeChat\Exceptions\LocalCacheException
*/
public static function pushFile($name, $content)
{
if (is_callable(self::$cache_callable['put'])) {
return call_user_func_array(self::$cache_callable['put'], func_get_args());
}
$file = self::_getCacheName($name);
if (!file_put_contents($file, $content)) {
throw new LocalCacheException('local file write error.', '0');
}
return $file;
}
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -21,14 +21,13 @@ use WeChat\Contracts\Tools;
/**
* 客服消息处理
* Class Custom
* @package WeChat
*/
class Custom extends BasicWeChat
{
/**
* 添加客服帐号
* @param string $kf_account 客服账号
* @param string $kf_account 客服账号,格式 账号前缀@公众号微信号
* @param string $nickname 客服昵称
* @return array
* @throws Exceptions\InvalidResponseException
@ -69,7 +68,7 @@ class Custom extends BasicWeChat
/**
* 邀请绑定客服帐号
* @param string $kfAccount 完整客服帐号,格式为:帐号前缀@公众号微信号
* @param string $kfAccount 客服账号,格式 号前缀@公众号微信号
* @param string $invite_wx 接收绑定邀请的客服微信号
* @return array
* @throws Exceptions\InvalidResponseException
@ -82,7 +81,7 @@ class Custom extends BasicWeChat
}
/**
* 获取所有客服账号
* 获取客服账号列表
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -94,9 +93,9 @@ class Custom extends BasicWeChat
}
/**
* 设置客服帐号的头像
* @param string $kf_account 账号
* @param string $image 头像文件位置
* 设置客服头像
* @param string $kf_account 账号
* @param string $image 本地图片路径
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -108,8 +107,8 @@ class Custom extends BasicWeChat
}
/**
* 客服接口-消息
* @param array $data
* 发送客服消息
* @param array $data 消息体touser, msgtype, content 等)
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -121,9 +120,9 @@ class Custom extends BasicWeChat
}
/**
* 客服输入状态
* @param string $openid 普通用户openid
* @param string $command Typing:正在输入,CancelTyping:取消正在输入
* 设置客服输入状态
* @param string $openid 用户 openid
* @param string $command Typing|CancelTyping
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -135,8 +134,8 @@ class Custom extends BasicWeChat
}
/**
* 根据标签进行群发【订阅号与服务号认证后均可用】
* @param array $data
* 根据标签群发
* @param array $data 群发参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -148,8 +147,8 @@ class Custom extends BasicWeChat
}
/**
* 根据OpenID列表群发【订阅号不可用,服务号认证后可用】
* @param array $data
* 根据 OpenID 列表群发
* @param array $data 群发参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -161,9 +160,9 @@ class Custom extends BasicWeChat
}
/**
* 删除群发【订阅号与服务号认证后均可用】
* @param integer $msg_id 送出去的消息ID
* @param null|integer $article_idx 要删除的文章在图文消息中的位置第一篇编号为1该字段不填或填0会删除全部文章
* 删除群发
* @param int $msg_id 发消息ID
* @param null|int $article_idx 图文位置0 删除全部
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -177,8 +176,8 @@ class Custom extends BasicWeChat
}
/**
* 预览接口【订阅号与服务号认证后均可用】
* @param array $data
* 群发预览
* @param array $data 预览参数
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -190,8 +189,8 @@ class Custom extends BasicWeChat
}
/**
* 查询群发消息发送状态【订阅号与服务号认证后均可用】
* @param integer $msgId 群发消息后返回的消息id
* 查询群发状态
* @param int $msgId 群发消息ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -216,7 +215,7 @@ class Custom extends BasicWeChat
/**
* 设置群发速度
* @param integer $speed 群发速度级别
* @param int $speed 速度级别
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,7 +20,6 @@ use WeChat\Contracts\BasicWeChat;
/**
* 微信草稿箱管理
* Class Draft
* @author taoxin
* @package WeChat
*/
@ -28,8 +27,8 @@ class Draft extends BasicWeChat
{
/**
* 新建草稿
* @param $articles
* @return array
* @param array $articles 图文数组 articles
* @return array 草稿 media_id
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -41,9 +40,9 @@ class Draft extends BasicWeChat
/**
* 获取草稿
* @param string $mediaId
* @param string $outType 返回处理函数
* @return array
* @param string $mediaId 草稿 media_id
* @param string $outType 可选回调处理
* @return array 草稿内容
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -55,7 +54,7 @@ class Draft extends BasicWeChat
/**
* 删除草稿
* @param string $mediaId
* @param string $mediaId 草稿 media_id
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -68,7 +67,7 @@ class Draft extends BasicWeChat
/**
* 新增图文素材
* @param array $data 文件名称
* @param array $data 图文 articles
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -81,9 +80,9 @@ class Draft extends BasicWeChat
/**
* 修改草稿
* @param string $media_id 要修改的图文消息的id
* @param int $index 要更新的文章在图文消息中的位置多图文消息时此字段才有意义第一篇为0
* @param $articles
* @param string $media_id 草稿 media_id
* @param int $index 文章序号0 开始)
* @param array $articles 文章内容
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -109,9 +108,9 @@ class Draft extends BasicWeChat
/**
* 获取草稿列表
* @param int $offset 从全部素材的该偏移位置开始返回0表示从第一个素材返回
* @param int $count 返回素材的数量取值在1到20之间
* @param int $noContent 1 表示不返回 content 字段0 表示正常返回,默认为 0
* @param int $offset 起始位置
* @param int $count 拉取数量 1-20
* @param int $noContent 1 不返回 content0 返回
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -18,8 +18,7 @@ namespace WeChat\Exceptions;
/**
* 接口参数异常
* Class InvalidArgumentException
* @package WeChat
* @package WeChat\Exceptions
*/
class InvalidArgumentException extends \InvalidArgumentException
{

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -18,8 +18,7 @@ namespace WeChat\Exceptions;
/**
* 加密解密异常
* Class InvalidResponseException
* @package WeChat
* @package WeChat\Exceptions
*/
class InvalidDecryptException extends \Exception
{

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -18,7 +18,6 @@ namespace WeChat\Exceptions;
/**
* 加载类异常
* Class InvalidInstanceException
* @package WeChat\Exceptions
*/
class InvalidInstanceException extends \Exception

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -18,8 +18,7 @@ namespace WeChat\Exceptions;
/**
* 返回异常
* Class InvalidResponseException
* @package WeChat
* @package WeChat\Exceptions
*/
class InvalidResponseException extends \Exception
{

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -18,8 +18,7 @@ namespace WeChat\Exceptions;
/***
* 本地缓存异常
* Class LocalCacheException
* @package WeChat
* @package WeChat\Exceptions
*/
class LocalCacheException extends \Exception
{

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,17 +20,15 @@ use WeChat\Contracts\BasicWeChat;
/**
* 发布能力
* Class Freepublish
* @author taoxin
* @package WeChat
*/
class Freepublish extends BasicWeChat
{
/**
* 发布接口
* 开发者需要先将图文素材以草稿的形式保存(见“草稿箱/新建草稿”,如需从已保存的草稿中选择,见“草稿箱/获取草稿列表”)
* @param mixed $mediaId 选择要发布的草稿的media_id
* @return array
* 提交发布
* @param string $mediaId 草稿 media_id
* @return array publish_id
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -41,8 +39,8 @@ class Freepublish extends BasicWeChat
}
/**
* 发布状态轮询接口
* @param mixed $publishId
* 查询发布状态
* @param string $publishId 发布任务 ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -54,10 +52,9 @@ class Freepublish extends BasicWeChat
}
/**
* 删除发布
* 发布成功之后,随时可以通过该接口删除。此操作不可逆,请谨慎操作。
* @param mixed $articleId 成功发布时返回的 article_id
* @param int $index 要删除的文章在图文消息中的位置第一篇编号为1该字段不填或填0会删除全部文章
* 删除已发布文章
* @param string $articleId 发布返回的 article_id
* @param int $index 图文序号1 开始0 删除全部
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -69,8 +66,8 @@ class Freepublish extends BasicWeChat
}
/**
* 通过 article_id 获取已发布文章
* @param mixed $articleId 要获取的草稿的article_id
* 获取已发布文章
* @param string $articleId article_id
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -82,10 +79,10 @@ class Freepublish extends BasicWeChat
}
/**
* 获取成功发布列表
* @param int $offset 从全部素材的该偏移位置开始返回0表示从第一个素材返回
* @param int $count 返回素材的数量取值在1到20之间
* @param int $noContent 1 表示不返回 content 字段0 表示正常返回,默认为 0
* 获取发布列表
* @param int $offset 起始偏移
* @param int $count 数量 1-20
* @param int $noContent 1 不返回 content
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 接口调用频次限制
* Class Limit
* @package WeChat
*/
class Limit extends BasicWeChat
{
/**
* 公众号调用或第三方平台帮公众号调用对公众号的所有api调用包括第三方帮其调用次数进行清零
* 清空公众号 API 调用次数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -40,8 +39,8 @@ class Limit extends BasicWeChat
/**
* 网络检测
* @param string $action 执行的检测动作
* @param string $operator 指定平台从某个运营商进行检测
* @param string $action ping|dns|all
* @param string $operator DEFAULT|CT|CU|CM
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -53,7 +52,7 @@ class Limit extends BasicWeChat
}
/**
* 获取微信服务器IP地址
* 获取微信服务器 IP
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -22,16 +22,15 @@ use WeChat\Exceptions\InvalidResponseException;
/**
* 微信素材管理
* Class Media
* @package WeChat
*/
class Media extends BasicWeChat
{
/**
* 新增临时素材
* @param string $filename 文件名称
* @param string $type 媒体文件类型(image|voice|video|thumb)
* @return array
* @param string $filename 本地文件路径
* @param string $type 媒体类型 image|voice|video|thumb
* @return array 上传结果media_id 等)
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -46,8 +45,8 @@ class Media extends BasicWeChat
/**
* 获取临时素材
* @param string $media_id
* @param string $outType 返回处理函数
* @param string $media_id 媒体 ID
* @param string $outType 可选:回调处理或 'url' 仅返回 URL
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -69,8 +68,8 @@ class Media extends BasicWeChat
}
/**
* 新增图文素材
* @param array $data 文件名称
* 新增永久图文素材
* @param array $data 图文列表 articles
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -83,8 +82,8 @@ class Media extends BasicWeChat
/**
* 更新图文素材
* @param string $media_id 要修改的图文消息的id
* @param int $index 要更新的文章在图文消息中的位置多图文消息时此字段才有意义第一篇为0
* @param string $media_id 图文 media_id
* @param int $index 文章位置0 开始)
* @param array $news 文章内容
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
@ -97,9 +96,9 @@ class Media extends BasicWeChat
}
/**
* 上传图文消息内的图片获取URL
* @param mixed $filename
* @return array
* 上传图文消息内的图片获取 URL
* @param string $filename 本地文件
* @return array url
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -111,9 +110,9 @@ class Media extends BasicWeChat
/**
* 新增其他类型永久素材
* @param mixed $filename 文件名称
* @param string $type 媒体文件类型(image|voice|video|thumb)
* @param array $description 包含素材的描述信息
* @param string $filename 本地文件路径
* @param string $type 媒体类型 image|voice|video|thumb
* @param array $description 视频描述等
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -129,8 +128,8 @@ class Media extends BasicWeChat
/**
* 获取永久素材
* @param string $media_id
* @param null|string $outType 输出类型
* @param string $media_id 媒体 ID
* @param null|string $outType 回调处理或 'url' 返回地址
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -153,7 +152,7 @@ class Media extends BasicWeChat
/**
* 删除永久素材
* @param string $mediaId
* @param string $mediaId 媒体 ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -178,9 +177,9 @@ class Media extends BasicWeChat
/**
* 获取素材列表
* @param string $type
* @param int $offset
* @param int $count
* @param string $type image|voice|video|news
* @param int $offset 起始位置
* @param int $count 拉取数量
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,15 +20,14 @@ use WeChat\Contracts\BasicWeChat;
/**
* 微信菜单管理
* Class Menu
* @package WeChat
*/
class Menu extends BasicWeChat
{
/**
* 自定义菜单查询接口
* @return array
* 查询自定义菜单接口
* @return array 菜单配置信息
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -39,8 +38,8 @@ class Menu extends BasicWeChat
}
/**
* 自定义菜单删除接口
* @return array
* 删除自定义菜单接口
* @return array 操作结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -51,9 +50,9 @@ class Menu extends BasicWeChat
}
/**
* 自定义菜单创建
* @param array $data
* @return array
* 创建自定义菜单接口
* @param array $data 菜单配置button数组最多3个一级菜单每个一级菜单最多5个二级菜单
* @return array 操作结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -64,9 +63,9 @@ class Menu extends BasicWeChat
}
/**
* 创建个性化菜单
* @param array $data
* @return array
* 创建个性化菜单接口
* @param array $data 菜单配置button数组和matchrule匹配规则
* @return array 返回menuid
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -77,9 +76,9 @@ class Menu extends BasicWeChat
}
/**
* 删除个性化菜单
* @param string $menuid
* @return array
* 删除个性化菜单接口
* @param string $menuid 菜单ID
* @return array 操作结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -90,9 +89,9 @@ class Menu extends BasicWeChat
}
/**
* 测试个性化菜单匹配结果
* @param string $openid
* @return array
* 测试个性化菜单匹配结果接口
* @param string $openid 用户openid
* @return array 该用户匹配的菜单配置
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,18 +20,17 @@ use WeChat\Contracts\BasicWeChat;
/**
* 微信网页授权
* Class Oauth
* @package WeChat
*/
class Oauth extends BasicWeChat
{
/**
* Oauth 授权跳转接口
* @param string $redirect_url 授权回跳地址
* @param string $state 为重定向后会带上state参数填写a-zA-Z0-9的参数值最多128字节)
* @param string $scope 授权类类型(可选值snsapi_base|snsapi_userinfo)
* @return string
* 构造网页授权跳转链接
* @param string $redirect_url 回调地址
* @param string $state 自定义状态(<=128 字节)
* @param string $scope snsapi_base|snsapi_userinfo
* @return string 跳转 URL
*/
public function getOauthRedirect($redirect_url, $state = '', $scope = 'snsapi_base')
{
@ -41,8 +40,8 @@ class Oauth extends BasicWeChat
}
/**
* 通过 code 获取 AccessToken openid
* @param string $code 授权Code值不传则取GET参数
* 通过 code 换取 access_token/refresh_token/openid
* @param string $code 授权 code不传则取 GET 参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -57,8 +56,8 @@ class Oauth extends BasicWeChat
}
/**
* 刷新AccessToken并续期
* @param string $refresh_token
* 刷新网页授权 access_token
* @param string $refresh_token 刷新 token
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -71,9 +70,9 @@ class Oauth extends BasicWeChat
}
/**
* 检验授权凭证access_token是否有效
* @param string $accessToken 网页授权接口调用凭证,注意此access_token与基础支持的access_token不同
* @param string $openid 用户的唯一标识
* 校验网页授权 access_token 是否有效
* @param string $accessToken 网页授权 access_token
* @param string $openid 用户 openid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -85,10 +84,10 @@ class Oauth extends BasicWeChat
}
/**
* 拉取用户信息(需scope为 snsapi_userinfo)
* @param string $accessToken 网页授权接口调用凭证,注意此access_token与基础支持的access_token不同
* @param string $openid 用户的唯一标识
* @param string $lang 返回国家地区语言版本zh_CN 简体zh_TW 繁体en 英语
* 拉取用户信息snsapi_userinfo
* @param string $accessToken 网页授权 access_token
* @param string $openid 用户 openid
* @param string $lang zh_CN|zh_TW|en
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -24,8 +24,7 @@ use WePay\Transfers;
use WePay\TransfersBank;
/**
* 微信支付商户
* Class Pay
* 微信支付商户聚合入口V2
* @package WeChat\Contracts
*/
class Pay extends BasicWePay
@ -33,8 +32,8 @@ class Pay extends BasicWePay
/**
* 统一下单
* @param array $options
* @return array
* @param array $options 下单参数out_trade_no, body, total_fee, notify_url, trade_type 等)
* @return array 预支付信息
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -44,8 +43,8 @@ class Pay extends BasicWePay
}
/**
* 刷卡支付
* @param array $options
* 刷卡支付(被扫)
* @param array $options 支付参数auth_code, out_trade_no, total_fee 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -56,9 +55,9 @@ class Pay extends BasicWePay
}
/**
* 创建JsApi及H5支付参数
* @param string $prepay_id 统一下单预支付码
* @return array
* 生成 JSAPI/H5 支付参数
* @param string $prepay_id 统一下单返回的 prepay_id
* @return array 前端调起参数
*/
public function createParamsForJsApi($prepay_id)
{
@ -66,9 +65,9 @@ class Pay extends BasicWePay
}
/**
* 获取APP支付参数
* @param string $prepay_id 统一下单预支付码
* @return array
* 生成 APP 支付参数
* @param string $prepay_id 统一下单返回的 prepay_id
* @return array APP 支付参数
*/
public function createParamsForApp($prepay_id)
{
@ -76,8 +75,8 @@ class Pay extends BasicWePay
}
/**
* 获取支付规则二维码
* @param string $product_id 户定义的商品id 或者订单号
* 生成 Native 支付二维码 URL
* @param string $product_id ID 订单号
* @return string
*/
public function createParamsForRuleQrc($product_id)
@ -87,8 +86,8 @@ class Pay extends BasicWePay
/**
* 查询订单
* @param array $options
* @return array
* @param array $options 查询参数transaction_id out_trade_no
* @return array 订单详情
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -111,7 +110,7 @@ class Pay extends BasicWePay
/**
* 申请退款
* @param array $options
* @param array $options 退款参数out_trade_no/transaction_idout_refund_nototal_feerefund_fee 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -123,7 +122,7 @@ class Pay extends BasicWePay
/**
* 查询退款
* @param array $options
* @param array $options 查询参数transaction_id/out_trade_no/out_refund_no/refund_id 四选一)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -134,8 +133,8 @@ class Pay extends BasicWePay
}
/**
* 交易保障
* @param array $options
* 交易保障上报
* @param array $options 上报参数interface_url, execute_time, return_code 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -146,9 +145,9 @@ class Pay extends BasicWePay
}
/**
* 授权码查询openid
* @param string $authCode 扫码支付授权码,设备读取用户微信中的条码或者二维码信息
* @return array
* 授权码查询 openid
* @param string $authCode 扫码支付授权码
* @return array openid
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -159,8 +158,8 @@ class Pay extends BasicWePay
/**
* 下载对账单
* @param array $options 静音参数
* @param null|string $outType 输出类型
* @param array $options 账单参数bill_date, bill_type 等)
* @param null|string $outType 输出处理回调,为 null 返回原始内容
* @return bool|string
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -171,8 +170,8 @@ class Pay extends BasicWePay
}
/**
* 拉取订单评价数据
* @param array $options
* 拉取订单评价数据(需证书)
* @param array $options 查询参数bill_date, offset, limit 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -184,7 +183,7 @@ class Pay extends BasicWePay
/**
* 企业付款到零钱
* @param array $options
* @param array $options 付款参数partner_trade_no, openid, amount, desc 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -196,7 +195,7 @@ class Pay extends BasicWePay
/**
* 查询企业付款到零钱
* @param string $partner_trade_no 商户调用企业付款API时使用的商户订单号
* @param string $partner_trade_no 商户付款单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -208,7 +207,7 @@ class Pay extends BasicWePay
/**
* 企业付款到银行卡
* @param array $options
* @param array $options 付款参数partner_trade_no, enc_bank_no, enc_true_name, bank_code, amount 等)
* @return array
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
@ -220,8 +219,8 @@ class Pay extends BasicWePay
}
/**
* 商户企业付款到银行卡操作进行结果查询
* @param string $partner_trade_no 商户订单号,需保持唯一
* 查询企业付款到银行卡结果
* @param string $partner_trade_no 商户付款单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,7 +20,6 @@ use WeChat\Contracts\BasicWeChat;
/**
* 商店管理
* Class Product
* @package WeChat
*/
class Product extends BasicWeChat
@ -29,7 +28,7 @@ class Product extends BasicWeChat
* 提交审核/取消发布商品
* @param string $keystandard 商品编码标准
* @param string $keystr 商品编码内容
* @param string $status 设置发布状态。on为提交审核off为取消发布
* @param string $status on 提交审核 | off 取消发布
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -43,8 +42,8 @@ class Product extends BasicWeChat
/**
* 设置测试人员白名单
* @param array $openids 测试人员的openid列表
* @param array $usernames 测试人员的微信号列表
* @param array $openids openid 列表
* @param array $usernames 微信号列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -57,10 +56,10 @@ class Product extends BasicWeChat
/**
* 获取商品二维码
* @param string $keystandard 商品编码标准
* @param string $keystr 商品编码内容
* @param integer $qrcode_size 二维码的尺寸(整型),数值代表边长像素不填写默认值为100
* @param array $extinfo 由商户自定义传入,建议仅使用大小写字母、数字及-_().*这6个常用字符
* @param string $keystandard 编码标准
* @param string $keystr 编码内容
* @param int $qrcode_size 边长像素默认100
* @param array $extinfo 自定义扩展
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -91,10 +90,10 @@ class Product extends BasicWeChat
/**
* 批量查询商品信息
* @param integer $offset 批量查询的起始位置从0开始包含该起始位置
* @param integer $limit 批量查询的数量
* @param null|string $status 支持按状态拉取。on为发布状态off为未发布状态check为审核中状态reject为审核未通过状态all为所有状态
* @param string $keystr 支持按部分编码内容拉取。填写该参数后,可将编码内容中包含所传参数的商品信息拉出。类似关键词搜索
* @param int $offset 起始位置
* @param int $limit 数量
* @param null|string $status on|off|check|reject|all
* @param string $keystr 模糊编码过滤
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -110,7 +109,7 @@ class Product extends BasicWeChat
/**
* 更新商品信息
* @param array $data
* @param array $data 商品数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -136,7 +135,7 @@ class Product extends BasicWeChat
}
/**
* 检查wxticket参数
* 检查 wxticket 参数
* @param string $ticket
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
@ -152,7 +151,7 @@ class Product extends BasicWeChat
* 清除扫码记录
* @param string $keystandard 商品编码标准
* @param string $keystr 商品编码内容
* @param string $extinfo 调用“获取商品二维码接口”传入的extinfo,为标识参数
* @param string $extinfo 获取二维码时的 extinfo
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -5,7 +5,6 @@ namespace WeChat\Prpcrypt;
/**
* 仅用作类内部使用
* 不用于官方API接口的errCode码
* Class ErrorCode
*/
class ErrorCode
{

View File

@ -4,7 +4,6 @@ namespace WeChat\Prpcrypt;
/**
* PKCS7算法 - 加解密
* Class PKCS7Encoder
*/
class PKCS7Encoder
{

View File

@ -16,7 +16,6 @@ namespace WeChat\Prpcrypt;
/**
* 公众号消息 - 加解密
* Class Prpcrypt
*/
class Prpcrypt
{
@ -52,6 +51,21 @@ class Prpcrypt
}
}
/**
* 随机生成16位字符串
* @param string $str
* @return string 生成的字符串
*/
function getRandomStr($str = "")
{
$str_pol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
$max = strlen($str_pol) - 1;
for ($i = 0; $i < 16; $i++) {
$str .= $str_pol[mt_rand(0, $max)];
}
return $str;
}
/**
* 对密文进行解密
* @param string $encrypted 需要解密的密文
@ -80,19 +94,4 @@ class Prpcrypt
}
}
/**
* 随机生成16位字符串
* @param string $str
* @return string 生成的字符串
*/
function getRandomStr($str = "")
{
$str_pol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
$max = strlen($str_pol) - 1;
for ($i = 0; $i < 16; $i++) {
$str .= $str_pol[mt_rand(0, $max)];
}
return $str;
}
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,17 +20,16 @@ use WeChat\Contracts\BasicWeChat;
/**
* 二维码管理
* Class Qrcode
* @package WeChat
*/
class Qrcode extends BasicWeChat
{
/**
* 创建二维码ticket
* @param string|integer $scene 场景
* @param int $expire_seconds 有效时间
* @return array
* 创建二维码 ticket
* @param string|int $scene 场景值(字符串或数字)
* @param int $expire_seconds 过期时间0 表示永久
* @return array ticket、url
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -52,9 +51,9 @@ class Qrcode extends BasicWeChat
}
/**
* 通过ticket换取二维码
* @param string $ticket 获取的二维码ticket凭借此ticket可以在有效时间内换取二维码。
* @return string
* 通过 ticket 换取二维码 URL
* @param string $ticket 二维码 ticket
* @return string 图片 URL
*/
public function url($ticket)
{
@ -62,8 +61,8 @@ class Qrcode extends BasicWeChat
}
/**
* 长链接转短链接接口
* @param string $longUrl 需要转换的长链接
* 长链接转短链接
* @param string $longUrl 长链接
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,15 +20,14 @@ use WeChat\Contracts\BasicPushEvent;
/**
* 公众号推送管理
* Class Receive
* @package WeChat
*/
class Receive extends BasicPushEvent
{
/**
* 转发多客服消息
* @param string $account
* 转发多客服
* @param string $account 可选客服账号
* @return $this
*/
public function transferCustomerService($account = '')
@ -61,8 +60,8 @@ class Receive extends BasicPushEvent
}
/**
* 设置回复图文
* @param array $newsData
* 设置图文消息
* @param array $newsData Articles 列表
* @return $this
*/
public function news($newsData = [])
@ -80,7 +79,7 @@ class Receive extends BasicPushEvent
/**
* 设置图片消息
* @param string $mediaId 图片媒体ID
* @param string $mediaId 图片 media_id
* @return $this
*/
public function image($mediaId = '')
@ -96,8 +95,8 @@ class Receive extends BasicPushEvent
}
/**
* 设置语音回复消息
* @param string $mediaid 语音媒体ID
* 设置语音消息
* @param string $mediaid 语音 media_id
* @return $this
*/
public function voice($mediaid = '')
@ -113,10 +112,10 @@ class Receive extends BasicPushEvent
}
/**
* 设置视频回复消息
* @param string $mediaid 视频媒体ID
* @param string $title 视频标题
* @param string $description 视频描述
* 设置视频消息
* @param string $mediaid 视频 media_id
* @param string $title 标题
* @param string $description 描述
* @return $this
*/
public function video($mediaid = '', $title = '', $description = '')
@ -136,12 +135,12 @@ class Receive extends BasicPushEvent
}
/**
* 设置音乐回复消息
* @param string $title 音乐标题
* @param string $desc 音乐描述
* @param string $musicurl 音乐地址
* @param string $hgmusicurl 高清音乐地址
* @param string $thumbmediaid 音乐图片缩略图的媒体id可选
* 设置音乐消息
* @param string $title 标题
* @param string $desc 描述
* @param string $musicurl 音乐链接
* @param string $hgmusicurl 高清链接
* @param string $thumbmediaid 缩略图 media_id
* @return $this
*/
public function music($title, $desc, $musicurl, $hgmusicurl = '', $thumbmediaid = '')

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,7 +20,6 @@ use WeChat\Contracts\BasicWeChat;
/**
* 扫一扫接入管理
* Class Scan
* @package WeChat
*/
class Scan extends BasicWeChat
@ -39,7 +38,7 @@ class Scan extends BasicWeChat
/**
* 创建商品
* @param array $data
* @param array $data 商品数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -51,10 +50,10 @@ class Scan extends BasicWeChat
}
/**
* 商品发布
* 商品发布/取消
* @param string $keystandard 商品编码标准
* @param string $keystr 商品编码内容
* @param string $status 设置发布状态。on为提交审核off为取消发布
* @param string $status on 提交审核 | off 取消
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -68,8 +67,8 @@ class Scan extends BasicWeChat
/**
* 设置测试人员白名单
* @param array $openids 测试人员的openid列表
* @param array $usernames 测试人员的微信号列表
* @param array $openids openid 列表
* @param array $usernames 微信号列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -82,10 +81,10 @@ class Scan extends BasicWeChat
/**
* 获取商品二维码
* @param string $keystandard
* @param string $keystr
* @param null|string $extinfo
* @param integer $qrcode_size
* @param string $keystandard 编码标准
* @param string $keystr 编码内容
* @param null|string $extinfo 自定义标识
* @param int $qrcode_size 边长像素
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -114,10 +113,10 @@ class Scan extends BasicWeChat
/**
* 批量查询商品信息
* @param integer $offset 批量查询的起始位置从0开始包含该起始位置。
* @param integer $limit 批量查询的数量
* @param string $status 支持按状态拉取。on为发布状态off为未发布状态check为审核中状态reject为审核未通过状态all为所有状态。
* @param string $keystr 支持按部分编码内容拉取。填写该参数后,可将编码内容中包含所传参数的商品信息拉出。类似关键词搜索。
* @param int $offset 起始位置
* @param int $limit 数量
* @param string $status on|off|check|reject|all
* @param string $keystr 关键词过滤
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -133,7 +132,7 @@ class Scan extends BasicWeChat
/**
* 更新商品信息
* @param array $data
* @param array $data 商品数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -159,7 +158,7 @@ class Scan extends BasicWeChat
}
/**
* 检查wxticket参数
* 检查 wxticket 参数
* @param string $ticket
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
@ -175,7 +174,7 @@ class Scan extends BasicWeChat
* 清除扫码记录
* @param string $keystandard 商品编码标准
* @param string $keystr 商品编码内容
* @param string $extinfo 调用“获取商品二维码接口传入的extinfo,为标识参数
* @param string $extinfo 二维码接口时的 extinfo
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -22,7 +22,6 @@ use WeChat\Exceptions\InvalidResponseException;
/**
* 微信前端支持
* Class Script
* @package WeChat
*/
class Script extends BasicWeChat
@ -42,37 +41,11 @@ class Script extends BasicWeChat
}
/**
* 获取JSAPI_TICKET接口
* @param string $type TICKET类型(wx_card|jsapi)
* @param string $appid 强制指定有效APPID
* @return string
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getTicket($type = 'jsapi', $appid = null)
{
is_null($appid) && $appid = $this->config->get('appid');
$cache_name = "{$appid}_ticket_{$type}";
$ticket = Tools::getCache($cache_name);
if (empty($ticket)) {
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type={$type}";
$this->registerApi($url, __FUNCTION__, func_get_args());
$result = $this->httpGetForJson($url);
if (empty($result['ticket'])) {
throw new InvalidResponseException('Invalid Resoponse Ticket.', '0');
}
$ticket = $result['ticket'];
Tools::setCache($cache_name, $ticket, 7000);
}
return $ticket;
}
/**
* 获取JsApi使用签名
* @param string $url 网页的URL
* @param string $appid 用于多个appid时使用(可空)
* @param string $ticket 强制指定ticket
* @param array $jsApiList 需初始化的 jsApiList
* 获取 JSAPI 签名
* @param string $url 当前页面 URL不含 #
* @param string $appid 可选指定 appid
* @param string $ticket 可选指定 ticket
* @param array $jsApiList 需注入的 API 列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -100,12 +73,38 @@ class Script extends BasicWeChat
];
}
/**
* 获取 JSAPI_TICKET
* @param string $type jsapi|wx_card
* @param string $appid 可选指定 appid
* @return string ticket
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getTicket($type = 'jsapi', $appid = null)
{
is_null($appid) && $appid = $this->config->get('appid');
$cache_name = "{$appid}_ticket_{$type}";
$ticket = Tools::getCache($cache_name);
if (empty($ticket)) {
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type={$type}";
$this->registerApi($url, __FUNCTION__, func_get_args());
$result = $this->httpGetForJson($url);
if (empty($result['ticket'])) {
throw new InvalidResponseException('Invalid Resoponse Ticket.', '0');
}
$ticket = $result['ticket'];
Tools::setCache($cache_name, $ticket, 7000);
}
return $ticket;
}
/**
* 数据生成签名
* @param array $data 签名数组
* @param array $data 待签名数据
* @param string $method 签名方法
* @param array $params 签名参数
* @return bool|string 签名值
* @param array $params 额外参数
* @return bool|string
*/
protected function getSignature($data, $method = "sha1", $params = [])
{

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -21,14 +21,13 @@ use WeChat\Contracts\Tools;
/**
* 揺一揺周边
* Class Shake
* @package WeChat
*/
class Shake extends BasicWeChat
{
/**
* 申请开通功能
* @param array $data
* 申请开通摇一摇
* @param array $data 资质信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -52,11 +51,11 @@ class Shake extends BasicWeChat
}
/**
* 申请设备ID
* @param string $quantity 申请的设备ID的数量单次新增设备超过500个需走人工审核流程
* @param string $apply_reason 申请理由不超过100个汉字或200个英文字母
* @param null|string $comment 备注不超过15个汉字或30个英文字母
* @param null|string $poi_id 设备关联的门店ID关联门店后在门店1KM的范围内有优先摇出信息的机会。
* 申请设备 ID
* @param string $quantity 数量(>500 走人工审核)
* @param string $apply_reason 理由
* @param null|string $comment 备注
* @param null|string $poi_id 门店ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -71,8 +70,8 @@ class Shake extends BasicWeChat
}
/**
* 查询设备ID申请审核状态
* @param integer $applyId 批次ID申请设备ID时所返回的批次ID
* 查询设备 ID 申请状态
* @param int $applyId 批次ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -85,7 +84,7 @@ class Shake extends BasicWeChat
/**
* 编辑设备信息
* @param array $data
* @param array $data 设备参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -97,8 +96,8 @@ class Shake extends BasicWeChat
}
/**
* 配置设备与门店的关联关系
* @param array $data
* 设备绑定门店
* @param array $data 绑定参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -111,7 +110,7 @@ class Shake extends BasicWeChat
/**
* 查询设备列表
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -123,8 +122,8 @@ class Shake extends BasicWeChat
}
/**
* 页面管理
* @param array $data
* 创建页面
* @param array $data 页面参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -136,8 +135,8 @@ class Shake extends BasicWeChat
}
/**
* 编辑页面信息
* @param array $data
* 编辑页面
* @param array $data 页面参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -150,7 +149,7 @@ class Shake extends BasicWeChat
/**
* 查询页面列表
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -163,7 +162,7 @@ class Shake extends BasicWeChat
/**
* 删除页面
* @param integer $pageId 指定页面的id
* @param int $pageId 页面ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -176,8 +175,8 @@ class Shake extends BasicWeChat
/**
* 上传图片素材
* @param string $filename 图片名字
* @param string $type Icon摇一摇页面展示的icon图License申请开通摇一摇周边功能时需上传的资质文件若不传type则默认type=icon
* @param string $filename 图片路径
* @param string $type icon|license
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -189,8 +188,8 @@ class Shake extends BasicWeChat
}
/**
* 配置设备与页面关联关系
* @param array $data
* 配置设备与页面关联
* @param array $data 关联参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -202,8 +201,8 @@ class Shake extends BasicWeChat
}
/**
* 查询设备与页面关联关系
* @param array $data
* 查询设备与页面关联
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -215,8 +214,8 @@ class Shake extends BasicWeChat
}
/**
* 设备维度数据统计接口
* @param array $data
* 设备维度数据统计
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -228,9 +227,9 @@ class Shake extends BasicWeChat
}
/**
* 批量查询设备统计数据接口
* @param integer $date 指定查询日期时间戳,单位为秒
* @param integer $pageIndex 指定查询的结果页序号返回结果按摇周边人数降序排序每50条记录为一页
* 批量查询设备统计
* @param int $date 日期时间戳(秒)
* @param int $pageIndex 页码
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -242,10 +241,10 @@ class Shake extends BasicWeChat
}
/**
* 页面维度数据统计接口
* @param integer $pageId 指定页面的设备ID
* @param integer $beginDate 起始日期时间戳最长时间跨度为30天单位为秒
* @param integer $endDate 结束日期时间戳最长时间跨度为30天单位为秒
* 页面维度数据统计
* @param int $pageId 页面ID
* @param int $beginDate 起始时间戳
* @param int $endDate 结束时间戳
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -258,8 +257,8 @@ class Shake extends BasicWeChat
/**
* 编辑分组信息
* @param integer $groupId 分组唯一标识,全局唯一
* @param string $groupName 分组名称不超过100汉字或200个英文字母
* @param int $groupId 分组ID
* @param string $groupName 分组名称
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -272,7 +271,7 @@ class Shake extends BasicWeChat
/**
* 删除分组
* @param integer $groupId 分组唯一标识,全局唯一
* @param int $groupId 分组ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -285,8 +284,8 @@ class Shake extends BasicWeChat
/**
* 查询分组列表
* @param integer $begin 分组列表的起始索引
* @param integer $count 待查询的分组数量不能超过1000个
* @param int $begin 起始索引
* @param int $count 数量(<=1000
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -300,9 +299,9 @@ class Shake extends BasicWeChat
/**
* 查询分组详情
* @param integer $group_id 分组唯一标识,全局唯一
* @param integer $begin 分组里设备起始索引
* @param integer $count 待查询的分组里设备的数量不能超过1000个
* @param int $group_id 分组ID
* @param int $begin 设备起始索引
* @param int $count 数量(<=1000
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -314,8 +313,8 @@ class Shake extends BasicWeChat
}
/**
* 添加设备到分组
* @param array $data
* 分组添加设备
* @param array $data 设备参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -327,8 +326,8 @@ class Shake extends BasicWeChat
}
/**
* 分组移除设备
* @param array $data
* 分组移除设备
* @param array $data 设备参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,13 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 用户标签管理
* Class Tags
* @package WeChat
*/
class Tags extends BasicWeChat
{
/**
* 获取粉丝标签列表
* 获取标签列表
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
*/
@ -37,8 +37,8 @@ class Tags extends BasicWeChat
}
/**
* 创建粉丝标签
* @param string $name
* 创建标签
* @param string $name 标签名称
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -50,8 +50,8 @@ class Tags extends BasicWeChat
}
/**
* 更新粉丝标签
* @param integer $id 标签ID
* 更新标签
* @param int $id 标签ID
* @param string $name 标签名称
* @return array
* @throws Exceptions\InvalidResponseException
@ -64,8 +64,8 @@ class Tags extends BasicWeChat
}
/**
* 删除粉丝标签
* @param int $tagId
* 删除标签
* @param int $tagId 标签ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -78,8 +78,8 @@ class Tags extends BasicWeChat
/**
* 批量为用户打标签
* @param array $openids
* @param integer $tagId
* @param array $openids openid 列表
* @param int $tagId 标签ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -91,9 +91,9 @@ class Tags extends BasicWeChat
}
/**
* 批量为用户取消标签
* @param array $openids
* @param integer $tagId
* 批量取消用户标签
* @param array $openids openid 列表
* @param int $tagId 标签ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -105,8 +105,8 @@ class Tags extends BasicWeChat
}
/**
* 获取用户身上的标签列表
* @param string $openid
* 获取用户标签列表
* @param string $openid 用户 openid
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,15 +20,14 @@ use WeChat\Contracts\BasicWeChat;
/**
* 模板消息
* Class Template
* @package WeChat
*/
class Template extends BasicWeChat
{
/**
* 设置所属行业
* @param string $industryId1 公众号模板消息所属行业编号
* @param string $industryId2 公众号模板消息所属行业编号
* 设置模板消息所属行业
* @param string $industryId1 行业编号
* @param string $industryId2 行业编号
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -40,7 +39,7 @@ class Template extends BasicWeChat
}
/**
* 获取设置的行业信息
* 获取设置的行业信息
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -52,9 +51,9 @@ class Template extends BasicWeChat
}
/**
* 获得模板ID
* @param string $templateIdShort 板库中模板的编号有“TM**”和“OPENTMTM**”等形式
* @param array $keywordNameList 选用的类目模板的关键词
* 领取模板 ID
* @param string $templateIdShort 模板编号(如 TM** OPENTMTM**
* @param array $keywordNameList 选用关键词
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -66,7 +65,7 @@ class Template extends BasicWeChat
}
/**
* 获取模板列表
* 获取私有模板列表
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -78,8 +77,8 @@ class Template extends BasicWeChat
}
/**
* 删除模板ID
* @param string $tplId 公众帐号下模板消息ID
* 删除模板
* @param string $tplId 模板 ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -92,7 +91,7 @@ class Template extends BasicWeChat
/**
* 发送模板消息
* @param array $data
* @param array $data 消息内容touser, template_id, data 等)
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,17 +20,16 @@ use WeChat\Contracts\BasicWeChat;
/**
* 微信粉丝管理
* Class User
* @package WeChat
*/
class User extends BasicWeChat
{
/**
* 设置用户备注名
* @param string $openid
* @param string $remark
* @return array
* 设置用户备注名接口
* @param string $openid 用户openid
* @param string $remark 备注名长度不超过30字符
* @return array 操作结果
* @throws Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -41,10 +40,10 @@ class User extends BasicWeChat
}
/**
* 获取用户基本信息包括UnionID机制
* @param string $openid
* @param string $lang
* @return array
* 获取用户基本信息接口包括UnionID
* @param string $openid 用户openid
* @param string $lang 返回国家地区语言版本zh_CN, zh_TW, en
* @return array 用户信息nickname, headimgurl, sex, province, city, country, unionid等
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
*/
@ -55,10 +54,10 @@ class User extends BasicWeChat
}
/**
* 批量获取用户基本信息
* @param array $openids
* @param string $lang
* @return array
* 批量获取用户基本信息接口
* @param array $openids 用户openid列表最多100个
* @param string $lang 返回国家地区语言版本
* @return array 用户信息列表
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
*/
@ -73,9 +72,9 @@ class User extends BasicWeChat
}
/**
* 获取用户列表
* @param string $next_openid
* @return array
* 获取用户列表接口
* @param string $next_openid 第一个拉取的openid不填默认从头开始拉取
* @return array 用户列表total, count, data.openid, next_openid
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
*/
@ -86,10 +85,10 @@ class User extends BasicWeChat
}
/**
* 获取标签下粉丝列表
* 获取标签下粉丝列表接口
* @param integer $tagid 标签ID
* @param string $nextOpenid 第一个拉取的OPENID
* @return array
* @param string $nextOpenid 第一个拉取的openid不填默认从头开始拉取
* @return array 粉丝列表count, data.openid, next_openid
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
*/
@ -100,9 +99,9 @@ class User extends BasicWeChat
}
/**
* 获取公众号黑名单列表
* @param string $beginOpenid
* @return array
* 获取公众号黑名单列表接口
* @param string $beginOpenid 第一个拉取的openid不填默认从头开始拉取
* @return array 黑名单列表total, count, data.openid, next_openid
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
*/
@ -113,9 +112,9 @@ class User extends BasicWeChat
}
/**
* 批量拉黑用户
* @param array $openids
* @return array
* 批量拉黑用户接口
* @param array $openids 用户openid列表最多20个
* @return array 操作结果
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
*/
@ -126,9 +125,9 @@ class User extends BasicWeChat
}
/**
* 批量取消拉黑用户
* @param array $openids
* @return array
* 批量取消拉黑用户接口
* @param array $openids 用户openid列表最多20个
* @return array 操作结果
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,7 +20,6 @@ use WeChat\Contracts\BasicWeChat;
/**
* 门店 WIFI 管理
* Class Wifi
* @package WeChat
*/
class Wifi extends BasicWeChat
@ -28,8 +27,8 @@ class Wifi extends BasicWeChat
/**
* 获取 Wi-Fi 门店列表
* @param integer $pageindex 分页下标默认从1开始
* @param integer $pagesize 每页的个数默认10个最大20个
* @param int $pageindex 页码从1开始
* @param int $pagesize 每页数量(<=20
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -42,8 +41,8 @@ class Wifi extends BasicWeChat
}
/**
* 查询门店Wi-Fi信息
* @param integer $shop_id 门店ID
* 查询门店 Wi-Fi 信息
* @param int $shop_id 门店ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -56,11 +55,11 @@ class Wifi extends BasicWeChat
}
/**
* 修改门店网络信息
* @param integer $shop_id 门店ID
* @param string $old_ssid 旧的无线网络设备的ssid
* @param string $ssid 的无线网络设备的ssid
* @param string $password 无线网络设备的密码(可选)
* 修改门店 Wi-Fi
* @param int $shop_id 门店ID
* @param string $old_ssid SSID
* @param string $ssid SSID
* @param string $password 可选密码
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -75,8 +74,8 @@ class Wifi extends BasicWeChat
}
/**
* 清空门店网络设备
* @param integer $shop_id
* 清空门店网络设备
* @param int $shop_id 门店ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -90,9 +89,9 @@ class Wifi extends BasicWeChat
/**
* 添加密码型设备
* @param integer $shop_id 门店ID
* @param string $ssid 无线网络设备的ssid
* @param null|string $password 无线网络设备的密码
* @param int $shop_id 门店ID
* @param string $ssid SSID
* @param null|string $password 密码
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -106,10 +105,10 @@ class Wifi extends BasicWeChat
}
/**
* 添加portal型设备
* @param integer $shop_id 门店ID
* @param string $ssid 无线网络设备的ssid
* @param bool $reset 重置secretkeyfalse-不重置true-重置默认为false
* 添加 portal 型设备
* @param int $shop_id 门店ID
* @param string $ssid SSID
* @param bool $reset 是否重置 secretkey
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -124,9 +123,9 @@ class Wifi extends BasicWeChat
/**
* 查询设备
* @param null|integer $shop_id 根据门店id查询
* @param null|integer $pageindex 分页下标默认从1开始
* @param null|integer $pagesize 每页的个数默认10个最大20个
* @param int|null $shop_id 门店ID
* @param int|null $pageindex 页码
* @param int|null $pagesize 数量
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -144,7 +143,7 @@ class Wifi extends BasicWeChat
/**
* 删除设备
* @param string $bssid 需要删除的无线网络设备无线mac地址格式冒号分隔字符长度17个并且字母小写例如00:1f:7a:ad:5c:a8
* @param string $bssid 设备 MAC冒号分隔小写
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -158,9 +157,9 @@ class Wifi extends BasicWeChat
/**
* 获取物料二维码
* @param integer $shop_id 门店ID
* @param string $ssid 已添加到门店下的无线网络名称
* @param integer $img_id 物料样式编号0-纯二维码可用于自由设计宣传材料1-二维码物料155mm×215mm(宽×高),可直接张贴
* @param int $shop_id 门店ID
* @param string $ssid SSID
* @param int $img_id 物料样式 0|1
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -174,9 +173,9 @@ class Wifi extends BasicWeChat
/**
* 设置商家主页
* @param integer $shop_id 门店ID
* @param integer $template_id 模板ID0-默认模板1-自定义url
* @param null|string $url 自定义链接当template_id为1时必填
* @param int $shop_id 门店ID
* @param int $template_id 0 默认 | 1 自定义链接
* @param null|string $url 自定义链接template_id=1 必填)
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -184,7 +183,7 @@ class Wifi extends BasicWeChat
public function setHomePage($shop_id, $template_id, $url = null)
{
$data = ['shop_id' => $shop_id, 'template_id' => $template_id];
is_null($url) && $data['struct'] = ['url' => $url];
!is_null($url) && $data['struct'] = ['url' => $url];
$url = 'https://api.weixin.qq.com/bizwifi/homepage/set?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->httpPostForJson($url, $data);
@ -192,7 +191,7 @@ class Wifi extends BasicWeChat
/**
* 查询商家主页
* @param integer $shop_id 查询的门店id
* @param int $shop_id 门店ID
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -206,8 +205,8 @@ class Wifi extends BasicWeChat
/**
* 设置微信首页欢迎语
* @param integer $shop_id 门店ID
* @param integer $bar_type 微信首页欢迎语的文本内容0--欢迎光临+公众号名称1--欢迎光临+门店名称2--已连接+公众号名称+WiFi3--已连接+门店名称+Wi-Fi。
* @param int $shop_id 门店ID
* @param int $bar_type 0|1|2|3
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -221,8 +220,8 @@ class Wifi extends BasicWeChat
/**
* 设置连网完成页
* @param integer $shop_id 门店ID
* @param string $finishpage_url 连网完成页URL
* @param int $shop_id 门店ID
* @param string $finishpage_url 完成页 URL
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -236,9 +235,9 @@ class Wifi extends BasicWeChat
/**
* Wi-Fi 数据统计
* @param string $begin_date 起始日期时间格式yyyy-mm-dd最长时间跨度为30天
* @param string $end_date 结束日期时间戳格式yyyy-mm-dd最长时间跨度为30天
* @param integer $shop_id 门店ID搜索-1总统计
* @param string $begin_date 开始日期 yyyy-mm-dd
* @param string $end_date 结束日期 yyyy-mm-dd
* @param int $shop_id 门店ID-1 总统计
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -251,12 +250,12 @@ class Wifi extends BasicWeChat
}
/**
* 设置门店卡券投放信息
* @param integer $shop_id 门店ID可设置为0表示所有门店
* @param integer $card_id 卡券ID
* @param string $card_describe 卡券描述不能超过18个字符
* @param string $start_time 卡券投放开始时间(单位是秒)
* @param string $end_time 卡券投放结束时间(单位是秒) 注:不能超过卡券的有效期时间
* 设置门店卡券投放
* @param int $shop_id 门店ID0 表示全部
* @param int $card_id 卡券ID
* @param string $card_describe 描述(<=18 字符)
* @param string $start_time 开始时间戳
* @param string $end_time 结束时间戳
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException
@ -270,8 +269,8 @@ class Wifi extends BasicWeChat
}
/**
* 查询门店卡券投放信息
* @param integer $shop_id 门店ID可设置为0表示所有门店
* 查询门店卡券投放
* @param int $shop_id 门店ID0 表示全部
* @return array
* @throws Exceptions\InvalidResponseException
* @throws Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -24,50 +24,17 @@ use WXBizDataCrypt;
/**
* 数据加密处理
* Class Crypt
* 小程序数据加解密
* @package WeMini
*/
class Crypt extends BasicWeChat
{
/**
* 数据签名校验
* @param string $iv
* @param string $sessionKey
* @param string $encryptedData
* @return bool|array
*/
public function decode($iv, $sessionKey, $encryptedData)
{
require_once __DIR__ . DIRECTORY_SEPARATOR . 'crypt' . DIRECTORY_SEPARATOR . 'wxBizDataCrypt.php';
$pc = new WXBizDataCrypt($this->config->get('appid'), $sessionKey);
$errCode = $pc->decryptData($encryptedData, $iv, $data);
if ($errCode == 0) {
return json_decode($data, true);
}
return false;
}
/**
* 登录凭证校验
* @param string $code 登录时获取的 code
* @return array
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function session($code)
{
$appid = $this->config->get('appid');
$secret = $this->config->get('appsecret');
$url = "https://api.weixin.qq.com/sns/jscode2session?appid={$appid}&secret={$secret}&js_code={$code}&grant_type=authorization_code";
return json_decode(Tools::get($url), true);
}
/**
* 换取用户信息
* @param string $code 用户登录凭证(有效期五分钟)
* @param string $iv 加密算法的初始向量
* @param string $encryptedData 加密数据( encryptedData )
* 通过 code 解密用户信息
* @param string $code 登录凭证
* @param string $iv 初始向量
* @param string $encryptedData 加密数据
* @return array
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
@ -87,8 +54,41 @@ class Crypt extends BasicWeChat
}
/**
* 通过授权码换取手机号
* @param string $code
* code 换取 session_key
* @param string $code 登录 code
* @return array
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function session($code)
{
$appid = $this->config->get('appid');
$secret = $this->config->get('appsecret');
$url = "https://api.weixin.qq.com/sns/jscode2session?appid={$appid}&secret={$secret}&js_code={$code}&grant_type=authorization_code";
return json_decode(Tools::get($url), true);
}
/**
* 解密数据
* @param string $iv 初始向量
* @param string $sessionKey 会话密钥
* @param string $encryptedData 加密数据
* @return bool|array
*/
public function decode($iv, $sessionKey, $encryptedData)
{
require_once __DIR__ . DIRECTORY_SEPARATOR . 'crypt' . DIRECTORY_SEPARATOR . 'wxBizDataCrypt.php';
$pc = new WXBizDataCrypt($this->config->get('appid'), $sessionKey);
$data = '';
$errCode = $pc->decryptData($encryptedData, $iv, $data);
if ($errCode == 0) {
return json_decode($data, true);
}
return false;
}
/**
* 通过 code 获取手机号
* @param string $code 授权码
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -101,11 +101,11 @@ class Crypt extends BasicWeChat
}
/**
* 用户支付完成获取用户 UnionId
* @param string $openid 支付用户唯一标识
* 支付后获取用户 UnionId
* @param string $openid 用户 openid
* @param null|string $transaction_id 微信支付订单号
* @param null|string $mch_id 微信支付分配的商户号,和商户订单号配合使用
* @param null|string $out_trade_no 微信支付商户订单号,和商户号配合使用
* @param null|string $mch_id 商户号
* @param null|string $out_trade_no 商户订单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -113,9 +113,9 @@ class Crypt extends BasicWeChat
public function getPaidUnionId($openid, $transaction_id = null, $mch_id = null, $out_trade_no = null)
{
$url = "https://api.weixin.qq.com/wxa/getpaidunionid?access_token=ACCESS_TOKEN&openid={$openid}";
if (is_null($mch_id)) $url .= "&mch_id={$mch_id}";
if (is_null($out_trade_no)) $url .= "&out_trade_no={$out_trade_no}";
if (is_null($transaction_id)) $url .= "&transaction_id={$transaction_id}";
if (!is_null($mch_id)) $url .= "&mch_id={$mch_id}";
if (!is_null($out_trade_no)) $url .= "&out_trade_no={$out_trade_no}";
if (!is_null($transaction_id)) $url .= "&transaction_id={$transaction_id}";
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callGetApi($url);
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,12 +20,24 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序客服服务
* Class Custom
* @package WeMini
*/
class Custom extends BasicWeChat
{
/**
* 发送小程序客服消息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function sendCustomMessage($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN';
return $this->callPostApi($url, $data, true);
}
/**
* 创建商户
* @param array $data

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,15 +20,14 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序即时配送
* Class Delivery
* @package WeMini
*/
class Delivery extends BasicWeChat
{
/**
* 异常件退回商家商家确认收货接口
* @param array $data
* 异常件退回确认收货
* @param array $data 请求参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -40,8 +39,8 @@ class Delivery extends BasicWeChat
}
/**
* 下配送单接口
* @param array $data
* 下配送单
* @param array $data 订单信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -53,8 +52,8 @@ class Delivery extends BasicWeChat
}
/**
* 可以对待接单状态的订单加小费
* @param array $data
* 待接单订单加小费
* @param array $data 订单与小费信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -66,8 +65,8 @@ class Delivery extends BasicWeChat
}
/**
* 取消配送单接口
* @param array $data
* 取消配送单
* @param array $data 订单信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -79,8 +78,8 @@ class Delivery extends BasicWeChat
}
/**
* 获取已支持的配送公司列表接口
* @param array $data
* 获取配送公司列表
* @param array $data 请求参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -93,7 +92,7 @@ class Delivery extends BasicWeChat
/**
* 拉取已绑定账号
* @param array $data
* @param array $data 请求参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -105,8 +104,8 @@ class Delivery extends BasicWeChat
}
/**
* 拉取配送单信息
* @param array $data
* 查询配送单
* @param array $data 订单信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -118,8 +117,8 @@ class Delivery extends BasicWeChat
}
/**
* 模拟配送公司更新配送单状态
* @param array $data
* 模拟更新配送单状态
* @param array $data 模拟参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -131,8 +130,8 @@ class Delivery extends BasicWeChat
}
/**
* 预下配送接口
* @param array $data
* 预下
* @param array $data 订单信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -144,8 +143,8 @@ class Delivery extends BasicWeChat
}
/**
* 预取消配送单接口
* @param array $data
* 预取消配送单
* @param array $data 订单信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -158,7 +157,7 @@ class Delivery extends BasicWeChat
/**
* 重新下单
* @param array $data
* @param array $data 订单信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序导购助手
* Class Guide
* @package WeMini
*/
class Guide extends BasicWeChat
{
/**
* 服务号添加导购
* @param array $data
* 添加导购
* @param array $data 导购账号信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -39,8 +38,8 @@ class Guide extends BasicWeChat
}
/**
* 服务号删除导购
* @param array $data
* 删除导购
* @param array $data 导购账号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -52,8 +51,8 @@ class Guide extends BasicWeChat
}
/**
* 服务号获取导购信息
* @param array $data
* 获取导购信息
* @param array $data 导购账号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -65,7 +64,7 @@ class Guide extends BasicWeChat
}
/**
* 获取服务号的敏感词信息与自动回复信息
* 获取敏感词与自动回复配置
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -77,9 +76,9 @@ class Guide extends BasicWeChat
}
/**
* 服务号拉取导购列表
* @param integer $page
* @param integer $num
* 拉取导购列表
* @param int $page 页码
* @param int $num 数量
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -92,7 +91,7 @@ class Guide extends BasicWeChat
/**
* 获取导购聊天记录
* @param array $data
* @param array $data 查询条件
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -104,8 +103,8 @@ class Guide extends BasicWeChat
}
/**
* 获取导购快捷回复信息
* @param array $data
* 获取导购快捷回复
* @param array $data 导购信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -118,7 +117,7 @@ class Guide extends BasicWeChat
/**
* 生成导购二维码
* @param array $data
* @param array $data 导购信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -130,7 +129,8 @@ class Guide extends BasicWeChat
}
/**
* @param array $data
* 推送小程序路径菜单
* @param array $data 请求参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -142,8 +142,8 @@ class Guide extends BasicWeChat
}
/**
* 为服务号设置敏感词与自动回复
* @param array $data
* 设置敏感词与自动回复
* @param array $data 配置数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -155,8 +155,8 @@ class Guide extends BasicWeChat
}
/**
* 设置导购快捷回复信息
* @param array $data
* 设置导购快捷回复
* @param array $data 快捷回复数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -168,8 +168,8 @@ class Guide extends BasicWeChat
}
/**
* 更新导购昵称或头像
* @param array $data
* 更新导购昵称或头像
* @param array $data 导购信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -181,8 +181,8 @@ class Guide extends BasicWeChat
}
/**
* 添加展示标签信息
* @param array $data
* 添加展示标签
* @param array $data 标签数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -195,7 +195,7 @@ class Guide extends BasicWeChat
/**
* 为粉丝添加可查询标签
* @param array $data
* @param array $data 标签数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -208,7 +208,7 @@ class Guide extends BasicWeChat
/**
* 添加标签可选值
* @param array $data
* @param array $data 选项数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -221,7 +221,7 @@ class Guide extends BasicWeChat
/**
* 删除粉丝标签
* @param array $data
* @param array $data 标签数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -233,8 +233,8 @@ class Guide extends BasicWeChat
}
/**
* 查询展示标签信息
* @param array $data
* 查询展示标签
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -247,7 +247,7 @@ class Guide extends BasicWeChat
/**
* 查询粉丝标签
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -259,7 +259,7 @@ class Guide extends BasicWeChat
}
/**
* 查询标签可选值信息
* 查询标签可选值
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -271,8 +271,8 @@ class Guide extends BasicWeChat
}
/**
* 新建可查询标签类型,支持新建4类可查询标签
* @param array $data
* 新建可查询标签类型
* @param array $data 标签数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -284,8 +284,8 @@ class Guide extends BasicWeChat
}
/**
* 根据标签筛选粉丝
* @param array $data
* 标签筛选粉丝
* @param array $data 标签查询条件
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -298,8 +298,8 @@ class Guide extends BasicWeChat
}
/**
* 为服务号导购添加粉丝
* @param array $data
* 导购添加粉丝
* @param array $data 绑定数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -312,8 +312,8 @@ class Guide extends BasicWeChat
}
/**
* 删除导购粉丝
* @param array $data
* 删除导购粉丝
* @param array $data 解绑数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -326,8 +326,8 @@ class Guide extends BasicWeChat
}
/**
* 查询某一个粉丝与导购的绑定关系
* @param array $data
* 查询粉丝绑定关系
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -340,8 +340,8 @@ class Guide extends BasicWeChat
}
/**
* 通过粉丝信息查询该粉丝与导购的绑定关系
* @param string $openid
* 通过粉丝查询绑定关系
* @param string $openid 粉丝 openid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -354,8 +354,8 @@ class Guide extends BasicWeChat
}
/**
* 拉取导购粉丝列表
* @param array $data
* 拉取导购粉丝列表
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -368,8 +368,8 @@ class Guide extends BasicWeChat
}
/**
* 粉丝从一个导购迁移到另外一个导购
* @param array $data
* 粉丝迁移导购
* @param array $data 迁移数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -383,7 +383,7 @@ class Guide extends BasicWeChat
/**
* 更新粉丝昵称
* @param array $data
* @param array $data 昵称数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -396,8 +396,8 @@ class Guide extends BasicWeChat
}
/**
* 删除小程序卡片素材
* @param array $data
* 删除卡片素材
* @param array $data 素材信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -411,7 +411,7 @@ class Guide extends BasicWeChat
/**
* 删除图片素材
* @param array $data
* @param array $data 素材信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -425,7 +425,7 @@ class Guide extends BasicWeChat
/**
* 删除文字素材
* @param array $data
* @param array $data 素材信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -438,8 +438,8 @@ class Guide extends BasicWeChat
}
/**
* 获取小程序卡片素材信息
* @param integer $type
* 获取卡片素材
* @param int $type 类型
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -452,10 +452,10 @@ class Guide extends BasicWeChat
}
/**
* 获取图片素材信息
* @param integer $type 操作类型
* @param integer $start 分页查询,起始位置
* @param integer $num 分页查询,查询个
* 获取图片素材
* @param int $type 类型
* @param int $start 起始
* @param int $num
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -468,10 +468,10 @@ class Guide extends BasicWeChat
}
/**
* 获取文字素材信息
* @param integer $type 操作类型
* @param integer $start 分页查询,起始位置
* @param integer $num 分页查询,查询个
* 获取文字素材
* @param int $type 类型
* @param int $start 起始
* @param int $num
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -484,8 +484,8 @@ class Guide extends BasicWeChat
}
/**
* 添加小程序卡片素材
* @param array $data
* 添加卡片素材
* @param array $data 素材数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -499,7 +499,7 @@ class Guide extends BasicWeChat
/**
* 添加图片素材
* @param array $data
* @param array $data 素材数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -512,8 +512,8 @@ class Guide extends BasicWeChat
}
/**
* 为服务号添加文字素材
* @param array $data
* 添加文字素材
* @param array $data 素材数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,16 +20,15 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序图像处理
* Class Image
* @package WeMini
*/
class Image extends BasicWeChat
{
/**
* 本接口提供基于小程序的图片智能裁剪能力
* @param string $img_url 要检测的图片 url传这个则不用传 img 参数。
* @param string $img form-data 中媒体文件标识有filename、filelength、content-type等信息传这个则不用穿 img_url
* 图片智能裁剪
* @param string $img_url 图片 URL img 二选一)
* @param string $img form-data 媒体文件(与 img_url 二选一)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -41,9 +40,9 @@ class Image extends BasicWeChat
}
/**
* 本接口提供基于小程序的条码/二维码识别的API
* @param string $img_url 要检测的图片 url传这个则不用传 img 参数。
* @param string $img form-data 中媒体文件标识有filename、filelength、content-type等信息传这个则不用穿 img_url
* 条码/二维码识别
* @param string $img_url 图片 URL img 二选一)
* @param string $img form-data 媒体文件(与 img_url 二选一)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -55,9 +54,9 @@ class Image extends BasicWeChat
}
/**
* 本接口提供基于小程序的图片高清化能力
* @param string $img_url 要检测的图片 url传这个则不用传 img 参数
* @param string $img form-data 中媒体文件标识有filename、filelength、content-type等信息传这个则不用穿 img_url
* 图片高清化
* @param string $img_url 图片 URL img 二选一)
* @param string $img form-data 媒体文件(与 img_url 二选一)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序运费险
* Class Insurance
* @package WeMini
*/
class Insurance extends BasicWeChat
{
/**
* 开通无忧退货接口
* 开通无忧退货
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -39,7 +38,7 @@ class Insurance extends BasicWeChat
}
/**
* 查询开通状态接口
* 查询开通状态
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -51,8 +50,8 @@ class Insurance extends BasicWeChat
}
/**
* 投保接口(发货投保)
* @param array $data
* 发货投保
* @param array $data 投保数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -64,8 +63,8 @@ class Insurance extends BasicWeChat
}
/**
* 理赔接口 (收到用户退货后再触发)
* @param array $data
* 退货理赔
* @param array $data 理赔数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -77,8 +76,8 @@ class Insurance extends BasicWeChat
}
/**
* 申请充值订单号接口 (支持自定义金额)
* @param array $data
* 申请充值订单号
* @param array $data 充值请求
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -90,8 +89,8 @@ class Insurance extends BasicWeChat
}
/**
* 申请支付接口
* @param array $data
* 申请支付
* @param array $data 支付数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -103,8 +102,8 @@ class Insurance extends BasicWeChat
}
/**
* 拉取充值订单信息接口
* @param array $data
* 拉取充值订单
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -117,8 +116,8 @@ class Insurance extends BasicWeChat
/**
* 退款接口
* @param array $data
* 保险退款
* @param array $data 退款参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -130,8 +129,8 @@ class Insurance extends BasicWeChat
}
/**
* 拉取摘要接口 (查询当前保费、投保单量、理赔单量、账号余额等信息)
* @param array $data
* 获取保费摘要
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -143,8 +142,8 @@ class Insurance extends BasicWeChat
}
/**
* 拉取保单信息接口
* @param array $data
* 拉取保单信息
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -156,8 +155,8 @@ class Insurance extends BasicWeChat
}
/**
* 设置告警余额接口
* @param array $data
* 设置告警余额
* @param array $data 配置参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -170,7 +169,7 @@ class Insurance extends BasicWeChat
/**
* 创建退货 ID
* @param array $data
* @param array $data 退货参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -183,7 +182,7 @@ class Insurance extends BasicWeChat
/**
* 查询退货 ID 状态
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -195,8 +194,8 @@ class Insurance extends BasicWeChat
}
/**
* 解绑退货 ID
* @param array $data
* 解绑退货 ID
* @param array $data 解绑参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,15 +19,14 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 小程序直播接口
* Class Live
* 小程序直播
* @package WeMini
*/
class Live extends BasicWeChat
{
/**
* 创建直播间
* @param array $data
* @param array $data 房间信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -40,8 +39,8 @@ class Live extends BasicWeChat
/**
* 获取直播房间列表
* @param integer $start 起始拉取房间
* @param integer $limit 每次拉取的个数上限
* @param int $start 起始
* @param int $limit 数量
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -53,8 +52,8 @@ class Live extends BasicWeChat
}
/**
* 获取回放源视频
* @param array $data
* 获取直播/回放信息
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -67,7 +66,7 @@ class Live extends BasicWeChat
/**
* 直播间导入商品
* @param array $data
* @param array $data 商品列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -80,7 +79,7 @@ class Live extends BasicWeChat
/**
* 商品添加并提审
* @param array $data
* @param array $data 商品信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -92,8 +91,8 @@ class Live extends BasicWeChat
}
/**
* 商品撤回审核
* @param array $data
* 撤回商品审核
* @param array $data 商品信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -105,8 +104,8 @@ class Live extends BasicWeChat
}
/**
* 重新提交审核
* @param array $data
* 重新提交商品审核
* @param array $data 商品信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -119,7 +118,7 @@ class Live extends BasicWeChat
/**
* 删除商品
* @param array $data
* @param array $data 商品信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -132,7 +131,7 @@ class Live extends BasicWeChat
/**
* 更新商品
* @param array $data
* @param array $data 商品信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -145,7 +144,7 @@ class Live extends BasicWeChat
/**
* 获取商品状态
* @param array $data
* @param array $data 商品ID列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -158,9 +157,9 @@ class Live extends BasicWeChat
/**
* 获取商品列表
* @param integer $offset 分页条数起点
* @param integer $status 商品状态0未审核。1审核中2审核通过3审核驳回
* @param integer $limit 分页大小默认30不超过100
* @param int $offset 起始
* @param int $status 0 未审 |1 审核中 |2 通过 |3 驳回
* @param int $limit 数量(<=100)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -173,7 +172,7 @@ class Live extends BasicWeChat
/**
* 删除直播间
* @param array $data
* @param array $data 房间信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -186,7 +185,7 @@ class Live extends BasicWeChat
/**
* 编辑直播间
* @param array $data
* @param array $data 房间信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -198,8 +197,8 @@ class Live extends BasicWeChat
}
/**
* 获取直播间推流地址
* @param string $roomId
* 获取推流地址
* @param string $roomId 房间ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -211,9 +210,9 @@ class Live extends BasicWeChat
}
/**
* 获取直播间分享二维
* @param string $roomId
* @param string $params
* 获取直播间分享
* @param string $roomId 房间ID
* @param string $params 自定义参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -225,8 +224,8 @@ class Live extends BasicWeChat
}
/**
* 添加管理直播间小助手
* @param array $data
* 添加小助手
* @param array $data 助手信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -238,8 +237,8 @@ class Live extends BasicWeChat
}
/**
* 修改管理直播间小助手
* @param array $data
* 修改小助手
* @param array $data 助手信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -251,8 +250,8 @@ class Live extends BasicWeChat
}
/**
* 删除管理直播间小助手
* @param array $data
* 删除小助手
* @param array $data 助手信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -264,8 +263,8 @@ class Live extends BasicWeChat
}
/**
* 查询管理直播间小助手
* @param string $roomId
* 查询小助手列表
* @param string $roomId 房间ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -278,7 +277,7 @@ class Live extends BasicWeChat
/**
* 添加主播副号
* @param array $data
* @param array $data 副号信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -291,7 +290,7 @@ class Live extends BasicWeChat
/**
* 修改主播副号
* @param array $data
* @param array $data 副号信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -303,8 +302,8 @@ class Live extends BasicWeChat
}
/**
* 删除主播副号
* @param array $data
* 删除主播副号
* @param array $data 副号信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -316,8 +315,8 @@ class Live extends BasicWeChat
}
/**
* 查询主播副号
* @param string $roomId
* 查询主播副号
* @param string $roomId 房间ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -329,8 +328,8 @@ class Live extends BasicWeChat
}
/**
* /闭直播间官方收录
* @param array $data
* 关官方收录
* @param array $data 房间配置
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -342,8 +341,8 @@ class Live extends BasicWeChat
}
/**
* /回放功能
* @param array $data
* 关回放
* @param array $data 房间配置
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -355,8 +354,8 @@ class Live extends BasicWeChat
}
/**
* /客服功能
* @param array $data
* 关客服
* @param array $data 房间配置
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -368,8 +367,8 @@ class Live extends BasicWeChat
}
/**
* /闭直播间全局禁言
* @param array $data
* 关全局禁言
* @param array $data 房间配置
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -382,7 +381,7 @@ class Live extends BasicWeChat
/**
* 上下架商品
* @param array $data
* @param array $data 商品参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -395,7 +394,7 @@ class Live extends BasicWeChat
/**
* 删除直播间商品
* @param array $data
* @param array $data 商品参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -408,7 +407,7 @@ class Live extends BasicWeChat
/**
* 推送商品
* @param array $data
* @param array $data 商品参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -421,7 +420,7 @@ class Live extends BasicWeChat
/**
* 商品排序
* @param array $data
* @param array $data 排序参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -434,7 +433,7 @@ class Live extends BasicWeChat
/**
* 下载商品讲解视频
* @param array $data
* @param array $data 商品信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -447,7 +446,7 @@ class Live extends BasicWeChat
/**
* 获取长期订阅用户
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -459,8 +458,8 @@ class Live extends BasicWeChat
}
/**
* 订阅群发接口
* @param array $data
* 订阅群发
* @param array $data 消息参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -474,7 +473,7 @@ class Live extends BasicWeChat
/**
* 设置成员角色
* @param array $data
* @param array $data 角色参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -488,7 +487,7 @@ class Live extends BasicWeChat
/**
* 解除成员角色
* @param array $data
* @param array $data 角色参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -502,10 +501,10 @@ class Live extends BasicWeChat
/**
* 查询成员角色
* @param int $role
* @param int $offset
* @param int $limit
* @param string $keyword
* @param int $role 角色过滤,-1 全部
* @param int $offset 起始
* @param int $limit 数量
* @param string $keyword 关键词
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序物流助手
* Class Logistics
* @package WeMini
*/
class Logistics extends BasicWeChat
{
/**
* 生成运单
* @param array $data
* @param array $data 运单参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -40,7 +39,7 @@ class Logistics extends BasicWeChat
/**
* 取消运单
* @param array $data
* @param array $data 取消参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -52,7 +51,7 @@ class Logistics extends BasicWeChat
}
/**
* 获取支持的快递公司列表
* 获取快递公司列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -65,7 +64,7 @@ class Logistics extends BasicWeChat
/**
* 获取运单数据
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -78,7 +77,7 @@ class Logistics extends BasicWeChat
/**
* 查询运单轨迹
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -90,7 +89,7 @@ class Logistics extends BasicWeChat
}
/**
* 获取打印员。若需要使用微信打单 PC 软件,才需要调用
* 获取打印员列表(需使用微信打单时调用)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -102,8 +101,8 @@ class Logistics extends BasicWeChat
}
/**
* 获取电子面单余额。仅在使用加盟类快递公司时,才可以调用
* @param array $data
* 获取电子面单余额(加盟类快递)
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -115,8 +114,8 @@ class Logistics extends BasicWeChat
}
/**
* 模拟快递公司更新订单状态, 该接口只能用户测试
* @param array $data
* 模拟更新订单状态(测试用)
* @param array $data 模拟参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -128,8 +127,8 @@ class Logistics extends BasicWeChat
}
/**
* 配置面单打印员,若需要使用微信打单 PC 软件,才需要调用
* @param array $data
* 配置面单打印员(微信打单)
* @param array $data 配置参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -142,7 +141,7 @@ class Logistics extends BasicWeChat
/**
* 获取面单联系人信息
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -154,8 +153,8 @@ class Logistics extends BasicWeChat
}
/**
* 预览面单模板。用于调试面单模板使用
* @param array $data
* 预览面单模板(调试用)
* @param array $data 模板参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -168,7 +167,7 @@ class Logistics extends BasicWeChat
/**
* 更新商户审核结果
* @param array $data
* @param array $data 审核结果
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -181,7 +180,7 @@ class Logistics extends BasicWeChat
/**
* 更新运单轨迹
* @param array $data
* @param array $data 轨迹参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -195,7 +194,7 @@ class Logistics extends BasicWeChat
/**
* 绑定/解绑物流账号
* @param array $data
* @param array $data 账号参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -208,8 +207,8 @@ class Logistics extends BasicWeChat
/**
* 获取所有绑定的物流账号
* @param array $data
* 获取已绑定的物流账号列表
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -222,7 +221,7 @@ class Logistics extends BasicWeChat
/**
* 批量获取运单数据
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,15 +19,14 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 微信小程序服务市场
* Class Ocr
* 小程序服务市场
* @package WeMini
*/
class Market extends BasicWeChat
{
/**
* 调用服务平台上架的API
* @param array $data
* 调用上架服务
* @param array $data 服务参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -39,8 +38,8 @@ class Market extends BasicWeChat
}
/**
* 获取服务市场返回的数据
* @param array $data
* 拉取服务结果
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -21,7 +21,6 @@ use WeChat\Contracts\Tools;
/**
* 小程序素材操作
* Class Media
* @package WeMini
*/
class Media extends BasicWeChat
@ -29,7 +28,7 @@ class Media extends BasicWeChat
/**
* 获取客服消息内的临时素材
* @param array $data
* @param string $media_id 媒体 ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -42,7 +41,7 @@ class Media extends BasicWeChat
/**
* 新增图片素材
* @param array $data
* @param string $filename 本地文件
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序动态消息
* Class Message
* @package WeMini
*/
class Message extends BasicWeChat
{
/**
* 动态消息,创建被分享动态消息 activity_id
* @param array $data
* 创建动态消息 activity_id
* @param array $data 请求参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -39,8 +38,8 @@ class Message extends BasicWeChat
}
/**
* 动态消息,修改被分享的动态消息
* @param array $data
* 修改动态消息
* @param array $data 消息数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -52,8 +51,8 @@ class Message extends BasicWeChat
}
/**
* 下发小程序和公众号统一服务消息
* @param array $data
* 统一服务消息下发
* @param array $data 消息内容
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,15 +19,14 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 公众号小程序订阅消息支持
* Class Mini
* @package WeChat
* 小程序订阅消息
* @package WeMini
*/
class Newtmpl extends BasicWeChat
{
/**
* 获取小程序账号的类目
* @param array $data 类目信息列表
* 添加账号类目
* @param array $data 类目信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -39,7 +38,7 @@ class Newtmpl extends BasicWeChat
}
/**
* 获取小程序账号类目
* 获取账号类目
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -51,7 +50,7 @@ class Newtmpl extends BasicWeChat
}
/**
* 获取小程序账号的类目
* 删除账号类目
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -63,8 +62,8 @@ class Newtmpl extends BasicWeChat
}
/**
* 获取帐号所属类目下公共模板标题
* @param string $ids 类目 id多个用逗号隔开
* 获取类目下公共模板标题
* @param string $ids 类目ID逗号分隔
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -77,8 +76,8 @@ class Newtmpl extends BasicWeChat
}
/**
* 获取模板标题下的关键词列表
* @param string $tid 模板标题 id可通过接口获取
* 获取模板标题关键词
* @param string $tid 模板标题ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -91,10 +90,10 @@ class Newtmpl extends BasicWeChat
}
/**
* 组合模板并添加至帐号下的个人模板
* @param string $tid 模板标题 id可通过接口获取也可登录小程序后台查看获取
* @param array $kidList 开发者自行组合好的模板关键词列表,关键词顺序可以自由搭配(例如 [3,5,4] [4,5,3]最多支持5个最少2个关键词组合
* @param string $sceneDesc 服务场景描述15个字以内
* 组合模板并
* @param string $tid 模板标题ID
* @param array $kidList 关键词ID列表
* @param string $sceneDesc 场景描述
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -106,7 +105,7 @@ class Newtmpl extends BasicWeChat
}
/**
* 获取当前帐号下的个人模板列表
* 获取个人模板列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -118,8 +117,8 @@ class Newtmpl extends BasicWeChat
}
/**
* 删除帐号下的个人模板
* @param string $priTmplId 要删除的模板id
* 删除个人模板
* @param string $priTmplId 模板ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -132,7 +131,7 @@ class Newtmpl extends BasicWeChat
/**
* 发送订阅消息
* @param array $data 发送的消息对象数组
* @param array $data 消息数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序ORC服务
* Class Ocr
* @package WeMini
*/
class Ocr extends BasicWeChat
{
/**
* 本接口提供基于小程序的银行卡 OCR 识别
* @param array $data
* 银行卡 OCR
* @param array $data 图片参数img_url img
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -39,8 +38,8 @@ class Ocr extends BasicWeChat
}
/**
* 本接口提供基于小程序的营业执照 OCR 识别
* @param array $data
* 营业执照 OCR
* @param array $data 图片参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -52,8 +51,8 @@ class Ocr extends BasicWeChat
}
/**
* 本接口提供基于小程序的驾驶证 OCR 识别
* @param array $data
* 驾驶证 OCR
* @param array $data 图片参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -65,8 +64,8 @@ class Ocr extends BasicWeChat
}
/**
* 本接口提供基于小程序的身份证 OCR 识别
* @param array $data
* 身份证 OCR
* @param array $data 图片参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -78,8 +77,8 @@ class Ocr extends BasicWeChat
}
/**
* 本接口提供基于小程序的通用印刷体 OCR 识别
* @param array $data
* 通用印刷体 OCR
* @param array $data 图片参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -91,8 +90,8 @@ class Ocr extends BasicWeChat
}
/**
* 本接口提供基于小程序的行驶证 OCR 识别
* @param array $data
* 行驶证 OCR
* @param array $data 图片参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,7 +20,6 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序运维中心
* Class Operation
* @package WeMini
*/
class Operation extends BasicWeChat
@ -28,7 +27,7 @@ class Operation extends BasicWeChat
/**
* 实时日志查询
* @param array $data
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -40,8 +39,8 @@ class Operation extends BasicWeChat
}
/**
* 获取 mediaId 图片
* @param array $data
* 获取反馈媒体文件
* @param array $data query 参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -49,14 +48,14 @@ class Operation extends BasicWeChat
public function getFeedbackmedia($data)
{
$query = http_build_query($data);
$url = 'https://api.weixin.qq.com/cgi-bin/media/getfeedbackmedia?'. $query .'&access_token=ACCESS_TOKEN';
$url = 'https://api.weixin.qq.com/cgi-bin/media/getfeedbackmedia?' . $query . '&access_token=ACCESS_TOKEN';
return $this->callGetApi($url);
}
/**
* 实时日志查询
* @param array $data
* 获取用户反馈列表
* @param array $data query 参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -64,7 +63,7 @@ class Operation extends BasicWeChat
public function getFeedback($data)
{
$query = http_build_query($data);
$url = 'https://api.weixin.qq.com/wxaapi/userlog/userlog_search?'.$query.'&access_token=ACCESS_TOKEN';
$url = 'https://api.weixin.qq.com/wxaapi/userlog/userlog_search?' . $query . '&access_token=ACCESS_TOKEN';
return $this->callGetApi($url);
}
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,15 +19,14 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 微信小程序插件管理
* Class Plugs
* 小程序插件管理
* @package WeMini
*/
class Plugs extends BasicWeChat
{
/**
* 1.申请使用插件
* @param string $plugin_appid 插件appid
* 申请使用插件
* @param string $plugin_appid 插件 appid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -39,7 +38,7 @@ class Plugs extends BasicWeChat
}
/**
* 2.查询已添加插件
* 查询已添加插件
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -51,8 +50,8 @@ class Plugs extends BasicWeChat
}
/**
* 3.删除已添加的插件
* @param string $plugin_appid 插件appid
* 删除插件
* @param string $plugin_appid 插件 appid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -64,9 +63,8 @@ class Plugs extends BasicWeChat
}
/**
* 获取当前所有插件使用方
* 修改插件使用申请的状态
* @param array $data
* 获取插件使用方或修改申请状态
* @param array $data 请求参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -78,9 +76,9 @@ class Plugs extends BasicWeChat
}
/**
* 4.获取当前所有插件使用方(供插件开发者调用
* @param integer $page 拉取第page页的数据
* @param integer $num 表示每页num条记录
* 获取插件使用方列表(开发者)
* @param int $page 页码
* @param int $num 每页数量
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -93,8 +91,8 @@ class Plugs extends BasicWeChat
}
/**
* 5.修改插件使用申请状态(供插件开发者调用
* @param string $action dev_agree同意申请dev_refuse拒绝申请dev_delete删除已拒绝的申请者
* 修改插件申请状态(开发者)
* @param string $action dev_agree|dev_refuse|dev_delete
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,18 +19,17 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 微信小程序地址管理
* Class Poi
* 小程序地址管理
* @package WeMini
*/
class Poi extends BasicWeChat
{
/**
* 添加地点
* @param string $related_name 经营资质主体
* @param string $related_credential 经营资质证件号
* @param string $related_address 经营资质地址
* @param string $related_proof_material 相关证明材料照片临时素材mediaid
* 添加附近地点
* @param string $related_name 经营主体
* @param string $related_credential 证件号
* @param string $related_address 地址
* @param string $related_proof_material 证明材料 media_id
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -47,8 +46,8 @@ class Poi extends BasicWeChat
/**
* 查看地点列表
* @param integer $page 起始页id从1开始计数
* @param integer $page_rows 每页展示个数最多1000个
* @param int $page 页码从1开始
* @param int $page_rows 每页数量(<=1000)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -60,8 +59,8 @@ class Poi extends BasicWeChat
}
/**
* 删除地点
* @param string $poi_id 附近地点ID
* 删除附近地点
* @param string $poi_id 地点ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -73,9 +72,9 @@ class Poi extends BasicWeChat
}
/**
* 展示/取消展示附近小程序
* @param string $poi_id 附近地点ID
* @param string $status 0取消展示1展示
* 设置附近小程序展示
* @param string $poi_id 地点ID
* @param string $status 0 取消 | 1 展示
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -21,7 +21,6 @@ use WeChat\Contracts\Tools;
/**
* 微信小程序二维码
* Class Qrcode
* @package WeMini
*/
class Qrcode extends BasicWeChat
@ -56,6 +55,26 @@ class Qrcode extends BasicWeChat
return $this->parseResult(Tools::post($url, Tools::arr2json(array_merge($data, $extra))), $outType);
}
/**
* 解释接口数据
* @param bool|string $result
* @param null|string $outType
* @return array|mixed
* @throws \WeChat\Exceptions\InvalidResponseException
*/
private function parseResult($result, $outType)
{
if (is_array($json = json_decode($result, true))) {
if (!$this->isTry && isset($json['errcode']) && in_array($json['errcode'], ['40014', '40001', '41001', '42001'])) {
[$this->delAccessToken(), $this->isTry = true];
return call_user_func_array([$this, $this->currentMethod['method']], $this->currentMethod['arguments']);
}
return Tools::json2arr($result);
} else {
return is_null($outType) ? $result : $outType($result);
}
}
/**
* 获取小程序码(永久有效)
* 接口B适用于需要的码数量极多的业务场景
@ -97,24 +116,4 @@ class Qrcode extends BasicWeChat
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->parseResult(Tools::post($url, Tools::arr2json(['path' => $path, 'width' => $width])), $outType);
}
/**
* 解释接口数据
* @param bool|string $result
* @param null|string $outType
* @return array|mixed
* @throws \WeChat\Exceptions\InvalidResponseException
*/
private function parseResult($result, $outType)
{
if (is_array($json = json_decode($result, true))) {
if (!$this->isTry && isset($json['errcode']) && in_array($json['errcode'], ['40014', '40001', '41001', '42001'])) {
[$this->delAccessToken(), $this->isTry = true];
return call_user_func_array([$this, $this->currentMethod['method']], $this->currentMethod['arguments']);
}
return Tools::json2arr($result);
} else {
return is_null($outType) ? $result : $outType($result);
}
}
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,7 +20,6 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序 URL-Scheme
* Class Scheme
* @package WeMini
*/
class Scheme extends BasicWeChat
@ -28,7 +27,7 @@ class Scheme extends BasicWeChat
/**
* 创建 URL-Scheme
* @param array $data
* @param array $data 场景参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -41,7 +40,7 @@ class Scheme extends BasicWeChat
/**
* 查询 URL-Scheme
* @param string $scheme
* @param string $scheme Scheme 字符串
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -54,7 +53,7 @@ class Scheme extends BasicWeChat
/**
* 创建 URL-Link
* @param array $data
* @param array $data 场景参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -67,7 +66,7 @@ class Scheme extends BasicWeChat
/**
* 查询 URL-Link
* @param string $urllink
* @param string $urllink URL-Link 字符串
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序搜索
* Class Search
* @package WeMini
*/
class Search extends BasicWeChat
{
/**
* 提交小程序页面url及参数信息
* @param array $pages
* 提交页面 URL 及参数
* @param array $pages 页面列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,15 +20,14 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序内容安全
* Class Security
* @package WeMini
*/
class Security extends BasicWeChat
{
/**
* 校验一张图片是否含有违法违规内容
* @param string $media 要检测的图片文件格式支持PNG、JPEG、JPG、GIF图片尺寸不超过 750px x 1334px
* 图片内容安全校验
* @param string $media 图片文件
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -40,9 +39,9 @@ class Security extends BasicWeChat
}
/**
* 异步校验图片/音频是否含有违法违规内容
* @param string $media_url
* @param string $media_type
* 异步校验媒体(图片/音频)
* @param string $media_url 媒体 URL
* @param string $media_type 1 音频 | 2 图片
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -54,8 +53,8 @@ class Security extends BasicWeChat
}
/**
* 检查一段文本是否含有违法违规内容
* @param string $content
* 文本内容安全校验
* @param string $content 文本内容
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -5,16 +5,15 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 小程序发货信息管理服务
* @class Shipping
* 小程序发货信息管理
* @package WeMini
*/
class Shipping extends BasicWeChat
{
/**
* 发货信息录入接口
* @param array $data
* 录入发货信息
* @param array $data 发货数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -26,8 +25,8 @@ class Shipping extends BasicWeChat
}
/**
* 发货信息合单录入接口
* @param array $data
* 合单发货录入
* @param array $data 发货数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -39,8 +38,8 @@ class Shipping extends BasicWeChat
}
/**
* 查询订单发货状态
* @param array $data
* 查询发货状态
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -52,8 +51,8 @@ class Shipping extends BasicWeChat
}
/**
* 查询订单列表
* @param array $data
* 查询发货订单列表
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -65,8 +64,8 @@ class Shipping extends BasicWeChat
}
/**
* 确认收货提醒接口
* @param array $data
* 提醒确认收货
* @param array $data 提醒参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -78,8 +77,8 @@ class Shipping extends BasicWeChat
}
/**
* 消息跳转路径设置接口
* @param array $data
* 设置消息跳转路径
* @param array $data 路径参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -91,8 +90,8 @@ class Shipping extends BasicWeChat
}
/**
* 查询小程序是否开通发货信息管理服务
* @param array $data
* 查询是否开通发货管理
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -104,8 +103,8 @@ class Shipping extends BasicWeChat
}
/**
* 查询小程序是否已完成交易结算管理确认
* @param array $data
* 查询交易结算确认状态
* @param array $data 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,7 +20,6 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序购物订单
* Class Shopping
* @package WeMini
*/
class Shopping extends BasicWeChat
@ -28,7 +27,7 @@ class Shopping extends BasicWeChat
/**
* 上传购物详情
* @param array $data
* @param array $data 订单数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -41,7 +40,7 @@ class Shopping extends BasicWeChat
/**
* 上传物流信息
* @param array $data
* @param array $data 物流数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -54,7 +53,7 @@ class Shopping extends BasicWeChat
/**
* 上传合单购物详情
* @param array $data
* @param array $data 订单数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -66,8 +65,8 @@ class Shopping extends BasicWeChat
}
/**
* 上传合单物流信息
* @param array $data
* 上传合单物流
* @param array $data 物流数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -79,8 +78,8 @@ class Shopping extends BasicWeChat
}
/**
* 购物订单上传结果
* @param array $data
* 验购物订单上传结果
* @param array $data 校验参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,14 +20,13 @@ use WeChat\Contracts\BasicWeChat;
/**
* 小程序生物认证
* Class Soter
* @package WeMini
*/
class Soter extends BasicWeChat
{
/**
* SOTER 生物认证秘钥签名验证
* @param array $data
* SOTER 签名验证
* @param array $data 签名数据
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,15 +19,14 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 公众号小程序模板消息支持
* Class Mini
* @package WeChat
* 小程序模板消息
* @package WeMini
*/
class Template extends BasicWeChat
{
/**
* 获取小程序模板库标题列表
* 获取模板库标题列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -39,8 +38,8 @@ class Template extends BasicWeChat
}
/**
* 获取模板库某个模板标题下关键词库
* @param string $template_id 模板标题id可通过接口获取也可登录小程序后台查看获取
* 获取模板关键词库
* @param string $template_id 模板标题ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -52,9 +51,9 @@ class Template extends BasicWeChat
}
/**
* 组合模板并添加至帐号下的个人模板库
* @param string $template_id 模板标题id可通过接口获取也可登录小程序后台查看获取
* @param array $keyword_id_list 开发者自行组合好的模板关键词列表,关键词顺序可以自由搭配(例如[3,5,4][4,5,3]最多支持10个关键词组合
* 组合关键词并添加模板
* @param string $template_id 模板标题ID
* @param array $keyword_id_list 关键词 ID 列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -66,7 +65,7 @@ class Template extends BasicWeChat
}
/**
* 获取帐号下已存在的模板列表
* 获取帐号模板列表
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -78,8 +77,8 @@ class Template extends BasicWeChat
}
/**
* 删除模板消息
* @param string $template_id 要删除的模板id
* 删除模板
* @param string $template_id 模板 ID
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -92,7 +91,7 @@ class Template extends BasicWeChat
/**
* 发送模板消息
* @param array $data 发送的消息对象数组
* @param array $data 消息体touser, template_id, form_id, data 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,16 +19,15 @@ namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 微信小程序数据接口
* Class Total
* 小程序数据统计
* @package WeMini
*/
class Total extends BasicWeChat
{
/**
* 数据分析接口
* 概况趋势(日)
* @param string $beginDate 开始日期
* @param string $endDate 结束日期,限定查询1天数据end_date允许设置的最大值为昨日
* @param string $endDate 结束日期,需同一天
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -40,9 +39,9 @@ class Total extends BasicWeChat
}
/**
* 访问分析
* 访问趋势(日)
* @param string $beginDate 开始日期
* @param string $endDate 结束日期,限定查询1天数据end_date允许设置的最大值为昨日
* @param string $endDate 结束日期,需同一天
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -54,9 +53,9 @@ class Total extends BasicWeChat
}
/**
* 周趋势
* @param string $begin_date 开始日期,为周一日期
* @param string $end_date 结束日期,为周日日期,限定查询一周数据
* 访问趋势(周)
* @param string $begin_date 周一
* @param string $end_date 周日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -68,9 +67,9 @@ class Total extends BasicWeChat
}
/**
* 月趋势
* @param string $begin_date 开始日期,为自然月第一天
* @param string $end_date 结束日期,为自然月最后一天,限定查询一个月数据
* 访问趋势(月)
* @param string $begin_date 月首日
* @param string $end_date 月末日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -84,7 +83,7 @@ class Total extends BasicWeChat
/**
* 访问分布
* @param string $begin_date 开始日期
* @param string $end_date 结束日期,限定查询1天数据end_date允许设置的最大值为昨日
* @param string $end_date 结束日期,需同一天
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -96,9 +95,9 @@ class Total extends BasicWeChat
}
/**
* 留存
* 留存(日)
* @param string $begin_date 开始日期
* @param string $end_date 结束日期,限定查询1天数据end_date允许设置的最大值为昨日
* @param string $end_date 结束日期,需同一天
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -110,9 +109,9 @@ class Total extends BasicWeChat
}
/**
* 留存
* @param string $begin_date 开始日期,为周一日期
* @param string $end_date 结束日期,为周日日期,限定查询一周数据
* 留存(周)
* @param string $begin_date 周一
* @param string $end_date 周日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -124,9 +123,9 @@ class Total extends BasicWeChat
}
/**
* 留存
* @param string $begin_date 开始日期,为自然月第一天
* @param string $end_date 结束日期,为自然月最后一天,限定查询一个月数据
* 留存(月)
* @param string $begin_date 月首日
* @param string $end_date 月末日
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -138,9 +137,9 @@ class Total extends BasicWeChat
}
/**
* 访问页面
* 访问页面数据
* @param string $begin_date 开始日期
* @param string $end_date 结束日期,限定查询1天数据end_date允许设置的最大值为昨日
* @param string $end_date 结束日期,需同一天
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -154,7 +153,7 @@ class Total extends BasicWeChat
/**
* 用户画像
* @param string $begin_date 开始日期
* @param string $end_date 结束日期,开始日期与结束日期相差的天数限定为0/6/29分别表示查询最近1/7/30天数据end_date允许设置的最大值为昨日
* @param string $end_date 结束日期,间隔为0/6/29
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -2,7 +2,6 @@
/**
* 对微信小程序用户加密数据的解密示例代码
* Class WXBizDataCrypt
* @copyright Copyright (c) 1998-2014 Tencent Inc.
*/
class WXBizDataCrypt

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -22,16 +22,15 @@ use WeChat\Exceptions\InvalidResponseException;
/**
* 微信商户账单及评论
* Class Bill
* @package WePay
*/
class Bill extends BasicWePay
{
/**
* 下载对账单
* @param array $options 静音参数
* @param null|string $outType 输出类型
* @return bool|string
* @param array $options 账单参数bill_date, bill_type 等)
* @param null|string $outType 输出处理回调,为 null 则返回原始内容
* @return bool|string 原始账单文本或回调结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -51,9 +50,9 @@ class Bill extends BasicWePay
/**
* 拉取订单评价数据
* @param array $options
* @return array
* 拉取订单评价数据(需证书)
* @param array $options 查询参数bill_date, offset, limit 等)
* @return array 评价数据
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,15 +20,14 @@ use WeChat\Contracts\BasicWePay;
/**
* 微信商户代金券
* Class Coupon
* @package WePay
*/
class Coupon extends BasicWePay
{
/**
* 发放代金券
* @param array $options
* @return array
* 发放代金券(需证书)
* @param array $options 代金券参数coupon_stock_id, openid, partner_trade_no, op_user_id 等)
* @return array 发券结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -40,8 +39,8 @@ class Coupon extends BasicWePay
/**
* 查询代金券批次
* @param array $options
* @return array
* @param array $options 查询参数coupon_stock_id 等)
* @return array 批次详情
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -52,9 +51,9 @@ class Coupon extends BasicWePay
}
/**
* 查询代金券信息
* @param array $options
* @return array
* 查询单个代金券信息
* @param array $options 查询参数coupon_id, openid, stock_id 等)
* @return array 代金券详情
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,16 +20,15 @@ use WeChat\Contracts\BasicWePay;
/**
* 微信扩展上报海关
* Class Custom
* @package WePay
*/
class Custom extends BasicWePay
{
/**
* 订单附加信息提交接口
* @param array $options
* @return array
* 海关申报:订单附加信息提交
* @param array $options 申报参数transaction_id out_trade_nocustomsmch_customs_no 等)
* @return array 申报结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -40,9 +39,9 @@ class Custom extends BasicWePay
}
/**
* 订单附加信息查询接口
* @param array $options
* @return array
* 海关申报:订单附加信息查询
* @param array $options 查询参数transaction_id out_trade_nocustomsmch_customs_no 等)
* @return array 申报状态
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -54,9 +53,9 @@ class Custom extends BasicWePay
/**
* 订单附加信息重推接口
* @param array $options
* @return array
* 海关申报:重推申报信息
* @param array $options 重推参数transaction_id out_trade_nocustomsmch_customs_no 等)
* @return array 重推结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -21,16 +21,15 @@ use WeChat\Contracts\Tools;
/**
* 微信商户订单
* Class Order
* @package WePay
*/
class Order extends BasicWePay
{
/**
* 统一下单
* @param array $options
* @return array
* 统一下单接口
* @param array $options 订单参数out_trade_no, body, total_fee, notify_url, trade_type等
* @return array 返回prepay_id等支付参数
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -41,9 +40,9 @@ class Order extends BasicWePay
}
/**
* 刷卡支付
* @param array $options
* @return array
* 刷卡支付接口(被扫支付)
* @param array $options 支付参数auth_code, out_trade_no, body, total_fee等
* @return array 支付结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -54,9 +53,9 @@ class Order extends BasicWePay
}
/**
* 查询订单
* @param array $options
* @return array
* 查询订单接口
* @param array $options 查询参数transaction_id或out_trade_no二选一
* @return array 订单详情
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -67,9 +66,9 @@ class Order extends BasicWePay
}
/**
* 关闭订单
* 关闭订单接口
* @param string $outTradeNo 商户订单号
* @return array
* @return array 关闭结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -80,9 +79,9 @@ class Order extends BasicWePay
}
/**
* 创建JsApi及H5支付参数
* @param string $prepayId 统一下单预支付码
* @return array
* 生成JSAPI支付参数用于前端调起支付
* @param string $prepayId 统一下单返回的prepay_id
* @return array JSAPI支付所需参数appId, timeStamp, nonceStr, package, signType, paySign
*/
public function jsapiParams($prepayId)
{
@ -98,9 +97,9 @@ class Order extends BasicWePay
}
/**
* 获取支付规则二维码
* @param string $productId 户定义的商品id或者订单号
* @return string
* 生成Native支付二维码URL
* @param string $productId 品ID或订单号
* @return string 支付二维码URLweixin://wxpay/bizpayurl?xxx
*/
public function qrcParams($productId)
{
@ -116,9 +115,9 @@ class Order extends BasicWePay
}
/**
* 获取微信App支付秘需参数
* @param string $prepayId 统一下单预支付码
* @return array
* 生成APP支付参数用于移动应用调起支付
* @param string $prepayId 统一下单返回的prepay_id
* @return array APP支付所需参数appid, partnerid, prepayid, package, timestamp, noncestr, sign
*/
public function appParams($prepayId)
{
@ -135,9 +134,9 @@ class Order extends BasicWePay
}
/**
* 刷卡支付 撤销订单
* @param array $options
* @return array
* 撤销订单接口(刷卡支付专用,需要证书)
* @param array $options 撤销参数transaction_id或out_trade_no二选一
* @return array 撤销结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -148,9 +147,9 @@ class Order extends BasicWePay
}
/**
* 刷卡支付 授权码查询openid
* @param string $authCode 扫码支付授权码,设备读取用户微信中的条码或者二维码信息
* @return array
* 授权码查询openid接口
* @param string $authCode 授权码(用户微信中的条码或二维码信息)
* @return array 包含openid等信息
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -161,9 +160,9 @@ class Order extends BasicWePay
}
/**
* 刷卡支付 交易保障
* @param array $options
* @return array
* 交易保障接口(用于上报交易数据)
* @param array $options 上报参数interface_url, execute_time, return_code, result_code等
* @return array 上报结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,16 +20,15 @@ use WeChat\Contracts\BasicWePay;
/**
* 微信分账
* Class ProfitSharing
* @package WePay
*/
class ProfitSharing extends BasicWePay
{
/**
* 请求单次分账
* @param array $options
* @return array
* 请求单次分账(需证书)
* @param array $options 分账参数transaction_id, out_order_no, receivers 等)
* @return array 分账结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -40,9 +39,9 @@ class ProfitSharing extends BasicWePay
}
/**
* 请求多次分账
* @param array $options
* @return array
* 请求多次分账(需证书)
* @param array $options 分账参数transaction_id, out_order_no, receivers 等)
* @return array 分账结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -54,8 +53,8 @@ class ProfitSharing extends BasicWePay
/**
* 查询分账结果
* @param array $options
* @return array
* @param array $options 查询参数transaction_id out_order_no
* @return array 分账状态
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -67,7 +66,7 @@ class ProfitSharing extends BasicWePay
/**
* 添加分账接收方
* @param array $options
* @param array $options 接收方信息type, account, name, relation_type 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -80,7 +79,7 @@ class ProfitSharing extends BasicWePay
/**
* 删除分账接收方
* @param array $options
* @param array $options 接收方信息type, account
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -92,9 +91,9 @@ class ProfitSharing extends BasicWePay
}
/**
* 完结分账
* @param array $options
* @return array
* 完结分账(需证书)
* @param array $options 完结参数transaction_id, out_order_no, description 等)
* @return array 完结结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -106,8 +105,8 @@ class ProfitSharing extends BasicWePay
/**
* 查询订单待分账金额
* @param array $options
* @return array
* @param array $options 查询参数transaction_id
* @return array 待分账金额
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -118,9 +117,9 @@ class ProfitSharing extends BasicWePay
}
/**
* 分账回退
* @param array $options
* @return array
* 分账回退(需证书)
* @param array $options 回退参数out_return_no, out_order_no, return_account_type 等)
* @return array 回退结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -132,8 +131,8 @@ class ProfitSharing extends BasicWePay
/**
* 回退结果查询
* @param array $options
* @return array
* @param array $options 查询参数out_return_no out_order_no
* @return array 回退状态
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,16 +20,15 @@ use WeChat\Contracts\BasicWePay;
/**
* 微信红包支持
* Class Redpack
* @package WePay
*/
class Redpack extends BasicWePay
{
/**
* 发放普通红包
* @param array $options
* @return array
* 发放普通红包(需证书)
* @param array $options 红包参数mch_billno, send_name, re_openid, total_amount, total_num, wishing 等)
* @return array 红包发送结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -42,9 +41,9 @@ class Redpack extends BasicWePay
}
/**
* 发放裂变红包
* @param array $options
* @return array
* 发放裂变红包(需证书)
* @param array $options 红包参数mch_billno, send_name, re_openid, total_amount, total_num total_num>1
* @return array 红包发送结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -58,8 +57,8 @@ class Redpack extends BasicWePay
/**
* 查询红包记录
* @param string $mchBillno 商户发放红包的商户订单号
* @return array
* @param string $mchBillno 商户红包订单号
* @return array 红包状态信息
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -23,16 +23,15 @@ use WeChat\Exceptions\InvalidResponseException;
/**
* 微信商户退款
* Class Refund
* @package WePay
*/
class Refund extends BasicWePay
{
/**
* 创建退款订单
* @param array $options
* @return array
* 申请退款接口(需要证书)
* @param array $options 退款参数transaction_id或out_trade_no, out_refund_no, total_fee, refund_fee等
* @return array 退款结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -43,9 +42,9 @@ class Refund extends BasicWePay
}
/**
* 查询退款
* @param array $options
* @return array
* 查询退款接口
* @param array $options 查询参数transaction_id, out_trade_no, out_refund_no, refund_id四选一
* @return array 退款详情
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -56,9 +55,9 @@ class Refund extends BasicWePay
}
/**
* 获取退款通知
* @param string|array $xml
* @return array
* 解析退款通知自动解密req_info
* @param string|array $xml 退款通知XML数据为空则从POST获取
* @return array 解密后的退款通知数据
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,16 +20,15 @@ use WeChat\Contracts\BasicWePay;
/**
* 微信商户打款到零钱
* Class Transfers
* @package WePay
*/
class Transfers extends BasicWePay
{
/**
* 企业付款到零钱
* @param array $options
* @return array
* 企业付款到零钱(需证书)
* @param array $options 付款参数partner_trade_no, openid, amount, desc, check_name 等)
* @return array 付款结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -44,9 +43,9 @@ class Transfers extends BasicWePay
}
/**
* 查询企业付款到零钱
* @param string $partnerTradeNo 商户调用企业付款API时使用的商户订单号
* @return array
* 查询企业付款到零钱结果
* @param string $partnerTradeNo 商户付款单号
* @return array 付款状态
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -24,16 +24,15 @@ use WeChat\Exceptions\InvalidResponseException;
/**
* 微信商户打款到银行卡
* Class TransfersBank
* @package WePay
*/
class TransfersBank extends BasicWePay
{
/**
* 企业付款到银行卡
* @param array $options
* @return array
* 企业付款到银行卡(需证书,敏感字段 RSA 加密)
* @param array $options 付款参数partner_trade_no, enc_bank_no, enc_true_name, bank_code, amount, desc 等)
* @return array 付款结果
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -67,24 +66,10 @@ class TransfersBank extends BasicWePay
}
/**
* 商户企业付款到银行卡操作进行结果查询
* @param string $partnerTradeNo 商户订单号,需保持唯一
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function query($partnerTradeNo)
{
$this->params->offsetUnset('appid');
$url = 'https://api.mch.weixin.qq.com/mmpaysptrans/query_bank';
return $this->callPostApi($url, ['partner_trade_no' => $partnerTradeNo], true, 'MD5', false);
}
/**
* RSA加密处理
* @param string $string
* RSA 加密银行卡号/姓名
* @param string $string 待加密字符串
* @param string $encrypted
* @return string
* @return string base64 编码密文
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
@ -103,8 +88,8 @@ class TransfersBank extends BasicWePay
}
/**
* 获取签名文件内容
* @return string
* 获取 RSA 公钥内容
* @return string 公钥内容
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -123,4 +108,18 @@ class TransfersBank extends BasicWePay
Tools::setCache($cacheKey, $data['pub_key'], 600);
return $data['pub_key'];
}
/**
* 查询企业付款到银行卡结果
* @param string $partnerTradeNo 商户订单号
* @return array 付款状态
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function query($partnerTradeNo)
{
$this->params->offsetUnset('appid');
$url = 'https://api.mch.weixin.qq.com/mmpaysptrans/query_bank';
return $this->callPostApi($url, ['partner_trade_no' => $partnerTradeNo], true, 'MD5', false);
}
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -22,7 +22,6 @@ use WePayV3\Contracts\DecryptAes;
/**
* 平台证书管理
* Class Cert
* @package WePayV3
*/
class Cert extends BasicWePay
@ -35,7 +34,7 @@ class Cert extends BasicWePay
protected $autoCert = false;
/**
* 商户平台下载证书
* 下载并缓存平台证书
* @return void
* @throws \WeChat\Exceptions\InvalidResponseException
*/

View File

@ -5,8 +5,7 @@ namespace WePayV3;
use WePayV3\Contracts\BasicWePay;
/**
* 普通商户消费者投诉2.0
* @class Complaints
* 消费者投诉 2.0
* @package WePayV3
*/
class Complaints extends BasicWePay
@ -14,11 +13,11 @@ class Complaints extends BasicWePay
/**
* 查询投诉列表
* @param int $offset 分页开始位置
* @param int $offset 分页起始
* @param int $limit 分页大小
* @param String $begin_date 开始日期
* @param String $end_date 结束日期
* @return array|string
* @param string $begin_date 开始日期YYYY-MM-DD
* @param string $end_date 结束日期YYYY-MM-DD
* @return array|string 投诉列表
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function complaintList($offset, $limit, $begin_date, $end_date)
@ -30,8 +29,8 @@ class Complaints extends BasicWePay
/**
* 查询投诉详情
* @param string $complaint_id 投诉单号
* @return array|string
* @param string $complaint_id 投诉单号
* @return array|string 投诉详情
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function complaintDetails($complaint_id)
@ -42,8 +41,8 @@ class Complaints extends BasicWePay
/**
* 查询投诉协商历史
* @param string $complaint_id 投诉单号
* @return array|string
* @param string $complaint_id 投诉单号
* @return array|string 协商记录
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function negotiationHistory($complaint_id)
@ -54,7 +53,7 @@ class Complaints extends BasicWePay
/**
* 创建投诉通知回调地址
* @param string $url 回调通知地址
* @param string $url 回调地址
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -77,7 +76,7 @@ class Complaints extends BasicWePay
/**
* 更新投诉通知回调地址
* @param string $url 回调通知地址
* @param string $url 回调地址
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -98,8 +97,8 @@ class Complaints extends BasicWePay
/**
* 回复投诉
* @param string $complaint_id 投诉单号
* @param array $content 回复内容
* @param string $complaint_id 投诉单号
* @param array $content 回复内容(含跳转链接、文本等)
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -111,8 +110,8 @@ class Complaints extends BasicWePay
}
/**
* 反馈处理完成
* @param string $complaint_id 投诉单号
* 标记投诉处理完成
* @param string $complaint_id 投诉单号
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -124,8 +123,8 @@ class Complaints extends BasicWePay
}
/**
* 图片请求接口
* @param string $pathinfo
* 下载投诉图片
* @param string $pathinfo 文件路径(接口返回的下载地址 path
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -135,8 +134,8 @@ class Complaints extends BasicWePay
}
/**
* 图片上传接口
* @param array $imginfo
* 上传投诉相关图片
* @param array $imginfo 图片上传参数(文件流对应的 media 字段等)
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -24,23 +24,20 @@ use WePayV3\Cert;
/**
* 微信支付基础类
* Class BasicWePay
* @package WePayV3
* @package WePayV3\Contracts
*/
abstract class BasicWePay
{
/**
* 接口基础地址
* @var string
*/
protected $base = 'https://api.mch.weixin.qq.com';
/**
* 实例对象静态缓存
* @var array
*/
protected static $cache = [];
/**
* 接口基础地址
* @var string
*/
protected $base = 'https://api.mch.weixin.qq.com';
/**
* 自动配置平台证书
* @var bool
@ -150,6 +147,94 @@ abstract class BasicWePay
// }
}
/**
* 设置证书内容
* @param string $key 证书ID或序号
* @param string $cert 证书文本内容
* @return string
* @throws \WeChat\Exceptions\InvalidResponseException
*/
private function withCertContent($key, $cert)
{
if (substr(trim($cert), 0, 5) == '-----') {
$this->config['cert_package'][$key] = $cert;
} elseif (file_exists($cert)) {
$this->config['cert_package'][$key] = file_get_contents($cert);
} else {
throw new InvalidResponseException("证书设置失败!");
}
return $cert;
}
/**
* 获取支付证书
* @return mixed|string
*/
private function withCertPayment()
{
foreach ($this->config['cert_package'] as $key => $cert) {
if (strpos($key, 'PUB_KEY_ID_') === 0) {
if (empty($this->config['mp_cert_serial']) || empty($this->config['mp_cert_content'])) {
$this->config['mp_cert_serial'] = $key;
$this->config['mp_cert_content'] = $cert;
}
return $cert;
}
}
return '';
}
/**
* 自动配置平台证书
* @return void
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
protected function _autoCert()
{
$certs = $this->tmpFile("{$this->config['mch_id']}_certs");
if (is_array($certs)) foreach ($certs as $k => $v) {
if ($v['expire'] < time()) unset($certs[$k]);
}
if (empty($certs)) {
Cert::instance($this->config)->download();
$certs = $this->tmpFile("{$this->config['mch_id']}_certs");
}
if (empty($certs) || !is_array($certs)) {
throw new InvalidResponseException("读取平台证书失败!");
}
foreach ($certs as $k => $v) if ($v['expire'] > time() + 10) {
$this->config['cert_package'][$k] = $v['content'];
if (empty($this->config['mp_cert_serial'])) {
$this->config['mp_cert_serial'] = $k;
$this->config['mp_cert_content'] = $v['content'];
}
}
if (empty($this->config['cert_package'])) {
throw new InvalidResponseException("自动配置平台证书失败!");
}
}
/**
* 写入或读取临时文件
* @param string $name
* @param null|array|string $content
* @param integer $expire
* @return array|string
* @throws \WeChat\Exceptions\LocalCacheException
*/
protected function tmpFile($name, $content = null, $expire = 7200)
{
if (is_null($content)) {
$text = Tools::getCache($name);
if (empty($text)) return '';
$json = json_decode(Tools::getCache($name) ?: '', true);
return isset($json[0]) ? $json[0] : '';
} else {
return Tools::setCache($name, json_encode([$content], JSON_UNESCAPED_UNICODE), $expire);
}
}
/**
* 静态创建对象
* @param array $config
@ -164,61 +249,6 @@ abstract class BasicWePay
return self::$cache[$key] = new static($config);
}
/**
* 模拟发起请求
* @param string $method 请求访问
* @param string $pathinfo 请求路由
* @param string $jsondata 请求数据
* @param boolean $verify 是否验证
* @param boolean $isjson 返回JSON
* @return array|string
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function doRequest($method, $pathinfo, $jsondata = '', $verify = false, $isjson = true)
{
list($time, $nonce) = [time(), uniqid() . rand(1000, 9999)];
$signstr = join("\n", [$method, $pathinfo, $time, $nonce, $jsondata, '']);
// 生成数据签名TOKEN
$token = sprintf('mchid="%s",nonce_str="%s",timestamp="%d",serial_no="%s",signature="%s"',
$this->config['mch_id'], $nonce, $time, $this->config['cert_serial'], $this->signBuild($signstr)
);
$location = (preg_match('|^https?://|', $pathinfo) ? '' : $this->base) . $pathinfo;
list($header, $content) = $this->_doRequestCurl($method, $location, [
'data' => $jsondata, 'header' => [
'Accept: application/json',
'Content-Type: application/json',
'User-Agent: https://thinkadmin.top',
"Authorization: WECHATPAY2-SHA256-RSA2048 {$token}",
"Wechatpay-Serial: {$this->config['mp_cert_serial']}"
],
]);
if ($verify) {
$headers = [];
foreach (explode("\n", $header) as $line) {
if (stripos($line, 'Wechatpay') !== false) {
list($name, $value) = explode(':', $line);
list(, $keys) = explode('wechatpay-', strtolower($name));
$headers[$keys] = trim($value);
}
}
try {
if (empty($headers)) {
return $isjson ? json_decode($content, true) : $content;
}
$string = join("\n", [$headers['timestamp'], $headers['nonce'], $content, '']);
if (!$this->signVerify($string, $headers['signature'], $headers['serial'])) {
throw new InvalidResponseException('验证响应签名失败');
}
} catch (\Exception $exception) {
throw new InvalidResponseException($exception->getMessage(), $exception->getCode());
}
}
return $isjson ? json_decode($content, true) : $content;
}
/**
* 模拟发起上传请求
* @param string $pathinfo 请求路由
@ -295,6 +325,38 @@ abstract class BasicWePay
return $isjson ? json_decode($content, true) : $content;
}
/**
* 生成数据签名
* @param string $data 签名内容
* @return string
*/
protected function signBuild($data)
{
$pkeyid = openssl_pkey_get_private($this->config['cert_private']);
if ($pkeyid === false) {
throw new InvalidArgumentException("Invalid private key -- [cert_private]");
}
$signature = '';
if (!openssl_sign($data, $signature, $pkeyid, 'sha256WithRSAEncryption')) {
$this->freeKey($pkeyid);
throw new InvalidArgumentException("Failed to sign data with private key");
}
$this->freeKey($pkeyid);
return base64_encode($signature);
}
/**
* 兼容释放 OpenSSL 密钥资源
* @param mixed $pkey
* @return void
*/
protected function freeKey($pkey)
{
// PHP 8+ 中 openssl_free_key 已废弃,交由运行时回收即可。
if (version_compare(PHP_VERSION, '8.0.0', '<') && function_exists('openssl_free_key')) {
openssl_free_key($pkey);
}
}
/**
* 通过CURL模拟网络请求
@ -327,18 +389,6 @@ abstract class BasicWePay
return [substr($content, 0, $headerSize), substr($content, $headerSize)];
}
/**
* 生成数据签名
* @param string $data 签名内容
* @return string
*/
protected function signBuild($data)
{
$pkeyid = openssl_pkey_get_private($this->config['cert_private']);
openssl_sign($data, $signature, $pkeyid, 'sha256WithRSAEncryption');
return base64_encode($signature);
}
/**
* 验证内容签名
* @param string $data 签名内容
@ -392,54 +442,79 @@ abstract class BasicWePay
}
/**
* 自动配置平台证书
* @return void
* 通用接口调用(微信支付 V3
* @param string $url 完整 URL 或相对路径(如 /v3/pay/transactions/jsapi
* @param array|string $data 请求体,数组自动 JSON字符串原样发送
* @param string $method GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS默认 POST
* @param bool $verify 是否验证返回签名
* @return array 解析后的数组
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
protected function _autoCert()
public function callApi($url, $data = '', $method = 'POST', $verify = false)
{
$certs = $this->tmpFile("{$this->config['mch_id']}_certs");
if (is_array($certs)) foreach ($certs as $k => $v) {
if ($v['expire'] < time()) unset($certs[$k]);
}
if (empty($certs)) {
Cert::instance($this->config)->download();
$certs = $this->tmpFile("{$this->config['mch_id']}_certs");
}
if (empty($certs) || !is_array($certs)) {
throw new InvalidResponseException("读取平台证书失败!");
}
foreach ($certs as $k => $v) if ($v['expire'] > time() + 10) {
$this->config['cert_package'][$k] = $v['content'];
if (empty($this->config['mp_cert_serial'])) {
$this->config['mp_cert_serial'] = $k;
$this->config['mp_cert_content'] = $v['content'];
}
}
if (empty($this->config['cert_package'])) {
throw new InvalidResponseException("自动配置平台证书失败!");
$method = strtoupper($method);
// 处理数据
if (is_array($data)) {
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
}
return $this->doRequest($method, $url, $data, $verify, true);
}
/**
* 写入或读取临时文件
* @param string $name
* @param null|array|string $content
* @param integer $expire
* 模拟发起请求
* @param string $method 请求访问
* @param string $pathinfo 请求路由
* @param string $jsondata 请求数据
* @param boolean $verify 是否验证
* @param boolean $isjson 返回JSON
* @return array|string
* @throws \WeChat\Exceptions\LocalCacheException
* @throws \WeChat\Exceptions\InvalidResponseException
*/
protected function tmpFile($name, $content = null, $expire = 7200)
public function doRequest($method, $pathinfo, $jsondata = '', $verify = false, $isjson = true)
{
if (is_null($content)) {
$text = Tools::getCache($name);
if (empty($text)) return '';
$json = json_decode(Tools::getCache($name) ?: '', true);
return isset($json[0]) ? $json[0] : '';
} else {
return Tools::setCache($name, json_encode([$content], JSON_UNESCAPED_UNICODE), $expire);
list($time, $nonce) = [time(), uniqid() . rand(1000, 9999)];
$signstr = join("\n", [$method, $pathinfo, $time, $nonce, $jsondata, '']);
// 生成数据签名TOKEN
$token = sprintf('mchid="%s",nonce_str="%s",timestamp="%d",serial_no="%s",signature="%s"',
$this->config['mch_id'], $nonce, $time, $this->config['cert_serial'], $this->signBuild($signstr)
);
$location = (preg_match('|^https?://|', $pathinfo) ? '' : $this->base) . $pathinfo;
list($header, $content) = $this->_doRequestCurl($method, $location, [
'data' => $jsondata, 'header' => [
'Accept: application/json',
'Content-Type: application/json',
'User-Agent: https://thinkadmin.top',
"Authorization: WECHATPAY2-SHA256-RSA2048 {$token}",
"Wechatpay-Serial: {$this->config['mp_cert_serial']}"
],
]);
if ($verify) {
$headers = [];
foreach (explode("\n", $header) as $line) {
if (stripos($line, 'Wechatpay') !== false) {
list($name, $value) = explode(':', $line);
list(, $keys) = explode('wechatpay-', strtolower($name));
$headers[$keys] = trim($value);
}
}
try {
if (empty($headers)) {
return $isjson ? json_decode($content, true) : $content;
}
$string = join("\n", [$headers['timestamp'], $headers['nonce'], $content, '']);
if (!$this->signVerify($string, $headers['signature'], $headers['serial'])) {
throw new InvalidResponseException('验证响应签名失败');
}
} catch (\Exception $exception) {
throw new InvalidResponseException($exception->getMessage(), $exception->getCode());
}
}
return $isjson ? json_decode($content, true) : $content;
}
/**
@ -457,41 +532,4 @@ abstract class BasicWePay
throw new InvalidDecryptException('Rsa Encrypt Error.');
}
}
/**
* 设置证书内容
* @param string $key 证书ID或序号
* @param string $cert 证书文本内容
* @return string
* @throws \WeChat\Exceptions\InvalidResponseException
*/
private function withCertContent($key, $cert)
{
if (substr(trim($cert), 0, 5) == '-----') {
$this->config['cert_package'][$key] = $cert;
} elseif (file_exists($cert)) {
$this->config['cert_package'][$key] = file_get_contents($cert);
} else {
throw new InvalidResponseException("证书设置失败!");
}
return $cert;
}
/**
* 获取支付证书
* @return mixed|string
*/
private function withCertPayment()
{
foreach ($this->config['cert_package'] as $key => $cert) {
if (strpos($key, 'PUB_KEY_ID_') === 0) {
if (empty($this->config['mp_cert_serial']) || empty($this->config['mp_cert_content'])) {
$this->config['mp_cert_serial'] = $key;
$this->config['mp_cert_content'] = $cert;
}
return $cert;
}
}
return '';
}
}
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -21,16 +21,14 @@ use WeChat\Exceptions\InvalidDecryptException;
/**
* Aes 解密工具类
* Class DecryptAes
* @package WePayV3\Contracts
*/
class DecryptAes
{
private $aesKey;
const KEY_LENGTH_BYTE = 32;
const AUTH_TAG_LENGTH_BYTE = 16;
private $aesKey;
/**
* Constructor

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,8 +20,7 @@ use WeChat\Exceptions\InvalidResponseException;
use WePayV3\Contracts\BasicWePay;
/**
* 微信支付代金券
* @class Coupon
* 微信支付代金券 (V3)
* @package WePayV3
*/
class Coupon extends BasicWePay
@ -30,7 +29,7 @@ class Coupon extends BasicWePay
/**
* 创建代金券批次
* @param array $data
* @param array $data 批次参数stock_name, belong_merchant 等)
* @return array|string
* @throws InvalidResponseException
*/
@ -83,7 +82,7 @@ class Coupon extends BasicWePay
* 查询批次详情
* @param string $stock_id 批次号
* @param string $stock_creator_mchid 创建批次的商户号
* @return array|string
* @return array|string 批次详情
* @throws InvalidResponseException
*/
public function stocksDetail($stock_id, $stock_creator_mchid)
@ -94,7 +93,7 @@ class Coupon extends BasicWePay
/**
* 代金券批次可用商品
* @param array $param
* @param array $param 包含 stock_id
* @return array|string
* @throws InvalidResponseException
*/
@ -106,7 +105,7 @@ class Coupon extends BasicWePay
/**
* 设置消息通知地址
* @param array $param
* @param array $param 回调参数notify_url, switch 等)
* @return array|string
* @throws InvalidResponseException
*/
@ -117,8 +116,8 @@ class Coupon extends BasicWePay
}
/**
* 发放代金券批次
* @param array $param 请求参数
* 发放代金券
* @param array $param 请求参数openid, stock_id 等)
* @return array|string
* @throws InvalidResponseException
*/
@ -129,9 +128,9 @@ class Coupon extends BasicWePay
}
/**
* 根据商户号查用户的券
* @param array $param 请求参数
* @return array|string
* 查询用户名下券(按商户号)
* @param array $param 请求参数openid, appid, stock_id 等)
* @return array|string 券列表
* @throws InvalidResponseException
*/
public function couponsList(array $param)
@ -141,10 +140,10 @@ class Coupon extends BasicWePay
}
/**
* 查询代金券详情
* @param string $openid 用户openid
* @param string $coupon_id 代金券id
* @param string $appid 公众账号ID
* 查询单张代金券详情
* @param string $openid 用户 openid
* @param string $coupon_id 代金券 id
* @param string $appid 公众账号或小程序 appid
* @return array|string
* @throws InvalidResponseException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -20,15 +20,14 @@ use WeChat\Contracts\Tools;
use WePayV3\Contracts\BasicWePay;
/**
* 平台收付通
* @class Ecommerce
* 收付通(特约/二级商户、合单、分账等)
* @package WePayV3
*/
class Ecommerce extends BasicWePay
{
/**
* 提交申请单(商户进件)
* @param array $data 进件参数
* 提交进件申请
* @param array $data 进件参数(含证件、账户、联系人,敏感字段自动 RSA
* @return array
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
@ -64,7 +63,7 @@ class Ecommerce extends BasicWePay
}
/**
* 通过业务申请编号查询申请状态(商户进件)
* 按业务申请编号查询进件状态
* @param string $out_request_no 业务申请编号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
@ -76,7 +75,7 @@ class Ecommerce extends BasicWePay
}
/**
* 通过申请单ID查询申请状态商户进件
* 按申请单 ID 查询进件状态
* @param string $applyment_id 微信支付申请单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
@ -88,9 +87,9 @@ class Ecommerce extends BasicWePay
}
/**
* 修改结算账户(商户进件)
* @param string $sub_mchid 特约商户/二级商户号
* @param array $data 包体参数
* 修改结算账户
* @param string $sub_mchid 特约/二级商户号
* @param array $data 账户参数(敏感字段需 RSA
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -101,8 +100,8 @@ class Ecommerce extends BasicWePay
}
/**
* 查询结算账户修改申请状态(商户进件)
* @param string $sub_mchid 特约商户/二级商户号
* 查询结算账户修改状态
* @param string $sub_mchid 特约/二级商户号
* @param string $application_no 修改结算账户申请单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
@ -115,8 +114,8 @@ class Ecommerce extends BasicWePay
/**
* 查询结算账户(商户进件)
* @param string $sub_mchid 特约商户/二级商户号
* 查询结算账户
* @param string $sub_mchid 特约/二级商户号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -127,8 +126,8 @@ class Ecommerce extends BasicWePay
}
/**
* 上传文件(商户进件)
* @param string $filename 文件目录
* 上传进件所需图片/文件
* @param string $filename 本地文件路径
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -138,8 +137,8 @@ class Ecommerce extends BasicWePay
}
/**
* APP下单(普通支付)
* @param array $data POST请求参数
* 合作方 APP 下单
* @param array $data 下单参数sp_mchid, sub_mchid, description, out_trade_no, notify_url 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -150,8 +149,8 @@ class Ecommerce extends BasicWePay
}
/**
* JSAPI下单(普通支付)
* @param array $data POST请求参数
* 合作方 JSAPI 下单
* @param array $data 下单参数(含 payer.openid 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -162,8 +161,8 @@ class Ecommerce extends BasicWePay
}
/**
* Native下单(普通支付)
* @param array $data POST请求参数
* 合作方 Native 下单
* @param array $data 下单参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -174,8 +173,8 @@ class Ecommerce extends BasicWePay
}
/**
* H5下单(普通支付)
* @param array $data POST请求参数
* 合作方 H5 下单
* @param array $data 下单参数(含 scene_info 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -186,9 +185,9 @@ class Ecommerce extends BasicWePay
}
/**
* 微信支付订单号查询订单(普通支付
* @param string $transaction_id
* @param string $sub_mchid
* 订单查询(按微信交易号
* @param string $transaction_id 微信订单号
* @param string $sub_mchid 二级商户号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -200,9 +199,9 @@ class Ecommerce extends BasicWePay
}
/**
* 微信支付商户订单号查询订单(普通支付
* @param string $out_trade_no
* @param string $sub_mchid
* 订单查询(按商户订单号
* @param string $out_trade_no 商户订单号
* @param string $sub_mchid 二级商户号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -214,9 +213,9 @@ class Ecommerce extends BasicWePay
}
/**
* 关闭订单(普通支付)
* 关闭订单
* @param string $out_trade_no 商户订单号
* @param array $data POST请求参数
* @param array $data 包含 sub_mchid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -228,8 +227,8 @@ class Ecommerce extends BasicWePay
}
/**
* JSAPI支付合单下单
* @param array $data POST请求参数
* 合单 JSAPI 下单
* @param array $data 合单参数combine_out_trade_no, sub_orders 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -240,8 +239,8 @@ class Ecommerce extends BasicWePay
}
/**
* APP支付合单下单
* @param array $data POST请求参数
* 合单 APP 下单
* @param array $data 合单参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -252,8 +251,8 @@ class Ecommerce extends BasicWePay
}
/**
* H5支付合单下单
* @param array $data POST请求参数
* 合单 H5 下单
* @param array $data 合单参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -264,8 +263,8 @@ class Ecommerce extends BasicWePay
}
/**
* Native支付合单下单
* @param array $data POST请求参数
* 合单 Native 下单
* @param array $data 合单参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -276,8 +275,8 @@ class Ecommerce extends BasicWePay
}
/**
* 合单查询(合单支付)
* @param string $combine_out_trade_no
* 合单查询
* @param string $combine_out_trade_no 合单商户订单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -288,9 +287,9 @@ class Ecommerce extends BasicWePay
}
/**
* 合单关单(合单下单)
* @param $combine_out_trade_no
* @param array $data POST请求参数
* 合单关单
* @param string $combine_out_trade_no 合单商户订单号
* @param array $data 包含 sub_orders
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -301,8 +300,8 @@ class Ecommerce extends BasicWePay
}
/**
* 请求分账(分账)
* @param array $data POST请求参数
* 电商平台发起分账
* @param array $data 分账参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -313,8 +312,8 @@ class Ecommerce extends BasicWePay
}
/**
* 查询分账结果(分账)
* @param array $param
* 查询分账结果
* @param array $param 查询参数sub_mchid, transaction_id, out_order_no 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -325,8 +324,8 @@ class Ecommerce extends BasicWePay
}
/**
* 请求分账回退(分账)
* @param array $data POST请求参数
* 请求分账回退
* @param array $data 回退参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -337,8 +336,8 @@ class Ecommerce extends BasicWePay
}
/**
* 查询分账回退结果(分账)
* @param array $param
* 查询分账回退结果
* @param array $param 查询参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -349,8 +348,8 @@ class Ecommerce extends BasicWePay
}
/**
* 完结分账(分账)
* @param array $data POST请求参数
* 完结分账
* @param array $data 完结参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -361,7 +360,7 @@ class Ecommerce extends BasicWePay
}
/**
* 查询订单剩余待分金额(分账)
* 查询订单待分金额
* @param string $transaction_id 微信订单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
@ -373,8 +372,8 @@ class Ecommerce extends BasicWePay
}
/**
* 添加分账接收方(分账)
* @param array $data POST请求参数
* 添加分账接收方
* @param array $data 接收方参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -385,8 +384,8 @@ class Ecommerce extends BasicWePay
}
/**
* 添加分账接收方(分账)
* @param array $data POST请求参数
* 删除分账接收方
* @param array $data 接收方参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -397,8 +396,8 @@ class Ecommerce extends BasicWePay
}
/**
* 请求补差(补差)
* @param array $data POST请求参数
* 请求补差
* @param array $data 补差参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -409,8 +408,8 @@ class Ecommerce extends BasicWePay
}
/**
* 请求补差回退(补差)
* @param array $data POST请求参数
* 补差回退
* @param array $data 回退参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -421,8 +420,8 @@ class Ecommerce extends BasicWePay
}
/**
* 取消补差(补差)
* @param array $data POST请求参数
* 取消补差
* @param array $data 取消参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -433,8 +432,8 @@ class Ecommerce extends BasicWePay
}
/**
* 申请退款(退款)
* @param array $data POST请求参数
* 申请退款
* @param array $data 退款参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -445,9 +444,9 @@ class Ecommerce extends BasicWePay
}
/**
* 查询单笔退款(按商户退款单号)(退款)
* @param string $refund_id
* @param string $sub_mchid
* 查询单笔退款(按微信退款号)
* @param string $refund_id 微信退款号
* @param string $sub_mchid 二级商户号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -458,9 +457,9 @@ class Ecommerce extends BasicWePay
}
/**
* 查询单笔退款(按商户退款号)(退款)
* @param string $out_refund_no
* @param string $sub_mchid
* 查询单笔退款(按商户退款号)
* @param string $out_refund_no 商户退款单号
* @param string $sub_mchid 二级商户号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -471,9 +470,9 @@ class Ecommerce extends BasicWePay
}
/**
* 查询垫付回补结果(退款)
* @param string $refund_id
* @param string $sub_mchid
* 查询垫付回补结果
* @param string $refund_id 微信退款号
* @param string $sub_mchid 二级商户号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -485,8 +484,8 @@ class Ecommerce extends BasicWePay
/**
* 垫付退款回补
* @param string $refund_id
* @param array $data
* @param string $refund_id 微信退款号
* @param array $data 回补参数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -24,7 +24,6 @@ use WePayV3\Contracts\DecryptAes;
/**
* 直连商户 | 订单支付接口
* Class Order
* @package WePayV3
*/
class Order extends BasicWePay
@ -35,10 +34,10 @@ class Order extends BasicWePay
const WXPAY_NATIVE = 'native';
/**
* 创建支付订单
* @param string $type 支付类型
* @param array $data 支付参数
* @return array
* 创建支付订单V3
* @param string $type 支付类型 h5|app|jsapi|native
* @param array $data 支付参数按各场景必填appid, mchid, description, out_trade_no, notify_url 等)
* @return array 预支付结果或前端调起参数
* @throws \WeChat\Exceptions\InvalidResponseException
* @document https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml
*/
@ -53,6 +52,13 @@ class Order extends BasicWePay
if (empty($types[$type])) {
throw new InvalidArgumentException("Payment {$type} not defined.");
} else {
// 自动填充 mchid 和 appid如果未提供
if (empty($data['mchid']) && !empty($this->config['mch_id'])) {
$data['mchid'] = $this->config['mch_id'];
}
if (empty($data['appid']) && !empty($this->config['appid'])) {
$data['appid'] = $this->config['appid'];
}
// 创建预支付码
$result = $this->doRequest('POST', $types[$type], json_encode($data, JSON_UNESCAPED_UNICODE), true);
if (empty($result['h5_url']) && empty($result['code_url']) && empty($result['prepay_id'])) {
@ -78,8 +84,8 @@ class Order extends BasicWePay
/**
* 支付订单查询
* @param string $tradeNo 单号
* @return array
* @param string $tradeNo 商户订单号 out_trade_no
* @return array 订单详情
* @throws \WeChat\Exceptions\InvalidResponseException
* @document https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_2.shtml
*/
@ -91,8 +97,8 @@ class Order extends BasicWePay
/**
* 关闭支付订单
* @param string $tradeNo 单号
* @return array
* @param string $tradeNo 商户订单号 out_trade_no
* @return array 关闭结果
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function close($tradeNo)
@ -103,31 +109,9 @@ class Order extends BasicWePay
}
/**
* 支付通知解析
* @param array|null $data
* @return array
* @throws \WeChat\Exceptions\InvalidDecryptException
*/
public function notify($data = [])
{
if (empty($data)) {
$data = json_decode(Tools::getRawInput(), true);
}
if (isset($data['resource'])) {
$aes = new DecryptAes($this->config['mch_v3_key']);
$data['result'] = $aes->decryptToString(
$data['resource']['associated_data'],
$data['resource']['nonce'],
$data['resource']['ciphertext']
);
}
return $data;
}
/**
* 创建退款订单
* @param array $data 退款参数
* @return array
* 创建退款订单V3
* @param array $data 退款参数out_trade_no transaction_idout_refund_noamount 等)
* @return array 退款结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @document https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_9.shtml
*/
@ -139,8 +123,8 @@ class Order extends BasicWePay
/**
* 退款订单查询
* @param string $refundNo 退款单号
* @return array
* @param string $refundNo 商户退款单号 out_refund_no
* @return array 退款详情
* @throws \WeChat\Exceptions\InvalidResponseException
* @document https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_10.shtml
*/
@ -162,10 +146,32 @@ class Order extends BasicWePay
return $this->notify($data);
}
/**
* 支付/退款通知解析(自动解密 resource
* @param array|null $data 通知原文,为空则从输入流读取
* @return array 解析后的通知数据,包含 result 字段(明文)
* @throws \WeChat\Exceptions\InvalidDecryptException
*/
public function notify($data = [])
{
if (empty($data)) {
$data = json_decode(Tools::getRawInput(), true);
}
if (isset($data['resource'])) {
$aes = new DecryptAes($this->config['mch_v3_key']);
$data['result'] = $aes->decryptToString(
$data['resource']['associated_data'],
$data['resource']['nonce'],
$data['resource']['ciphertext']
);
}
return $data;
}
/**
* 申请交易账单
* @param array|string $params
* @return array
* @param array|string $params 账单参数bill_date, bill_type 等)或已拼好的查询串
* @return array 含下载地址的申请结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @document https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_6.shtml
*/
@ -177,8 +183,8 @@ class Order extends BasicWePay
/**
* 申请资金账单
* @param array|string $params
* @return array
* @param array|string $params 账单参数bill_date, account_type 等)或已拼好的查询串
* @return array 含下载地址的申请结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @document https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_7.shtml
*/
@ -190,8 +196,8 @@ class Order extends BasicWePay
/**
* 下载账单文件
* @param string $fileurl
* @return string 二进制 Excel 内容
* @param string $fileurl 申请账单返回的 download_url
* @return string 二进制内容gzip/CSV/Excel
* @throws \WeChat\Exceptions\InvalidResponseException
* @document https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_6_1.shtml
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,15 +19,14 @@ namespace WePayV3;
use WePayV3\Contracts\BasicWePay;
/**
* 普通商户商家分账
* Class Profitsharing
* 商家分账 (V3)
* @package WePayV3
*/
class ProfitSharing extends BasicWePay
{
/**
* 请求分账
* @param array $options
* @param array $options 分账参数transaction_id, out_order_no, receivers 等)
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -41,7 +40,7 @@ class ProfitSharing extends BasicWePay
* 查询分账结果
* @param string $outOrderNo 商户分账单号
* @param string $transactionId 微信订单号
* @return array
* @return array 分账状态
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function query($outOrderNo, $transactionId)
@ -52,7 +51,7 @@ class ProfitSharing extends BasicWePay
/**
* 解冻剩余资金
* @param array $options
* @param array $options 解冻参数transaction_id, out_order_no, description
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -64,7 +63,7 @@ class ProfitSharing extends BasicWePay
/**
* 查询剩余待分金额
* @param string $transactionId 微信订单号
* @return array
* @return array 待分金额
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function amounts($transactionId)
@ -75,7 +74,7 @@ class ProfitSharing extends BasicWePay
/**
* 添加分账接收方
* @param array $options
* @param array $options 接收方信息type, account, name name RSA
* @return array
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
@ -91,7 +90,7 @@ class ProfitSharing extends BasicWePay
/**
* 删除分账接收方
* @param array $options
* @param array $options 接收方信息type, account
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -103,8 +102,8 @@ class ProfitSharing extends BasicWePay
/**
* 请求分账回退
* @param array $options
* @return array
* @param array $options 回退参数out_return_no, out_order_no, return_account 等)
* @return array 回退结果
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function backspace(array $options)

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -28,9 +28,9 @@ use WePayV3\Contracts\BasicWePay;
class Refund extends BasicWePay
{
/**
* 创建退款订单
* @param array $data 退款参数
* @return array
* 创建退款订单(兼容入口,转调 Order::createRefund
* @param array $data 退款参数out_trade_no transaction_idout_refund_noamount 等)
* @return array 退款结果
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -41,9 +41,9 @@ class Refund extends BasicWePay
}
/**
* 退款订单查询
* @param string $refundNo 退款单号
* @return array
* 退款订单查询(兼容入口)
* @param string $refundNo 商户退款单号 out_refund_no
* @return array 退款详情
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
@ -55,9 +55,9 @@ class Refund extends BasicWePay
}
/**
* 获取退款通知
* @param mixed $xml
* @return array
* 获取退款通知(兼容入口,转调 Order::notify
* @param mixed $xml 通知原文
* @return array 解密后的通知数据
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -19,16 +19,15 @@ namespace WePayV3;
use WePayV3\Contracts\BasicWePay;
/**
* 普通商户商家转账到零钱
* @class Transfers
* 商家转账到零钱 (V3)
* @package WePayV3
*/
class Transfers extends BasicWePay
{
/**
* 新版商家转换到零钱
* @param $body
* 商家转账到零钱(单笔)
* @param array $body 转账参数out_bill_no, transfer_amount, openid/user_name 等,敏感字段需 RSA
* @return array|string
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
@ -47,8 +46,8 @@ class Transfers extends BasicWePay
/**
* 查询转账结果
* @param $out_bill_no
* @return array|string
* @param string $out_bill_no 商户转账单号
* @return array|string 转账状态
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function billsQuery($out_bill_no)
@ -58,7 +57,7 @@ class Transfers extends BasicWePay
/**
* 发起商家批量转账
* @param array $body
* @param array $body 批量参数out_batch_no, transfer_detail_list 等,姓名需 RSA
* @return array
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
@ -84,13 +83,13 @@ class Transfers extends BasicWePay
}
/**
* 通过微信批次单号查询批次
* @param string $batchId 微信批次单号(二选一)
* @param string $outBatchNo 家批次单号(二选一)
* @param boolean $needQueryDetail 查询指定状态
* @param integer $offset 请求资源的起始位置
* @param integer $limit 最大明细条数
* @param string $detailStatus 查询指定状态
* 查询批量转账批
* @param string $batchId 微信批次单号(二选一)
* @param string $outBatchNo 户批次单号(二选一)
* @param bool $needQueryDetail 是否拉取明细
* @param int $offset 明细起始位置
* @param int $limit 最大明细条数
* @param string $detailStatus 明细状态 ALL|SUCCESS|FAIL
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -111,9 +110,9 @@ class Transfers extends BasicWePay
}
/**
* 通过微信明细单号查询明细
* 通过微信明细单号查询明细
* @param string $batchId 微信批次单号
* @param string $detailId 微信支付系统内部区分转账批次单下不同转账明细单的唯一标识
* @param string $detailId 微信明细单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
@ -124,9 +123,9 @@ class Transfers extends BasicWePay
}
/**
* 通过商家明细单号查询明细
* @param string $outBatchNo 商户系统内部的商家批次单号,在商户系统内部唯一
* @param string $outDetailNo 商户系统内部区分转账批次单下不同转账明细单的唯一标识
* 通过商家明细单号查询明细
* @param string $outBatchNo 商户批次单号
* @param string $outDetailNo 商户明细单号
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
@ -32,7 +32,7 @@ try {
'total_amount' => '1', // 支付金额
'subject' => '支付宝订单标题', // 支付订单描述
]);
echo $result . PHP_EOL .'<br></br>'. PHP_EOL;
echo $result . PHP_EOL . '<br></br>' . PHP_EOL;
// 请求关闭订单
$result = $pay->close([

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------

View File

@ -0,0 +1,163 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库https://gitee.com/zoujingli/WeChatDeveloper
// | github 代码仓库https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
/**
* 支付宝通用接口测试
* 测试 callApi() 万能接口方法
*/
try {
// 1. 手动加载入口文件
include "../include.php";
// 2. 准备支付宝配置参数
$config = include "./alipay.php";
// 3. 创建接口实例
$alipay = \We::AliPayWeb($config);
echo "<h2>=== 支付宝通用接口测试 ===</h2>";
// ============================================
// 测试1: GET请求 - 查询订单
// ============================================
echo "<h3>测试1: GET请求 - 查询订单</h3>";
try {
$result = $alipay->callApi(
'alipay.trade.query', // API方法名必填第一参数
[
'out_trade_no' => time() - 3600, // 使用一个可能存在的订单号
],
'GET',
false // 不验证响应签名
);
echo '<pre>';
var_export($result);
echo '</pre>';
} catch (Exception $e) {
echo "错误: " . $e->getMessage() . PHP_EOL;
}
// ============================================
// 测试2: GET请求 - 查询订单(验证签名)
// ============================================
echo "<h3>测试2: GET请求 - 查询订单(验证签名)</h3>";
try {
$result = $alipay->callApi(
'alipay.trade.query', // API方法名
[
'out_trade_no' => time() - 3600,
],
'GET',
true // 验证响应签名
);
echo '<pre>';
var_export($result);
echo '</pre>';
} catch (Exception $e) {
echo "错误: " . $e->getMessage() . PHP_EOL;
}
// ============================================
// 测试3: POST请求 - 订单退款
// ============================================
echo "<h3>测试3: POST请求 - 订单退款</h3>";
echo "<p style='color: orange;'>注意:此测试需要有效的订单号</p>";
try {
$result = $alipay->callApi(
'alipay.trade.refund', // API方法名第一参数
[
'out_trade_no' => time() - 3600,
'refund_amount' => '0.01',
],
'POST',
false // 不验证响应签名
);
echo '<pre>';
var_export($result);
echo '</pre>';
} catch (Exception $e) {
echo "错误: " . $e->getMessage() . PHP_EOL;
echo "<p style='color: gray;'>这是正常的,因为退款需要有效的订单号</p>";
}
// ============================================
// 测试4: GET请求 - 退款查询
// ============================================
echo "<h3>测试4: GET请求 - 退款查询</h3>";
try {
$result = $alipay->callApi(
'alipay.trade.fastpay.refund.query', // API方法名
[
'out_trade_no' => time() - 3600,
'out_request_no' => time() - 3600,
],
'GET',
false // 不验证响应签名
);
echo '<pre>';
var_export($result);
echo '</pre>';
} catch (Exception $e) {
echo "错误: " . $e->getMessage() . PHP_EOL;
}
// ============================================
// 测试5: POST请求 - 关闭订单
// ============================================
echo "<h3>测试5: POST请求 - 关闭订单</h3>";
try {
$result = $alipay->callApi(
'alipay.trade.close', // API方法名
[
'out_trade_no' => time() - 3600,
],
'POST',
false // 不验证响应签名
);
echo '<pre>';
var_export($result);
echo '</pre>';
} catch (Exception $e) {
echo "错误: " . $e->getMessage() . PHP_EOL;
}
// ============================================
// 测试6: PUT请求 - 更新资源(示例)
// ============================================
echo "<h3>测试6: PUT请求 - 更新资源(示例)</h3>";
echo "<p style='color: gray;'>注意此示例仅展示PUT请求用法实际API可能不支持</p>";
try {
// PUT请求示例如果API支持
// $result = $alipay->callApi(
// 'alipay.some.method', // API方法名
// ['key' => 'value'],
// 'PUT',
// false
// );
echo '<pre>PUT请求用法示例已注释</pre>';
} catch (Exception $e) {
echo "错误: " . $e->getMessage() . PHP_EOL;
}
echo "<h3 style='color: green;'>=== 所有测试完成 ===</h3>";
} catch (Exception $e) {
// 出错啦,处理下吧
echo "<h3 style='color: red;'>错误: " . $e->getMessage() . "</h3>";
echo "<pre>" . $e->getTraceAsString() . "</pre>";
}

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// | 版权所有 2014~2026 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More