切换导航条
此项目
正在载入...
登录
root
/
sleep
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
潘浩文
6 years ago
提交
ae967ae6d5dacfc43d295bb62ebe9898d7bac1c5
1 个父辈
d4e972ca
1 个管道 的构建
通过
耗费 0 秒
XIAOPAN
变更
1
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
20 行增加
和
20 行删除
app/portal/controller/UsersController.php
app/portal/controller/UsersController.php
查看文件 @
ae967ae
...
...
@@ -463,26 +463,12 @@ class UsersController extends HomeBaseController{
$fee
=
$this
->
request
->
param
(
'fee'
);
$user
=
Db
::
name
(
'users'
)
->
where
(
'id'
,
$user_id
)
->
find
();
if
(
$user
[
'fee'
]
>=
$fee
)
{
//生成订单号
$order_sn
=
cmf_get_order_sn
();
Db
::
startTrans
();
try
{
Db
::
name
(
'users'
)
->
where
(
'id'
,
$user_id
)
->
setDec
(
'fee'
,
$fee
);
Db
::
name
(
'withdraw'
)
->
insert
([
'user_id'
=>
$user_id
,
'money'
=>
$fee
,
'create_time'
=>
time
(),
'order_sn'
=>
$order_sn
]);
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
// 回滚事务
Db
::
rollback
();
$this
->
apiResponse
(
301
,
'提现失败'
);
}
$app
=
new
Application
(
$this
->
options
);
$merchantPay
=
$app
->
merchant_pay
;
$merchantPayData
=
[
//进行提现
$app
=
new
Application
(
$this
->
options
);
$merchantPay
=
$app
->
merchant_pay
;
$merchantPayData
=
[
'partner_trade_no'
=>
$order_sn
,
//随机字符串作为订单号,跟红包和支付一个概念。
'openid'
=>
$user
[
'open_id'
],
//收款人的openid
'check_name'
=>
'NO_CHECK'
,
//文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK
...
...
@@ -493,8 +479,22 @@ class UsersController extends HomeBaseController{
'spbill_create_ip'
=>
get_client_ip
(
0
,
true
),
//发起交易的IP地址
];
$re
=
$merchantPay
->
send
(
$merchantPayData
);
// var_dump($re);
if
(
$re
[
'return_code'
]
==
'SUCCESS'
&&
$re
[
'result_code'
]
==
'SUCCESS'
){
Db
::
startTrans
();
try
{
Db
::
name
(
'users'
)
->
where
(
'id'
,
$user_id
)
->
setDec
(
'fee'
,
$fee
);
Db
::
name
(
'withdraw'
)
->
insert
([
'user_id'
=>
$user_id
,
'money'
=>
$fee
,
'create_time'
=>
time
(),
'order_sn'
=>
$order_sn
]);
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
// 回滚事务
Db
::
rollback
();
$this
->
apiResponse
(
301
,
'提现失败'
);
}
$this
->
apiResponse
(
200
,
'success'
,
$re
);
}
}
else
{
...
...
请
注册
或
登录
后发表评论