Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
数据应用
ThinkLibrary
提交
0dcd1d04
T
ThinkLibrary
项目概览
数据应用
/
ThinkLibrary
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
代码片段
项目成员
Pages
T
ThinkLibrary
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0dcd1d04
编写于
5月 25, 2020
作者:
李光春
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- 优化报错
上级
e4d7d4bf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
5 deletion
+13
-5
src/common.php
src/common.php
+1
-1
src/config.php
src/config.php
+3
-1
src/exception/ThinkException.php
src/exception/ThinkException.php
+9
-3
未找到文件。
src/common.php
浏览文件 @
0dcd1d04
...
...
@@ -23,7 +23,7 @@ if (!function_exists('get_ip_info')) {
/**
* 获取请求IP信息
* @param string $ip
* @return
string
* @return
mixed|null
* @throws IpException
*/
function
get_ip_info
(
$ip
=
''
)
...
...
src/config.php
浏览文件 @
0dcd1d04
...
...
@@ -91,7 +91,9 @@ return [
// 通知微信
'openid'
=>
''
,
// 网站名称
'node'
=>
''
'node'
=>
''
,
// 服务器IP(节点)
'ip'
=>
''
]
]
];
src/exception/ThinkException.php
浏览文件 @
0dcd1d04
...
...
@@ -18,7 +18,7 @@ namespace DtApp\ThinkLibrary\exception;
use
DtApp\ThinkLibrary\service\curl\HttpService
;
use
DtApp\ThinkLibrary\service\DingTalkService
;
use
DtApp\ThinkLibrary\service\
System
Service
;
use
DtApp\ThinkLibrary\service\
Ip\QqWry
Service
;
use
think\exception\Handle
;
use
think\exception\HttpException
;
use
think\exception\ValidateException
;
...
...
@@ -39,7 +39,7 @@ class ThinkException extends Handle
* @param Throwable $e
* @return Response
* @throws AliException
* @throws CurlException
* @throws CurlException
|IpException
*/
public
function
render
(
$request
,
Throwable
$e
):
Response
{
...
...
@@ -60,6 +60,7 @@ class ThinkException extends Handle
* @return bool
* @throws AliException
* @throws CurlException
* @throws IpException
*/
private
function
show
(
$msg
)
{
...
...
@@ -73,6 +74,10 @@ class ThinkException extends Handle
}
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
(
!
empty
(
$openid
))
return
HttpService
::
instance
()
->
url
(
"https://api.dtapp.net/v1/wechatmp/tmplmsgWebError/openid/
{
$openid
}
"
)
->
post
()
...
...
@@ -80,7 +85,8 @@ class ThinkException extends Handle
'domain'
=>
request
()
->
domain
(),
'url'
=>
request
()
->
url
(),
'node'
=>
config
(
'dtapp.exception.wechat.node'
,
''
),
'info'
=>
"服务器IP:"
.
$_SERVER
[
'REMOTE_ADDR'
]
.
";客户端IP:"
.
get_ip
(),
'info'
=>
"ServerIp:"
.
$ip
.
";CdnIp:"
.
$_SERVER
[
'REMOTE_ADDR'
]
.
";ClientIp:"
.
get_ip
(),
'ip'
=>
$ipinfo
,
'error'
=>
base64_encode
(
$msg
)
])
->
toArray
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录