Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
f96ddec3
ShopXO
项目概览
jcy2004x
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f96ddec3
编写于
9月 23, 2020
作者:
D
devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增支付请求日志
上级
fc4c2e17
变更
18
显示空白变更内容
内联
并排
Showing
18 changed file
with
712 addition
and
200 deletion
+712
-200
application/admin/controller/Common.php
application/admin/controller/Common.php
+0
-1
application/admin/controller/Payrequestlog.php
application/admin/controller/Payrequestlog.php
+113
-0
application/admin/form/Payrequestlog.php
application/admin/form/Payrequestlog.php
+256
-0
application/admin/view/default/paylog/index.html
application/admin/view/default/paylog/index.html
+12
-1
application/admin/view/default/payrequestlog/detail.html
application/admin/view/default/payrequestlog/detail.html
+2
-0
application/admin/view/default/payrequestlog/index.html
application/admin/view/default/payrequestlog/index.html
+13
-0
application/admin/view/default/payrequestlog/module/business_handle.html
...in/view/default/payrequestlog/module/business_handle.html
+4
-0
application/admin/view/default/payrequestlog/module/operate.html
...tion/admin/view/default/payrequestlog/module/operate.html
+5
-0
application/admin/view/default/payrequestlog/module/request_params.html
...min/view/default/payrequestlog/module/request_params.html
+4
-0
application/admin/view/default/payrequestlog/module/response_data.html
...dmin/view/default/payrequestlog/module/response_data.html
+4
-0
application/api/controller/Common.php
application/api/controller/Common.php
+2
-2
application/api/controller/Ordernotify.php
application/api/controller/Ordernotify.php
+20
-10
application/common.php
application/common.php
+44
-1
application/index/controller/Common.php
application/index/controller/Common.php
+2
-2
application/install/controller/Index.php
application/install/controller/Index.php
+20
-14
application/service/PayRequestLogService.php
application/service/PayRequestLogService.php
+145
-0
extend/base/Behavior.php
extend/base/Behavior.php
+63
-169
public/static/admin/default/css/payrequestlog.css
public/static/admin/default/css/payrequestlog.css
+3
-0
未找到文件。
application/admin/controller/Common.php
浏览文件 @
f96ddec3
...
...
@@ -309,7 +309,6 @@ class Common extends Controller
*/
protected
function
IsPower
()
{
// 不需要校验权限的方法
$unwanted_power
=
[
'getnodeson'
];
if
(
!
AdminIsPower
(
null
,
null
,
$unwanted_power
))
...
...
application/admin/controller/Payrequestlog.php
0 → 100644
浏览文件 @
f96ddec3
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\admin\controller
;
use
app\service\PayRequestLogService
;
/**
* 支付请求日志管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
PayRequestLog
extends
Common
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public
function
__construct
()
{
// 调用父类前置方法
parent
::
__construct
();
// 登录校验
$this
->
IsLogin
();
// 权限校验
$this
->
IsPower
();
}
/**
* 列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-09-23
* @desc description
*/
public
function
Index
()
{
// 总数
$total
=
PayRequestLogService
::
PayRequestLogTotal
(
$this
->
form_where
);
// 分页
$page_params
=
[
'number'
=>
$this
->
page_size
,
'total'
=>
$total
,
'where'
=>
$this
->
data_request
,
'page'
=>
$this
->
page
,
'url'
=>
MyUrl
(
'admin/payrequestlog/index'
),
];
$page
=
new
\
base\Page
(
$page_params
);
// 获取列表
$data_params
=
[
'where'
=>
$this
->
form_where
,
'm'
=>
$page
->
GetPageStarNumber
(),
'n'
=>
$this
->
page_size
,
'user_type'
=>
'admin'
,
];
$ret
=
PayRequestLogService
::
PayRequestLogList
(
$data_params
);
// 基础参数赋值
$this
->
assign
(
'params'
,
$this
->
data_request
);
$this
->
assign
(
'page_html'
,
$page
->
GetPageHtml
());
$this
->
assign
(
'data_list'
,
$ret
[
'data'
]);
return
$this
->
fetch
();
}
/**
* 详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-09-23
* @desc description
*/
public
function
Detail
()
{
if
(
!
empty
(
$this
->
data_request
[
'id'
]))
{
// 条件
$where
=
[
[
'id'
,
'='
,
intval
(
$this
->
data_request
[
'id'
])],
];
// 获取列表
$data_params
=
[
'm'
=>
0
,
'n'
=>
1
,
'where'
=>
$where
,
'user_type'
=>
'admin'
];
$ret
=
PayRequestLogService
::
PayRequestLogList
(
$data_params
);
$data
=
(
empty
(
$ret
[
'data'
])
||
empty
(
$ret
[
'data'
][
0
]))
?
[]
:
$ret
[
'data'
][
0
];
$this
->
assign
(
'data'
,
$data
);
}
return
$this
->
fetch
();
}
}
?>
\ No newline at end of file
application/admin/form/Payrequestlog.php
0 → 100644
浏览文件 @
f96ddec3
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\admin\form
;
use
think\Db
;
/**
* 支付请求日志动态表格
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-26
* @desc description
*/
class
PayRequestLog
{
// 基础条件
public
$condition_base
=
[];
/**
* 入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-26
* @desc description
* @param [array] $params [输入参数]
*/
public
function
Run
(
$params
=
[])
{
return
[
// 基础配置
'base'
=>
[
'key_field'
=>
'id'
,
'is_search'
=>
1
,
'search_url'
=>
MyUrl
(
'admin/payrequestlog/index'
),
'is_middle'
=>
0
,
],
// 表单配置
'form'
=>
[
[
'label'
=>
'业务类型'
,
'view_type'
=>
'field'
,
'view_key'
=>
'business_type'
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'where_type'
=>
'in'
,
'data'
=>
$this
->
PayRequestLogFieldWhereList
(
'business_type'
),
'data_key'
=>
'name'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'请求参数'
,
'view_type'
=>
'field'
,
'view_type'
=>
'module'
,
'view_key'
=>
'payrequestlog/module/request_params'
,
'align'
=>
'left'
,
'grid_size'
=>
'sm'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'request_params'
,
'where_type'
=>
'like'
,
],
],
[
'label'
=>
'响应数据'
,
'view_type'
=>
'field'
,
'view_type'
=>
'module'
,
'view_key'
=>
'payrequestlog/module/response_data'
,
'align'
=>
'left'
,
'grid_size'
=>
'sm'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'response_data'
,
'where_type'
=>
'like'
,
],
],
[
'label'
=>
'业务处理结果'
,
'view_type'
=>
'field'
,
'view_type'
=>
'module'
,
'view_key'
=>
'payrequestlog/module/business_handle'
,
'align'
=>
'left'
,
'grid_size'
=>
'sm'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'where_type'
=>
'like'
,
],
],
[
'label'
=>
'请求url地址'
,
'view_type'
=>
'field'
,
'view_key'
=>
'request_url'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'business_handle'
,
'where_type'
=>
'like'
,
],
],
[
'label'
=>
'端口号'
,
'view_type'
=>
'field'
,
'view_key'
=>
'server_port'
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'where_type'
=>
'in'
,
'data'
=>
$this
->
PayRequestLogFieldWhereList
(
'server_port'
),
'data_key'
=>
'name'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'服务器ip'
,
'view_type'
=>
'field'
,
'view_key'
=>
'server_ip'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'where_type'
=>
'like'
,
],
],
[
'label'
=>
'客户端ip'
,
'view_type'
=>
'field'
,
'view_key'
=>
'client_ip'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'where_type'
=>
'like'
,
],
],
[
'label'
=>
'操作系统'
,
'view_type'
=>
'field'
,
'view_key'
=>
'os'
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'where_type'
=>
'in'
,
'data'
=>
$this
->
PayRequestLogFieldWhereList
(
'os'
),
'data_key'
=>
'name'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'浏览器'
,
'view_type'
=>
'field'
,
'view_key'
=>
'browser'
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'where_type'
=>
'in'
,
'data'
=>
$this
->
PayRequestLogFieldWhereList
(
'browser'
),
'data_key'
=>
'name'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'请求类型'
,
'view_type'
=>
'field'
,
'view_key'
=>
'method'
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'where_type'
=>
'in'
,
'data'
=>
$this
->
PayRequestLogFieldWhereList
(
'method'
),
'data_key'
=>
'name'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'http类型'
,
'view_type'
=>
'field'
,
'view_key'
=>
'scheme'
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'where_type'
=>
'in'
,
'data'
=>
$this
->
PayRequestLogFieldWhereList
(
'scheme'
),
'data_key'
=>
'name'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'http版本'
,
'view_type'
=>
'field'
,
'view_key'
=>
'version'
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'where_type'
=>
'in'
,
'data'
=>
$this
->
PayRequestLogFieldWhereList
(
'version'
),
'data_key'
=>
'name'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'客户端详情'
,
'view_type'
=>
'field'
,
'view_key'
=>
'client'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'where_type'
=>
'like'
,
],
],
[
'label'
=>
'创建时间'
,
'view_type'
=>
'field'
,
'view_key'
=>
'add_time'
,
'search_config'
=>
[
'form_type'
=>
'datetime'
,
],
],
[
'label'
=>
'更新时间'
,
'view_type'
=>
'field'
,
'view_key'
=>
'upd_time'
,
'search_config'
=>
[
'form_type'
=>
'datetime'
,
],
],
[
'label'
=>
'操作'
,
'view_type'
=>
'operate'
,
'view_key'
=>
'payrequestlog/module/operate'
,
'align'
=>
'center'
,
'fixed'
=>
'right'
,
],
],
];
}
/**
* 条件字段列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-09-23
* @desc description
* @param [string] $field [字段名称]
*/
public
function
PayRequestLogFieldWhereList
(
$field
)
{
return
Db
::
name
(
'PayRequestLog'
)
->
field
(
$field
.
' as name'
)
->
group
(
$field
)
->
select
();
}
}
?>
\ No newline at end of file
application/admin/view/default/paylog/index.html
浏览文件 @
f96ddec3
<!-- 继承公共的 form -->
{{extend name="public/module/form" /}}
<!-- 表单顶部操作栏 -->
{{block name="form_operate_top"}}
<!-- 支付请求日志是否有权限 -->
{{if AdminIsPower('payrequestlog', 'index')}}
<a
href=
"{{:MyUrl('admin/payrequestlog/index')}}"
class=
"am-btn am-btn-secondary am-radius am-btn-xs am-icon-forumbee"
>
支付请求日志
</a>
{{/if}}
<!-- 父级内容 -->
{__block__}
{{/block}}
\ No newline at end of file
application/admin/view/default/payrequestlog/detail.html
0 → 100644
浏览文件 @
f96ddec3
<!-- 继承公共的 form -->
{{extend name="public/module/detail" /}}
\ No newline at end of file
application/admin/view/default/payrequestlog/index.html
0 → 100755
浏览文件 @
f96ddec3
<!-- 继承公共的 form -->
{{extend name="public/module/form" /}}
<!-- 表单顶部操作栏 -->
{{block name="form_operate_top"}}
<legend>
<span
class=
"am-text-default"
>
支付请求日志
</span>
<a
href=
"{{:MyUrl('admin/paylog/index')}}"
class=
"am-fr am-text-sm am-margin-top-xs am-icon-mail-reply"
>
返回
</a>
</legend>
<!-- 父级内容 -->
{__block__}
{{/block}}
\ No newline at end of file
application/admin/view/default/payrequestlog/module/business_handle.html
0 → 100644
浏览文件 @
f96ddec3
<!-- 请求处理结果 -->
{{if !empty($module_data) and !empty($module_data['business_handle'])}}
<pre
class=
"am-scrollable-vertical am-scrollable-horizontal am-padding-xs pre-container"
>
{{$module_data.business_handle}}
</pre>
{{/if}}
\ No newline at end of file
application/admin/view/default/payrequestlog/module/operate.html
0 → 100644
浏览文件 @
f96ddec3
<!-- 操作栏 -->
<button
type=
"button"
class=
"am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-popup"
data-url=
"{{:MyUrl('admin/payrequestlog/detail', ['id'=>$module_data['id']])}}"
>
<i
class=
"am-icon-eye"
></i>
<span>
详情
</span>
</button>
\ No newline at end of file
application/admin/view/default/payrequestlog/module/request_params.html
0 → 100644
浏览文件 @
f96ddec3
<!-- 请求参数 -->
{{if !empty($module_data) and !empty($module_data['request_params'])}}
<pre
class=
"am-scrollable-vertical am-scrollable-horizontal am-padding-xs pre-container"
>
{{$module_data.request_params}}
</pre>
{{/if}}
\ No newline at end of file
application/admin/view/default/payrequestlog/module/response_data.html
0 → 100644
浏览文件 @
f96ddec3
<!-- 响应数据 -->
{{if !empty($module_data) and !empty($module_data['response_data'])}}
<pre
class=
"am-scrollable-vertical am-scrollable-horizontal am-padding-xs pre-container"
>
{{$module_data.response_data}}
</pre>
{{/if}}
\ No newline at end of file
application/api/controller/Common.php
浏览文件 @
f96ddec3
...
...
@@ -50,7 +50,7 @@ class Common extends Controller
$this
->
data_request
=
input
();
// 系统运行开始
SystemService
::
SystemBegin
();
SystemService
::
SystemBegin
(
$this
->
data_request
);
// 系统初始化
$this
->
SystemInit
();
...
...
@@ -73,7 +73,7 @@ class Common extends Controller
public
function
__destruct
()
{
// 系统运行结束
SystemService
::
SystemEnd
();
SystemService
::
SystemEnd
(
$this
->
data_request
);
}
/**
...
...
application/api/controller/Ordernotify.php
浏览文件 @
f96ddec3
...
...
@@ -11,6 +11,7 @@
namespace
app\api\controller
;
use
app\service\OrderService
;
use
app\service\PayRequestLogService
;
/**
* 订单支付异步通知
...
...
@@ -43,12 +44,20 @@ class OrderNotify extends Common
*/
public
function
Notify
()
{
// 支付请求日志添加
$log_ret
=
PayRequestLogService
::
PayRequestLogInsert
(
OrderService
::
$business_type_name
);
// 业务处理
$ret
=
OrderService
::
Notify
(
$this
->
data_request
);
if
(
$ret
[
'code'
]
==
0
)
{
$this
->
SuccessReturn
();
}
$this
->
ErrorReturn
();
// 响应内容
$res
=
(
$ret
[
'code'
]
==
0
)
?
$this
->
SuccessReturn
()
:
$this
->
ErrorReturn
();
// 支付响应日志
PayRequestLogService
::
PayRequestLogEnd
(
$log_ret
[
'data'
],
$ret
,
$res
);
// 结束运行
die
(
$res
);
}
/**
...
...
@@ -62,10 +71,10 @@ class OrderNotify extends Common
private
function
SuccessReturn
()
{
// 支付插件是否自定义返回内容
$this
->
ContentReturn
(
'SuccessReturn'
);
$
res
=
$
this
->
ContentReturn
(
'SuccessReturn'
);
// 结束输出
die
(
'success'
)
;
return
empty
(
$res
)
?
'success'
:
$res
;
}
/**
...
...
@@ -79,10 +88,10 @@ class OrderNotify extends Common
private
function
ErrorReturn
()
{
// 支付插件是否自定义返回内容
$this
->
ContentReturn
(
'ErrorReturn'
);
$
res
=
$
this
->
ContentReturn
(
'ErrorReturn'
);
// 结束输出
die
(
'error'
)
;
return
empty
(
$res
)
?
'error'
:
$res
;
}
/**
...
...
@@ -102,9 +111,10 @@ class OrderNotify extends Common
$payment_obj
=
new
$payment
();
if
(
method_exists
(
$payment_obj
,
$action
))
{
die
(
$payment_obj
->
$action
()
);
return
$payment_obj
->
$action
(
);
}
}
return
''
;
}
}
?>
\ No newline at end of file
application/common.php
浏览文件 @
f96ddec3
...
...
@@ -11,6 +11,49 @@
// 应用公共文件
/**
* 获取参数数据
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-09-23
* @desc description
* @param [string] $key [参数key]
* @param [string] $default [默认值]
*/
function
MyInput
(
$key
=
null
,
$default
=
null
)
{
static
$data
=
null
;
if
(
$data
===
null
)
{
// raw
$raw_data
=
empty
(
$HTTP_RAW_POST_DATA
)
?
[]
:
(
!
is_array
(
$HTTP_RAW_POST_DATA
)
?
json_decode
(
$HTTP_RAW_POST_DATA
,
true
)
:
[]);
// request
$request_data
=
empty
(
$_REQUEST
)
?
[]
:
$_REQUEST
;
// input
$input_data
=
file_get_contents
(
"php://input"
);
$input_data
=
empty
(
$input_data
)
?
[]
:
(
!
is_array
(
$input_data
)
?
json_decode
(
$input_data
,
true
)
:
[]);
// 数据合并
$data
=
array_merge
(
$raw_data
,
$request_data
,
$input_data
);
}
// 是否指定key
if
(
!
empty
(
$key
))
{
if
(
array_key_exists
(
$key
,
$data
))
{
return
is_array
(
$data
[
$key
])
?
$data
[
$key
]
:
htmlspecialchars
(
trim
(
$data
[
$key
]));
}
return
$default
;
}
// 未指定key则返回所有数据
return
$data
;
}
/**
* 当前应用平台
* @author Devil
...
...
application/index/controller/Common.php
浏览文件 @
f96ddec3
...
...
@@ -87,7 +87,7 @@ class Common extends Controller
$this
->
SystemInit
();
// 系统运行开始
SystemService
::
SystemBegin
();
SystemService
::
SystemBegin
(
$this
->
data_request
);
// 站点状态校验
$this
->
SiteStstusCheck
();
...
...
@@ -119,7 +119,7 @@ class Common extends Controller
public
function
__destruct
()
{
// 系统运行结束
SystemService
::
SystemEnd
();
SystemService
::
SystemEnd
(
$this
->
data_request
);
}
/**
...
...
application/install/controller/Index.php
浏览文件 @
f96ddec3
...
...
@@ -25,6 +25,9 @@ class Index extends Common
// 编码类型
private
$charset_type_list
;
// 安装日志上报
private
$behavior_obj
;
/**
* 构造方法
* @author Devil
...
...
@@ -50,6 +53,9 @@ class Index extends Common
'version'
=>
5.0
,
],
];
// 安装日志上报类库
$this
->
behavior_obj
=
new
\
base\Behavior
();
}
/**
...
...
@@ -80,7 +86,7 @@ class Index extends Common
public
function
Index
()
{
$this
->
IsInstall
();
new
\
base\Behavior
([
'msg'
=>
'协议阅读'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'协议阅读'
]);
return
$this
->
fetch
();
}
...
...
@@ -95,7 +101,7 @@ class Index extends Common
public
function
Check
()
{
$this
->
IsInstall
();
new
\
base\Behavior
([
'msg'
=>
'环境检测'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'环境检测'
]);
return
$this
->
fetch
();
}
...
...
@@ -110,7 +116,7 @@ class Index extends Common
public
function
Create
()
{
$this
->
IsInstall
();
new
\
base\Behavior
([
'msg'
=>
'数据信息填写'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'数据信息填写'
]);
$this
->
assign
(
'charset_type_list'
,
$this
->
charset_type_list
);
return
$this
->
fetch
();
...
...
@@ -159,14 +165,14 @@ class Index extends Common
$ret
=
$this
->
ParamsCheck
(
$params
);
if
(
$ret
[
'code'
]
!=
0
)
{
new
\
base\Behavior
([
'msg'
=>
'参数校验['
.
$ret
[
'msg'
]
.
']'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'参数校验['
.
$ret
[
'msg'
]
.
']'
]);
return
$ret
;
}
// 配置文件校验
if
(
file_exists
(
ROOT
.
'config/database.php'
))
{
new
\
base\Behavior
([
'msg'
=>
'你已经安装过该系统,重新安装需要先删除[./config/database.php 文件]'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'你已经安装过该系统,重新安装需要先删除[./config/database.php 文件]'
]);
return
DataReturn
(
'你已经安装过该系统,重新安装需要先删除[./config/database.php 文件]'
,
-
1
);
}
...
...
@@ -174,7 +180,7 @@ class Index extends Common
$db
=
$this
->
DbObj
(
$params
);
if
(
!
is_object
(
$db
))
{
new
\
base\Behavior
([
'msg'
=>
'数据库连接失败'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'数据库连接失败'
]);
return
DataReturn
(
'数据库连接失败'
,
-
1
);
}
...
...
@@ -192,7 +198,7 @@ class Index extends Common
{
$db
=
$this
->
DbObj
(
$params
,
$params
[
'DB_NAME'
]);
}
else
{
new
\
base\Behavior
([
'msg'
=>
'数据库创建失败'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'数据库创建失败'
]);
return
DataReturn
(
'数据库创建失败'
,
-
1
);
}
}
else
{
...
...
@@ -200,7 +206,7 @@ class Index extends Common
}
if
(
!
is_object
(
$db
))
{
new
\
base\Behavior
([
'msg'
=>
'数据库连接失败'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'数据库连接失败'
]);
return
DataReturn
(
'数据库连接失败'
,
-
1
);
}
...
...
@@ -301,11 +307,11 @@ return [
php;
if
(
@
file_put_contents
(
ROOT
.
'config/database.php'
,
$db_str
)
===
false
)
{
new
\
base\Behavior
([
'msg'
=>
'配置文件创建失败'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'配置文件创建失败'
]);
return
DataReturn
(
'配置文件创建失败'
,
-
1
);
}
new
\
base\Behavior
([
'msg'
=>
'安装成功'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'安装成功'
]);
return
DataReturn
(
'安装成功'
,
0
);
}
...
...
@@ -322,7 +328,7 @@ php;
{
if
(
!
file_exists
(
ROOT
.
'config/shopxo.sql'
))
{
new
\
base\Behavior
([
'msg'
=>
'数据库sql文件不存在'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'数据库sql文件不存在'
]);
return
DataReturn
(
'数据库sql文件不存在'
,
-
1
);
}
...
...
@@ -363,7 +369,7 @@ php;
'success'
=>
$success
,
'failure'
=>
$failure
,
];
new
\
base\Behavior
([
'msg'
=>
'sql运行 成功['
.
$success
.
']条, 失败['
.
$failure
.
']条'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'sql运行 成功['
.
$success
.
']条, 失败['
.
$failure
.
']条'
]);
if
(
$failure
>
0
)
{
return
DataReturn
(
'sql运行失败['
.
$failure
.
']条'
,
-
1
);
...
...
@@ -387,14 +393,14 @@ php;
$data
=
$db
->
query
(
"select version() AS version"
);
if
(
empty
(
$data
[
0
][
'version'
]))
{
new
\
base\Behavior
([
'msg'
=>
'查询数据库版本失败'
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
'查询数据库版本失败'
]);
return
DataReturn
(
'查询数据库版本失败'
,
-
1
);
}
else
{
$mysql_version
=
str_replace
(
'-log'
,
''
,
$data
[
0
][
'version'
]);
if
(
$mysql_version
<
$this
->
charset_type_list
[
$db_charset
][
'version'
])
{
$msg
=
'数据库版本过低、需要>='
.
$this
->
charset_type_list
[
$db_charset
][
'version'
]
.
'、当前'
.
$mysql_version
;
new
\
base\Behavior
([
'msg'
=>
$msg
,
'mysql_version'
=>
$mysql_version
]);
$this
->
behavior_obj
->
ReportInstallLog
([
'msg'
=>
$msg
,
'mysql_version'
=>
$mysql_version
]);
return
DataReturn
(
$msg
,
-
1
);
}
}
...
...
application/service/PayRequestLogService.php
0 → 100644
浏览文件 @
f96ddec3
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\service
;
use
think\Db
;
/**
* 支付请求日志服务层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
PayRequestLogService
{
/**
* 支付响应日志添加
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-09-23
* @desc description
* @param [string] $business_type [业务类型名称]
*/
public
static
function
PayRequestLogInsert
(
$business_type
)
{
// 请求参数
if
(
empty
(
$business_type
))
{
return
DataReturn
(
'业务类型为空'
,
-
1
);
}
// 行为驱动
$behavior_obj
=
new
\
base\Behavior
();
// 输入参数
$params
=
MyInput
();
// 日志主数据
$data
=
[
'business_type'
=>
$business_type
,
'request_params'
=>
empty
(
$params
)
?
''
:
(
is_array
(
$params
)
?
json_encode
(
$params
,
JSON_UNESCAPED_UNICODE
)
:
$params
),
'response_data'
=>
''
,
'business_handle'
=>
''
,
'request_url'
=>
$behavior_obj
->
GetUrl
(
'request'
),
'server_port'
=>
$behavior_obj
->
GetServerPort
(),
'server_ip'
=>
$behavior_obj
->
GetServerIP
(),
'client_ip'
=>
$behavior_obj
->
GetClientIP
(),
'os'
=>
$behavior_obj
->
GetOs
(),
'browser'
=>
$behavior_obj
->
GetBrowser
(),
'method'
=>
$behavior_obj
->
GetMethod
(),
'scheme'
=>
$behavior_obj
->
GetScheme
(),
'version'
=>
$behavior_obj
->
GetHttpVersion
(),
'client'
=>
$behavior_obj
->
GetClinet
(),
'add_time'
=>
time
(),
];
$log_id
=
Db
::
name
(
'PayRequestLog'
)
->
insertGetId
(
$data
);
if
(
$log_id
>
0
)
{
return
DataReturn
(
'支付请求日志添加成功'
,
0
,
$log_id
);
}
return
DataReturn
(
'支付请求日志添加失败'
,
-
100
);
}
/**
* 支付响应日志添加
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-09-23
* @desc description
* @param [int] $log_id [日志id]
* @param [array] $data [业务处理结果]
* @param [string] $res [响应数据]
*/
public
static
function
PayRequestLogEnd
(
$log_id
,
$data
,
$res
)
{
$data
=
[
'business_handle'
=>
empty
(
$data
)
?
''
:
(
is_array
(
$data
)
?
json_encode
(
$data
,
JSON_UNESCAPED_UNICODE
)
:
$data
),
'upd_time'
=>
time
(),
'response_data'
=>
empty
(
$res
)
?
''
:
(
is_array
(
$res
)
?
json_encode
(
$res
,
JSON_UNESCAPED_UNICODE
)
:
$res
),
'upd_time'
=>
time
(),
];
if
(
Db
::
name
(
'PayRequestLog'
)
->
where
([
'id'
=>
$log_id
])
->
update
(
$data
))
{
return
DataReturn
(
'支付请求日志更新成功'
,
0
,
$log_id
);
}
return
DataReturn
(
'支付请求日志更新失败'
,
-
100
);
}
/**
* 列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
PayRequestLogList
(
$params
=
[])
{
$where
=
empty
(
$params
[
'where'
])
?
[]
:
$params
[
'where'
];
$m
=
isset
(
$params
[
'm'
])
?
intval
(
$params
[
'm'
])
:
0
;
$n
=
isset
(
$params
[
'n'
])
?
intval
(
$params
[
'n'
])
:
10
;
$field
=
'*'
;
$order_by
=
empty
(
$params
[
'order_by'
])
?
'id desc'
:
$params
[
'order_by'
];
// 获取数据列表
$data
=
Db
::
name
(
'PayRequestLog'
)
->
where
(
$where
)
->
field
(
$field
)
->
limit
(
$m
,
$n
)
->
order
(
$order_by
)
->
select
();
if
(
!
empty
(
$data
))
{
// 循环处理数据
foreach
(
$data
as
&
$v
)
{
// 时间
$v
[
'add_time'
]
=
empty
(
$v
[
'add_time'
])
?
''
:
date
(
'Y-m-d H:i:s'
,
$v
[
'add_time'
]);
$v
[
'upd_time'
]
=
empty
(
$v
[
'upd_time'
])
?
''
:
date
(
'Y-m-d H:i:s'
,
$v
[
'upd_time'
]);
}
}
return
DataReturn
(
'处理成功'
,
0
,
$data
);
}
/**
* 总数
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $where [条件]
*/
public
static
function
PayRequestLogTotal
(
$where
=
[])
{
return
(
int
)
Db
::
name
(
'PayRequestLog'
)
->
where
(
$where
)
->
count
();
}
}
?>
\ No newline at end of file
extend/base/Behavior.php
浏览文件 @
f96ddec3
...
...
@@ -11,7 +11,7 @@
namespace
base
;
/**
* 行为
记录
* 行为
信息驱动
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
...
...
@@ -20,17 +20,18 @@ namespace base;
class
Behavior
{
/**
*
[__construct 开始收集数据]
*
上报安装日志
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-04-11T16:51:02+0800
* @param [array] $param [参数]
* @version 1.0.0
* @date 2020-09-23
* @desc description
* @param [array] $params [输入参数]
*/
public
function
__construct
(
$param
=
array
()
)
public
function
ReportInstallLog
(
$params
=
[]
)
{
// 数据列表
$data
=
array
(
$data
=
[
'user'
=>
$this
->
GetUserCookie
(),
'host'
=>
$this
->
GetUrl
(
'host'
),
'server_port'
=>
$this
->
GetServerPort
(),
...
...
@@ -51,98 +52,27 @@ class Behavior
'client_date'
=>
date
(
'Y-m-d H:i:s'
),
'ymd'
=>
date
(
'Ymd'
),
'ver'
=>
str_replace
(
'v'
,
''
,
APPLICATION_VERSION
),
)
;
]
;
// 描述信息
if
(
!
empty
(
$param
[
'msg'
]))
if
(
!
empty
(
$param
s
[
'msg'
]))
{
$data
[
'msg'
]
=
$param
[
'msg'
];
$data
[
'msg'
]
=
$param
s
[
'msg'
];
}
// mysql版本
if
(
!
empty
(
$param
[
'mysql_version'
]))
if
(
!
empty
(
$param
s
[
'mysql_version'
]))
{
$data
[
'mysql_version'
]
=
$param
[
'mysql_version'
];
$data
[
'mysql_version'
]
=
$param
s
[
'mysql_version'
];
}
// 上报数据
$url
=
'http://report.shopxo.net/install.php'
;
if
(
function_exists
(
'curl_init'
))
{
$this
->
CurlPost
(
$url
,
$data
);
CurlPost
(
$url
,
$data
);
}
else
{
$this
->
FsockopenPost
(
$url
,
$data
);
}
}
/**
* [CurlPost curl post]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T21:58:54+0800
* @param [string] $url [请求地址]
* @param [array] $post [发送的post数据]
*/
private
function
CurlPost
(
$url
,
$post
)
{
$options
=
array
(
CURLOPT_RETURNTRANSFER
=>
true
,
CURLOPT_HEADER
=>
false
,
CURLOPT_POST
=>
true
,
CURLOPT_POSTFIELDS
=>
$post
,
);
$ch
=
curl_init
(
$url
);
curl_setopt_array
(
$ch
,
$options
);
$result
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
return
$result
;
}
/**
* [FsockopenPost fsockopen方式]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T21:58:54+0800
* @param [string] $url [url地址]
* @param [string] $data [发送参数]
*/
private
function
FsockopenPost
(
$url
,
$data
=
''
)
{
$row
=
parse_url
(
$url
);
$host
=
$row
[
'host'
];
$port
=
isset
(
$row
[
'port'
])
?
$row
[
'port'
]
:
80
;
$file
=
$row
[
'path'
];
$post
=
''
;
while
(
list
(
$k
,
$v
)
=
FunEach
(
$data
))
{
if
(
isset
(
$k
)
&&
isset
(
$v
))
$post
.
=
rawurlencode
(
$k
)
.
"="
.
rawurlencode
(
$v
)
.
"&"
;
//转URL标准码
}
$post
=
substr
(
$post
,
0
,
-
1
);
$len
=
strlen
(
$post
);
$fp
=
@
fsockopen
(
$host
,
$port
,
$errno
,
$errstr
,
10
);
if
(
!
$fp
)
{
return
"
$errstr
(
$errno
)
\n
"
;
}
else
{
$receive
=
''
;
$out
=
"POST
$file
HTTP/1.0
\r\n
"
;
$out
.
=
"Host:
$host
\r\n
"
;
$out
.
=
"Content-type: application/x-www-form-urlencoded
\r\n
"
;
$out
.
=
"Connection: Close
\r\n
"
;
$out
.
=
"Content-Length:
$len
\r\n\r\n
"
;
$out
.
=
$post
;
fwrite
(
$fp
,
$out
);
while
(
!
feof
(
$fp
))
{
$receive
.
=
fgets
(
$fp
,
128
);
}
fclose
(
$fp
);
$receive
=
explode
(
"
\r\n\r\n
"
,
$receive
);
unset
(
$receive
[
0
]);
return
implode
(
""
,
$receive
);
FsockopenPost
(
$url
,
$data
);
}
}
...
...
@@ -153,9 +83,9 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T16:04:33+0800
*/
p
rivate
function
GetScheme
()
p
ublic
function
GetScheme
()
{
return
empty
(
$_SERVER
[
'HTTPS'
])
?
'HTTP'
:
'HTTPS'
;
return
strtoupper
(
__MY_HTTP__
)
;
}
/**
...
...
@@ -165,7 +95,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T16:04:56+0800
*/
p
rivate
function
GetClinet
()
p
ublic
function
GetClinet
()
{
return
empty
(
$_SERVER
[
'HTTP_USER_AGENT'
])
?
''
:
$_SERVER
[
'HTTP_USER_AGENT'
];
}
...
...
@@ -177,7 +107,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T16:04:43+0800
*/
p
rivate
function
GetHttpVersion
()
p
ublic
function
GetHttpVersion
()
{
return
empty
(
$_SERVER
[
'SERVER_PROTOCOL'
])
?
''
:
str_replace
(
array
(
'HTTP/'
,
'HTTPS/'
),
''
,
$_SERVER
[
'SERVER_PROTOCOL'
]);
}
...
...
@@ -189,7 +119,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T16:04:23+0800
*/
p
rivate
function
GetMethod
()
p
ublic
function
GetMethod
()
{
return
empty
(
$_SERVER
[
'REQUEST_METHOD'
])
?
''
:
$_SERVER
[
'REQUEST_METHOD'
];
}
...
...
@@ -201,7 +131,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T16:02:06+0800
*/
p
rivate
function
GetOs
()
p
ublic
function
GetOs
()
{
if
(
!
empty
(
$_SERVER
[
'HTTP_USER_AGENT'
]))
{
...
...
@@ -242,7 +172,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T16:03:14+0800
*/
p
rivate
function
GetBrowser
()
p
ublic
function
GetBrowser
()
{
if
(
!
empty
(
$_SERVER
[
'HTTP_USER_AGENT'
]))
{
...
...
@@ -278,41 +208,23 @@ class Behavior
* @datetime 2017-04-11T16:29:03+0800
* @param [string] $type [host:host地址, url:url地址, request:完整url地址]
*/
p
rivate
function
GetUrl
(
$type
=
'url'
)
p
ublic
function
GetUrl
(
$type
=
'url'
)
{
// 当前host
$host
=
empty
(
$_SERVER
[
'HTTP_HOST'
])
?
''
:
$_SERVER
[
'HTTP_HOST'
];
// 是否获取host
if
(
$type
==
'host'
)
switch
(
$type
)
{
return
$host
;
}
// host
case
'host'
:
return
__MY_HOST__
;
break
;
// http类型
$http
=
empty
(
$_SERVER
[
'HTTPS'
])
?
'http'
:
'https'
;
// 当前url
case
'url'
:
return
__MY_URL__
;
break
;
// 根目录
$root
=
''
;
if
(
!
empty
(
$_SERVER
[
'SCRIPT_NAME'
]))
{
$root
=
substr
(
$_SERVER
[
'SCRIPT_NAME'
],
0
,
strrpos
(
$_SERVER
[
'SCRIPT_NAME'
],
'/'
)
+
1
);
}
else
{
if
(
!
empty
(
$_SERVER
[
'PHP_SELF'
]))
{
$root
=
substr
(
$_SERVER
[
'PHP_SELF'
],
0
,
strrpos
(
$_SERVER
[
'PHP_SELF'
],
'/'
)
+
1
);
}
}
// url 或 request
if
(
$type
==
'url'
)
{
return
$http
.
'://'
.
$host
.
$root
;
}
else
{
if
(
!
empty
(
$_SERVER
[
'REQUEST_URI'
]))
{
return
$http
.
'://'
.
$host
.
$_SERVER
[
'REQUEST_URI'
];
}
// 当前url+参数
default
:
return
__MY_VIEW_URL__
;
}
}
...
...
@@ -323,7 +235,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T16:34:24+0800
*/
p
rivate
function
GetServerIP
()
p
ublic
function
GetServerIP
()
{
return
empty
(
$_SERVER
[
'SERVER_ADDR'
])
?
''
:
$_SERVER
[
'SERVER_ADDR'
];
}
...
...
@@ -335,7 +247,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T16:35:42+0800
*/
p
rivate
function
GetServerPort
()
p
ublic
function
GetServerPort
()
{
return
empty
(
$_SERVER
[
'SERVER_PORT'
])
?
80
:
$_SERVER
[
'SERVER_PORT'
];
}
...
...
@@ -350,25 +262,7 @@ class Behavior
*/
function
GetClientIP
(
$long
=
false
)
{
$onlineip
=
''
;
if
(
getenv
(
'HTTP_CLIENT_IP'
)
&&
strcasecmp
(
getenv
(
'HTTP_CLIENT_IP'
),
'unknown'
))
{
$onlineip
=
getenv
(
'HTTP_CLIENT_IP'
);
}
elseif
(
getenv
(
'HTTP_X_FORWARDED_FOR'
)
&&
strcasecmp
(
getenv
(
'HTTP_X_FORWARDED_FOR'
),
'unknown'
))
{
$onlineip
=
getenv
(
'HTTP_X_FORWARDED_FOR'
);
}
elseif
(
getenv
(
'REMOTE_ADDR'
)
&&
strcasecmp
(
getenv
(
'REMOTE_ADDR'
),
'unknown'
))
{
$onlineip
=
getenv
(
'REMOTE_ADDR'
);
}
elseif
(
isset
(
$_SERVER
[
'REMOTE_ADDR'
])
&&
$_SERVER
[
'REMOTE_ADDR'
]
&&
strcasecmp
(
$_SERVER
[
'REMOTE_ADDR'
],
'unknown'
))
{
$onlineip
=
$_SERVER
[
'REMOTE_ADDR'
];
}
if
(
$long
)
{
$onlineip
=
sprintf
(
"%u"
,
ip2long
(
$realip
));
}
return
$onlineip
;
return
GetClientIP
(
$long
);
}
/**
...
...
@@ -378,7 +272,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T15:57:00+0800
*/
p
rivate
function
GetSourceUrl
()
p
ublic
function
GetSourceUrl
()
{
return
empty
(
$_SERVER
[
'HTTP_REFERER'
])
?
''
:
$_SERVER
[
'HTTP_REFERER'
];
}
...
...
@@ -390,7 +284,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T15:55:12+0800
*/
p
rivate
function
GetUserCookie
()
p
ublic
function
GetUserCookie
()
{
if
(
!
empty
(
$_COOKIE
[
'behavior_user_cookie'
]))
return
$_COOKIE
[
'behavior_user_cookie'
];
...
...
@@ -406,7 +300,7 @@ class Behavior
* @version 0.0.1
* @datetime 2017-04-11T15:56:14+0800
*/
p
rivate
function
GetUserNumberRand
()
p
ublic
function
GetUserNumberRand
()
{
$str
=
date
(
'YmdHis'
);
for
(
$i
=
0
;
$i
<
6
;
$i
++
)
$str
.
=
rand
(
0
,
9
);
...
...
public/static/admin/default/css/payrequestlog.css
0 → 100644
浏览文件 @
f96ddec3
.pre-container
{
height
:
130px
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录