切换导航条
此项目
正在载入...
登录
anyv
/
xkeasy
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
anyv
6 years ago
提交
7cdf9ad537d9abfa401f4eccde7b13ec3d8e0f5b
1 个父辈
152facf3
1 个管道 的构建
通过
耗费 1 秒
支付
变更
1
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
8 行增加
和
28 行删除
app/portal/controller/PayController.php
app/portal/controller/PayController.php
查看文件 @
7cdf9ad
...
...
@@ -25,6 +25,11 @@ class PayController extends HomeBaseController
];
}
public
function
test
(){
dump
(
cache
(
'order'
));
dump
(
cache
(
'uid'
));
dump
(
cache
(
'data_user'
));
dump
(
cache
(
'result'
));
dump
(
cache
(
'result'
));
dump
(
cache
(
'result'
));
}
...
...
@@ -81,43 +86,19 @@ class PayController extends HomeBaseController
cache
(
'nnn'
,
111
);
$app
=
new
Application
(
$this
->
options
);
$response
=
$app
->
payment
->
handleNotify
(
function
(
$notify
,
$successful
){
cache
(
'notify'
,
$notify
);
cache
(
'successful'
,
$successful
);
/*这里是支付回调逻辑处理,一下是DEMO*/
// // 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单
// $out_trade_no=$notify->out_trade_no;
// $order = Db::name('order')->where('order_sn',$out_trade_no)->find();
// if (!$order) { // 如果订单不存在
// return 'Order not exist.'; // 告诉微信,我已经处理完了,订单没找到,别再通知我了
// }
// // 如果订单存在
// // 检查订单是否已经更新过支付状态
// if ($order['pay_time']>0) { // 假设订单字段“支付时间”不为空代表已经支付
// return true; // 已经支付成功了就不再更新了
// }
//
// // 用户是否支付成功
// if ($successful) {
// // 回填微信的订单号
// $update['transaction_id']=$notify->transaction_id;
// $update['pay_time']=time();
// // 不是已经支付状态则修改为已经支付状态
// $update['status'] = 2;
// } else { // 用户支付失败
// $update['status']=9;
// }
// Db::name('order')->where('order_sn',$out_trade_no)->update($update);
$out_trade_no
=
$notify
->
out_trade_no
;
//查询订单信息
$order
=
Db
::
name
(
'indent'
)
->
where
(
'order_number'
,
$out_trade_no
)
->
find
();
cache
(
'order'
,
$order
);
if
(
$successful
){
$update
[
'state'
]
=
2
;
//更新订单状态为待发货
Db
::
name
(
'indent'
)
->
where
(
'order_number'
,
$out_trade_no
)
->
update
(
$update
);
$uid
=
cmf_get_current_user_id
();
cache
(
'uid'
,
$uid
);
//查询当前用户身份
$data_user
=
Db
::
name
(
'my_user'
)
->
where
(
'uid'
,
$uid
)
->
find
();
cache
(
'data_user'
,
$data_user
);
if
(
$order
[
'indent_type'
]
==
1
){
//如果是平台商品 学生购买
if
(
$data_user
[
'status'
]
==
4
){
...
...
@@ -155,7 +136,6 @@ class PayController extends HomeBaseController
Db
::
name
(
'money_income'
)
->
insert
(
$data_money_income_teacher
);
}
Db
::
name
(
'my_user'
)
->
where
(
'uid'
,
$teacher
[
'uid'
])
->
setInc
(
'balance'
,
$money_salesman
);
Log
::
write
(
'测试日志'
);
}
//如果是平台商品 老师购买
if
(
$data_user
[
'status'
]
==
3
){
...
...
请
注册
或
登录
后发表评论