1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- declare(strict_types=1);
- namespace catcher\library;
- use catcher\exceptions\WechatResponseException;
- use catcher\library\Errors;
- use EasyWeChat\Factory;
- use think\helper\Str;
- class WeChat
- {
-
- public static function __callStatic($name, $arguments)
- {
- return Factory::{$name}(\config('wechat.'. Str::snake($name)));
- }
-
- public function __call($name, $arguments)
- {
-
- return Factory::{$name}(\config('wechat.'. Str::snake($name)));
- }
-
- public static function throw($response)
- {
- if (isset($response['errcode']) && $response['errcode']) {
- $message = Errors::WECHAT[$response['errcode']] ?? $response['errcode'];
- throw new WechatResponseException($message, $response['errcode']);
- }
- return $response;
- }
- }
|