新增微信公众号错误

This commit is contained in:
JaguarJack
2020-06-21 13:23:22 +08:00
parent dc08715bc7
commit c624dc1777
5 changed files with 246 additions and 2 deletions

View File

@@ -10,6 +10,8 @@
*/
namespace catcher\library;
use catcher\exceptions\WechatResponseException;
use catcher\library\Errors;
use EasyWeChat\Factory;
use think\helper\Str;
@@ -36,8 +38,7 @@ class WeChat
* @return mixed
*/
public static function __callStatic($name, $arguments)
{
// TODO: Implement __callStatic() method.
{// TODO: Implement __callStatic() method.
return Factory::{$name}(\config('wechat.'. Str::snake($name)));
}
@@ -54,4 +55,20 @@ class WeChat
// TODO: Implement __call() method.
return Factory::{$name}(\config('wechat.'. Str::snake($name)));
}
/**
* throw error
*
* @time 2020年06月21日
* @param $response
* @return bool
*/
public static function throw($response)
{
if (isset($response['errcode']) && $response['errcode']) {
throw new WechatResponseException(Errors::WECHAT[$response['errcode']], $response['errcode']);
}
return $response;
}
}