|
|
|
@ -19,6 +19,7 @@ namespace DtApp\ThinkLibrary\exception;
|
|
|
|
|
use DtApp\ThinkLibrary\service\curl\HttpService;
|
|
|
|
|
use DtApp\ThinkLibrary\service\DingTalkService;
|
|
|
|
|
use DtApp\ThinkLibrary\service\Ip\QqWryService;
|
|
|
|
|
use DtApp\ThinkLibrary\service\wechat\QyService;
|
|
|
|
|
use think\exception\Handle;
|
|
|
|
|
use think\exception\HttpException;
|
|
|
|
|
use think\exception\ValidateException;
|
|
|
|
@ -39,7 +40,7 @@ class ThinkException extends Handle
|
|
|
|
|
* @param Throwable $e
|
|
|
|
|
* @return Response
|
|
|
|
|
* @throws AliException
|
|
|
|
|
* @throws CurlException|IpException
|
|
|
|
|
* @throws CurlException|IpException|NoticeException
|
|
|
|
|
*/
|
|
|
|
|
public function render($request, Throwable $e): Response
|
|
|
|
|
{
|
|
|
|
@ -61,6 +62,7 @@ class ThinkException extends Handle
|
|
|
|
|
* @throws AliException
|
|
|
|
|
* @throws CurlException
|
|
|
|
|
* @throws IpException
|
|
|
|
|
* @throws NoticeException
|
|
|
|
|
*/
|
|
|
|
|
private function show($msg)
|
|
|
|
|
{
|
|
|
|
@ -72,12 +74,18 @@ class ThinkException extends Handle
|
|
|
|
|
->accessToken($access_token)
|
|
|
|
|
->text($msg);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($nt) && $nt == 'wechat') {
|
|
|
|
|
if (!empty($nt) && $nt == 'qyweixin') {
|
|
|
|
|
$key = config('dtapp.exception.qyweixin.key', '');
|
|
|
|
|
if (!empty($key)) return QyService::instance()
|
|
|
|
|
->key($key)
|
|
|
|
|
->text($msg);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($nt) && $nt === 'wechat') {
|
|
|
|
|
$openid = config('dtapp.exception.wechat.openid', '');
|
|
|
|
|
$ip = config('dtapp.exception.wechat.ip', '未配置');
|
|
|
|
|
$seip = get_ip();
|
|
|
|
|
$ipinfo = QqWryService::instance()->getLocation($seip);
|
|
|
|
|
if (isset($ipinfo['location_all'])) $ipinfo['location_all'] = '';
|
|
|
|
|
if (!isset($ipinfo['location_all'])) $ipinfo['location_all'] = '';
|
|
|
|
|
if (!empty($openid)) return HttpService::instance()
|
|
|
|
|
->url("https://api.dtapp.net/v1/wechatmp/tmplmsgWebError/openid/{$openid}")
|
|
|
|
|
->post()
|
|
|
|
|