同步更新代码

This commit is contained in:
邹景立 2024-01-29 21:34:47 +08:00
parent 8f8f9867c8
commit 02623f2489
36 changed files with 95 additions and 65 deletions

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -111,9 +111,9 @@ class Push extends Controller
$this->encrypt = $this->wechat->isEncrypt(); $this->encrypt = $this->wechat->isEncrypt();
$this->receive = $this->_arrayChangeKeyCase($this->wechat->getReceive()); $this->receive = $this->_arrayChangeKeyCase($this->wechat->getReceive());
} }
$this->fromOpenid = $this->receive['tousername']; $this->fromOpenid = $this->receive['tousername'] ?? '';
// 消息类型text, event, image, voice, shortvideo, location, link // 消息类型text, event, image, voice, shortvideo, location, link
if (method_exists($this, ($method = $this->receive['msgtype']))) { if (method_exists($this, ($method = $this->receive['msgtype'] ?? ''))) {
if (is_string($result = $this->$method())) return $result; if (is_string($result = $this->$method())) return $result;
} else { } else {
$this->app->log->notice("The {$method} event pushed by wechat was not handled. from {$this->openid}"); $this->app->log->notice("The {$method} event pushed by wechat was not handled. from {$this->openid}");
@ -121,7 +121,7 @@ class Push extends Controller
} catch (\Exception $exception) { } catch (\Exception $exception) {
$this->app->log->error("{$exception->getFile()}:{$exception->getLine()} [{$exception->getCode()}] {$exception->getMessage()}"); $this->app->log->error("{$exception->getFile()}:{$exception->getLine()} [{$exception->getCode()}] {$exception->getMessage()}");
} }
return 'success'; return $this->fromOpenid ? 'success' : '';
} }
/** /**

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin // | Wechat Plugin for ThinkAdmin
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 版权所有 2014~2023 Anyon <zoujingli@qq.com> // | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top // | 官方网站: https://thinkadmin.top
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -33,6 +33,7 @@ use think\Response;
* @method \WeChat\Custom WeChatCustom() static 微信客服消息 * @method \WeChat\Custom WeChatCustom() static 微信客服消息
* @method \WeChat\Limit WeChatLimit() static 接口调用频次限制 * @method \WeChat\Limit WeChatLimit() static 接口调用频次限制
* @method \WeChat\Media WeChatMedia() static 微信素材管理 * @method \WeChat\Media WeChatMedia() static 微信素材管理
* @method \WeChat\Draft WeChatDraft() static 微信草稿箱管理
* @method \WeChat\Menu WeChatMenu() static 微信菜单管理 * @method \WeChat\Menu WeChatMenu() static 微信菜单管理
* @method \WeChat\Oauth WeChatOauth() static 微信网页授权 * @method \WeChat\Oauth WeChatOauth() static 微信网页授权
* @method \WeChat\Pay WeChatPay() static 微信支付商户 * @method \WeChat\Pay WeChatPay() static 微信支付商户
@ -46,6 +47,7 @@ use think\Response;
* @method \WeChat\Template WeChatTemplate() static 微信模板消息 * @method \WeChat\Template WeChatTemplate() static 微信模板消息
* @method \WeChat\User WeChatUser() static 微信粉丝管理 * @method \WeChat\User WeChatUser() static 微信粉丝管理
* @method \WeChat\Wifi WeChatWifi() static 微信门店WIFI管理 * @method \WeChat\Wifi WeChatWifi() static 微信门店WIFI管理
* @method \WeChat\Freepublish WeChatFreepublish() static 发布能力
* *
* ----- WeMini ----- * ----- WeMini -----
* @method \WeMini\Account WeMiniAccount() static 小程序账号管理 * @method \WeMini\Account WeMiniAccount() static 小程序账号管理
@ -57,9 +59,13 @@ use think\Response;
* -------------------- * --------------------
* @method \WeMini\Crypt WeMiniCrypt() static 小程序数据加密处理 * @method \WeMini\Crypt WeMiniCrypt() static 小程序数据加密处理
* @method \WeMini\Delivery WeMiniDelivery() static 小程序即时配送 * @method \WeMini\Delivery WeMiniDelivery() static 小程序即时配送
* @method \WeMini\Guide WeMiniGuide() static 小程序导购助手
* @method \WeMini\Image WeMiniImage() static 小程序图像处理 * @method \WeMini\Image WeMiniImage() static 小程序图像处理
* @method \WeMini\Live WeMiniLive() static 小程序直播接口
* @method \WeMini\Logistics WeMiniLogistics() static 小程序物流助手 * @method \WeMini\Logistics WeMiniLogistics() static 小程序物流助手
* @method \WeMini\Newtmpl WeMiniNewtmpl() static 公众号小程序订阅消息支持
* @method \WeMini\Message WeMiniMessage() static 小程序动态消息 * @method \WeMini\Message WeMiniMessage() static 小程序动态消息
* @method \WeMini\Operation WeMiniOperation() static 小程序运维中心
* @method \WeMini\Ocr WeMiniOcr() static 小程序ORC服务 * @method \WeMini\Ocr WeMiniOcr() static 小程序ORC服务
* @method \WeMini\Plugs WeMiniPlugs() static 小程序插件管理 * @method \WeMini\Plugs WeMiniPlugs() static 小程序插件管理
* @method \WeMini\Poi WeMiniPoi() static 小程序地址管理 * @method \WeMini\Poi WeMiniPoi() static 小程序地址管理
@ -68,18 +74,23 @@ use think\Response;
* @method \WeMini\Soter WeMiniSoter() static 小程序生物认证 * @method \WeMini\Soter WeMiniSoter() static 小程序生物认证
* @method \WeMini\Template WeMiniTemplate() static 小程序模板消息支持 * @method \WeMini\Template WeMiniTemplate() static 小程序模板消息支持
* @method \WeMini\Total WeMiniTotal() static 小程序数据接口 * @method \WeMini\Total WeMiniTotal() static 小程序数据接口
* @method \WeMini\Newtmpl WeMiniNewtmpl() static 小程序订阅消息支持 * @method \WeMini\Scheme WeMiniScheme() static 小程序URL-Scheme
* @method \WeMini\Search WeMiniSearch() static 小程序搜索
* @method \WeMini\Shipping WeMiniShipping() static 小程序发货信息管理服务
* *
* ----- WePay ----- * ----- WePay -----
* @method \WePay\Bill WePayBill() static 微信商户账单及评论 * @method \WePay\Bill WePayBill() static 微信商户账单及评论
* @method \WePay\Order WePayOrder() static 微信商户订单 * @method \WePay\Order WePayOrder() static 微信商户订单
* @method \WePay\Refund WePayRefund() static 微信商户退款 * @method \WePay\Refund WePayRefund() static 微信商户退款
* @method \WePay\Coupon WePayCoupon() static 微信商户代金券 * @method \WePay\Coupon WePayCoupon() static 微信商户代金券
* @method \WePay\Custom WePayCustom() static 微信扩展上报海关
* @method \WePay\ProfitSharing WePayProfitSharing() static 微信分账
* @method \WePay\Redpack WePayRedpack() static 微信红包支持 * @method \WePay\Redpack WePayRedpack() static 微信红包支持
* @method \WePay\Transfers WePayTransfers() static 微信商户打款到零钱 * @method \WePay\Transfers WePayTransfers() static 微信商户打款到零钱
* @method \WePay\TransfersBank WePayTransfersBank() static 微信商户打款到银行卡 * @method \WePay\TransfersBank WePayTransfersBank() static 微信商户打款到银行卡
* *
* ----- WePayV3 ----- * ----- WePayV3 -----
* @method \WePayV3\Order WePayV3Order() static 直连商户|订单支付接口
* @method \WePayV3\Transfers WePayV3Transfers() static 微信商家转账到零钱 * @method \WePayV3\Transfers WePayV3Transfers() static 微信商家转账到零钱
* @method \WePayV3\ProfitSharing WePayV3ProfitSharing() static 微信商户分账 * @method \WePayV3\ProfitSharing WePayV3ProfitSharing() static 微信商户分账
* *
@ -106,9 +117,9 @@ class WechatService extends Service
if ("{$type}{$base}" !== $name) { if ("{$type}{$base}" !== $name) {
throw new Exception("抱歉,实例 {$name} 不符合规则!"); throw new Exception("抱歉,实例 {$name} 不符合规则!");
} }
if (sysconf('wechat.type') === 'api' || $type === 'WePay') { if (sysconf('wechat.type') === 'api' || in_array($type, ['WePay', 'WePayV3'])) {
if (class_exists($class)) { if (class_exists($class)) {
return new $class(static::getConfig()); return new $class($type === 'WeMini' ? static::getWxconf() : static::getConfig());
} else { } else {
throw new Exception("抱歉,接口模式无法实例 {$class} 对象!"); throw new Exception("抱歉,接口模式无法实例 {$class} 对象!");
} }
@ -185,6 +196,27 @@ class WechatService extends Service
]); ]);
} }
/**
* 获取小程序配置参数
* @param boolean $ispay 支付参数
* @return array
* @throws \think\admin\Exception
*/
public static function getWxconf(bool $ispay = false): array
{
$wxapp = sysdata('plugin.wechat.wxapp');
$config = [
'appid' => $wxapp['appid'] ?? '',
'appsecret' => $wxapp['appkey'] ?? '',
'cache_path' => syspath('runtime/wechat'),
];
return $ispay ? static::withWxpayCert(array_merge([
'mch_id' => sysconf('wechat.mch_id'),
'mch_key' => sysconf('wechat.mch_key'),
'mch_v3_key' => sysconf('wechat.mch_v3_key'),
], $config)) : $config;
}
/** /**
* 处理支付证书配置 * 处理支付证书配置
* @param array $options * @param array $options

View File

@ -418,53 +418,50 @@ $(function () {
}; };
/*! 后台菜单动作初始化 */ /*! 后台菜单动作初始化 */
this.listen = function () { this.listen = function () {
let layout = $('.layui-layout-admin'), mclass = 'layui-layout-left-mini'; let layout = $('.layui-layout-admin'), mini = 'layui-layout-left-mini';
/*! 菜单切及MiniTips处理 */ /*! 菜单切及MiniTips处理 */
$.base.onEvent('click', '[data-target-menu-type]', function () { $.base.onEvent('click', '[data-target-menu-type]', function () {
layui.data('AdminMenuType', {key: 'mini', value: layout.toggleClass(mclass).hasClass(mclass)}); layui.data('AdminMenuType', {key: 'mini', value: layout.toggleClass(mini).hasClass(mini)});
}).on('click', '[data-submenu-layout]>a', function () { }).on('click', '[data-submenu-layout]>a', function () {
setTimeout("$.menu.sync(1)", 100); setTimeout("$.menu.sync(1)", 100);
}).on('mouseenter', '[data-target-tips]', function (evt) { }).on('mouseenter', '[data-target-tips]', function (evt) {
if (!layout.hasClass(mclass) || !this.dataset.targetTips) return; if (!layout.hasClass(mini) || !this.dataset.targetTips) return;
evt.idx = layer.tips(this.dataset.targetTips, this, {time: 0}); evt.idx = layer.tips(this.dataset.targetTips, this, {time: 0});
$(this).mouseleave(function () { $(this).mouseleave(() => layer.close(evt.idx));
layer.close(evt.idx);
});
}); });
/*! 监听窗口大小及HASH切换 */ /*! 监听窗口大小及HASH切换 */
return $(window).on('resize', function () { return $(window).on('resize', function () {
(layui.data('AdminMenuType')['mini'] || $body.width() < 1000) ? layout.addClass(mclass) : layout.removeClass(mclass); (layui.data('AdminMenuType')['mini'] || $body.width() < 1000) ? layout.addClass(mini) : layout.removeClass(mini);
}).trigger('resize').on('hashchange', function () { }).trigger('resize').on('hashchange', function () {
if (/^#(https?:)?(\/\/|\\\\)/.test(location.hash)) return $.msg.tips('禁止访问外部链接!'); if (/^#(https?:)?(\/\/|\\\\)/.test(location.hash)) return $.msg.tips('禁止访问外部链接!');
if (location.hash.length < 1) return $body.find('[data-menu-node]:first').trigger('click'); else return $.menu.href(location.hash); return location.hash.length < 1 ? $body.find('[data-menu-node]:first').trigger('click') : $.menu.href(location.hash);
}).trigger('hashchange'); }).trigger('hashchange');
}; };
/*! 同步二级菜单展示状态 */ /*! 同步二级菜单展示状态(1同步缓存,2同步展示) */
this.sync = function (mode) { this.sync = function (mode) {
$('[data-submenu-layout]').map(function () { $('[data-submenu-layout]').map(function () {
let node = this.dataset.submenuLayout; let node = this.dataset.submenuLayout;
if (mode === 1) layui.data('AdminMenuState', {key: node, value: $(this).hasClass('layui-nav-itemed') ? 2 : 1}); else if (mode === 2) (layui.data('AdminMenuState')[node] || 2) === 2 && $(this).addClass('layui-nav-itemed'); if (mode === 1) layui.data('AdminMenuState', {key: node, value: $(this).hasClass('layui-nav-itemed') ? 2 : 1});
if (mode === 2) (layui.data('AdminMenuState')[node] || 0) === 2 && $(this).addClass('layui-nav-itemed');
}); });
}; };
/*! 页面 LOCATION-HASH 跳转 */ /*! 页面 LOCATION-HASH 跳转 */
this.href = function (hash, node) { this.href = function (hash, node) {
if ((hash || '').length < 1) return $('[data-menu-node]:first').trigger('click'); if ((hash || '').length < 1) return $('[data-menu-node]:first').trigger('click');
// $.msg.page.show(),$.form.load(hash, {}, 'get', $.msg.page.hide, true),$.menu.sync(2);
$.form.load(hash, {}, 'get', false, !$.msg.page.stat()), $.menu.sync(2); $.form.load(hash, {}, 'get', false, !$.msg.page.stat()), $.menu.sync(2);
/*! 菜单选择切换 */ // 菜单选择切换
if (/^m-/.test(node = node || $.menu.queryNode($.menu.getUri()))) { if (/^m-/.test(node = node || $.menu.queryNode($.menu.getUri()))) {
let arr = node.split('-'), tmp = arr.shift(), $all = $('a[data-menu-node]').parent('.layui-this'); let arr = node.split('-'), tmp = arr.shift(), all = $('a[data-menu-node]').parent('.layui-this');
while (arr.length > 0) { while (arr.length > 0) {
tmp = tmp + '-' + arr.shift(); tmp = tmp + '-' + arr.shift();
$all = $all.not($('a[data-menu-node="' + tmp + '"]').parent().addClass('layui-this')); all = all.not($('a[data-menu-node="' + tmp + '"]').parent().addClass('layui-this'));
} }
$all.removeClass('layui-this'); all.removeClass('layui-this');
/*! 菜单模式切换 */ // 菜单模式切换
if (node.split('-').length > 2) { if (node.split('-').length > 2) {
let _tmp = node.split('-'), _node = _tmp.shift() + '-' + _tmp.shift(); let tmp = node.split('-'), pnode = tmp.slice(0, 2).join('-'), snode = tmp.slice(0, 3).join('-')
$('[data-menu-layout]').not($('[data-menu-layout="' + _node + '"]').removeClass('layui-hide')).addClass('layui-hide'); $('[data-menu-layout]').not($('[data-menu-layout="' + pnode + '"]').removeClass('layui-hide')).addClass('layui-hide');
$('[data-menu-node="' + node + '"]').parent().parent().parent().addClass('layui-nav-itemed'); $('[data-submenu-layout="' + snode + '"]').addClass('layui-nav-itemed');
$('.layui-layout-admin').removeClass('layui-layout-left-hide'); $('.layui-layout-admin').removeClass('layui-layout-left-hide');
} else { } else {
$('.layui-layout-admin').addClass('layui-layout-left-hide'); $('.layui-layout-admin').addClass('layui-layout-left-hide');
@ -651,6 +648,7 @@ $(function () {
option.id = table.id, option.elem = table, option.url = params.url || table.dataset.url || location.href; option.id = table.id, option.elem = table, option.url = params.url || table.dataset.url || location.href;
option.limit = params.limit || 20, option.loading = params.loading !== false, option.autoSort = params.autoSort === true; option.limit = params.limit || 20, option.loading = params.loading !== false, option.autoSort = params.autoSort === true;
option.page = params.page !== false ? (params.page || true) : false, option.cols = params.cols || [[]], option.success = params.done || ''; option.page = params.page !== false ? (params.page || true) : false, option.cols = params.cols || [[]], option.success = params.done || '';
option.cellExpandedMode = option.cellExpandedMode || 'tips';
// 默认动态设置页数, 动态设置最大高度 // 默认动态设置页数, 动态设置最大高度
if (option.page === true) option.page = {curr: layui.sessionData('pages')[option.id] || 1}; if (option.page === true) option.page = {curr: layui.sessionData('pages')[option.id] || 1};
@ -685,7 +683,7 @@ $(function () {
return res; return res;
}; };
// 关联搜索表单 // 关联搜索表单
let sform, search = params.search || table.dataset.targetSearch; let sform, search = params.search || table.dataset.targetSearch || 'form[data-table-id="' + table.id + '"] [data-form-export]';
if (search) (sform = $body.find(search)).map(function () { if (search) (sform = $body.find(search)).map(function () {
$(this).attr('data-table-id', table.id); $(this).attr('data-table-id', table.id);
}); });
@ -933,7 +931,7 @@ $(function () {
/*! 注册 data-modal 事件行为 */ /*! 注册 data-modal 事件行为 */
$.base.onEvent('click', '[data-modal]', function () { $.base.onEvent('click', '[data-modal]', function () {
$.base.applyRuleValue(this, {open_type: 'modal'}, function (data, elem, dset) { $.base.applyRuleValue(this, {open_type: 'modal'}, function (data, elem, dset) {
let defer = $.form.modal(dset.modal, data, dset.title || this.innerText || '编辑', undefined, undefined, undefined, dset.area || dset.width || '800px', dset.offset || 'auto', dset.full !== undefined); let defer = $.form.modal(dset.modal, data, dset.title || this.innerText || '编辑', undefined, undefined, undefined, dset.area || dset.width || '800px', dset.offset || 'auto', dset.full !== undefined, dset.maxmin || false);
defer.progress((type) => type === 'modal.close' && dset.closeRefresh && $.layTable.reload(dset.closeRefresh)); defer.progress((type) => type === 'modal.close' && dset.closeRefresh && $.layTable.reload(dset.closeRefresh));
}); });
}); });
@ -946,7 +944,7 @@ $(function () {
let frame = dset.iframe + (dset.iframe.indexOf('?') > -1 ? '&' : '?') + $.param(data); let frame = dset.iframe + (dset.iframe.indexOf('?') > -1 ? '&' : '?') + $.param(data);
$(this).attr('data-index', $.form.iframe(frame + '&' + $.param(data), name, area, dset.offset || 'auto', function () { $(this).attr('data-index', $.form.iframe(frame + '&' + $.param(data), name, area, dset.offset || 'auto', function () {
typeof dset.refresh !== 'undefined' && $.layTable.reload(dset.tableId || true); typeof dset.refresh !== 'undefined' && $.layTable.reload(dset.tableId || true);
}, undefined, dset.full !== undefined)); }, undefined, dset.full !== undefined, dset.maxmin || false));
}) })
}); });

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long