Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jamesyang1999
ShopXO
提交
3e7c4a1f
ShopXO
项目概览
jamesyang1999
/
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,体验更适合开发者的 AI 搜索 >>
提交
3e7c4a1f
编写于
5月 14, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
支付接口
上级
6482ba2a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
36 addition
and
27 deletion
+36
-27
application/service/OrderService.php
application/service/OrderService.php
+2
-0
application/service/PaymentService.php
application/service/PaymentService.php
+34
-27
未找到文件。
application/service/OrderService.php
浏览文件 @
3e7c4a1f
...
...
@@ -91,6 +91,8 @@ class OrderService
// 入口文件不存在则创建
$payment_params
=
[
'payment'
=>
$payment
[
0
][
'payment'
],
'respond'
=>
'/index/order/respond'
,
'notify'
=>
'/api/ordernotify/notify'
,
];
$ret
=
PaymentService
::
PaymentEntranceCreated
(
$payment_params
);
if
(
$ret
[
'code'
]
!=
0
)
...
...
application/service/PaymentService.php
浏览文件 @
3e7c4a1f
...
...
@@ -495,20 +495,11 @@ class PaymentService
// 开启事务
Db
::
startTrans
();
if
(
Db
::
name
(
'Payment'
)
->
insertGetId
(
$data
)
>
0
)
{
// 入口文件生成
$ret
=
self
::
PaymentEntranceCreated
([
'payment'
=>
$payment
]);
if
(
$ret
[
'code'
]
==
'code'
)
{
// 提交事务
Db
::
commit
();
return
DataReturn
(
'安装成功'
);
}
else
{
// 事务回滚
Db
::
rollback
();
return
$ret
;
}
}
else
{
// 事务回滚
Db
::
rollback
();
...
...
@@ -611,7 +602,7 @@ class PaymentService
}
/**
*
[PaymentEntranceCreated 入口文件创建]
*
入口文件创建
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
...
...
@@ -628,12 +619,37 @@ class PaymentService
// 初始化
self
::
Init
();
// 参数
$p
=
[
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'payment'
,
'error_msg'
=>
'支付唯一标记不能为空'
,
],
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'respond'
,
'error_msg'
=>
'支付同步地址参数不能为空'
,
],
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'notify'
,
'error_msg'
=>
'支付异步地址参数不能为空'
,
],
];
$ret
=
ParamsChecked
(
$params
,
$p
);
if
(
$ret
!==
true
)
{
return
DataReturn
(
$ret
,
-
1
);
}
// 权限
$ret
=
self
::
PowerCheck
();
if
(
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
if
(
empty
(
$params
[
'payment'
]))
{
return
'支付唯一标记不能为空'
;
...
...
@@ -645,19 +661,10 @@ class PaymentService
// 处理业务
$business_all
=
empty
(
$params
[
'business'
])
?
self
::
$payment_business_type_all
:
$params
[
'business'
];
// 同步参数值
$respond_params
=
empty
(
$params
[
'respond'
])
?
'/api/{$name}/respond'
:
$params
[
'respond'
];
// 异步参数值
$notify_params
=
empty
(
$params
[
'notify'
])
?
'/api/{$name}/notify'
:
$params
[
'notify'
];
// 批量创建
foreach
(
$business_all
as
$v
)
{
$business_name
=
strtolower
(
$v
[
'name'
]);
$respond_s
=
str_replace
(
'{$name}'
,
$business_name
,
$respond_params
);
$notify_s
=
str_replace
(
'{$name}'
,
$business_name
,
$notify_params
);
if
(
defined
(
'IS_ROOT_ACCESS'
))
{
// 异步
...
...
@@ -669,7 +676,7 @@ $notify=<<<php
*/
// 默认绑定模块
\$_GET['s'] = '{$
notify_s
}';
\$_GET['s'] = '{$
params["notify"]
}';
// 支付模块标记
define('PAYMENT_TYPE', '{$params["payment"]}');
...
...
@@ -691,7 +698,7 @@ $respond=<<<php
*/
// 默认绑定模块
\$_GET['s'] = '{$
respond_s
}';
\$_GET['s'] = '{$
params["respond"]
}';
// 支付模块标记
define('PAYMENT_TYPE', '{$params["payment"]}');
...
...
@@ -715,7 +722,7 @@ $notify=<<<php
*/
// 默认绑定模块
\$_GET['s'] = '{$
notify_s
}';
\$_GET['s'] = '{$
params["notify"]
}';
// 支付模块标记
define('PAYMENT_TYPE', '{$params["payment"]}');
...
...
@@ -734,7 +741,7 @@ $respond=<<<php
*/
// 默认绑定模块
\$_GET['s'] = '{$
respond_s
}';
\$_GET['s'] = '{$
params["respond"]
}';
// 支付模块标记
define('PAYMENT_TYPE', '{$params["payment"]}');
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录