订单创建后,直接返回支付地址

This commit is contained in:
2022-09-14 16:00:58 +08:00
parent 578de01106
commit a9c446089b
2 changed files with 30 additions and 14 deletions

View File

@@ -94,9 +94,15 @@ class Wechat
$order = \app\model\Order::find($orderId);
if(empty($order)) exit('订单信息不存在');
if (empty($order)) {
exit('订单信息不存在');
}
if(\app\model\Order::where(["user_id"=>$order['userid'],"student_id"=>$order['student_id'],"status"=>1])->find()){
if (\app\model\Order::where([
"user_id" => $order['user_id'],
"student_id" => $order['student_id'],
"status" => 1,
])->find()) {
exit('已经为该孩子助力过了');
}
@@ -147,12 +153,12 @@ class Wechat
$order->paid();
//订单支付成功。查询用户信息
$order_detail = \app\model\Order::where("id",$order->order_id)->find();
$order_detail = \app\model\Order::where("id", $order->order_id)->find();
//为用户增加助力值
$zhuLi = env("ZHULI_VALUE")??150;
Db::name("student")->inc("hot",$zhuLi)->where("id",$order_detail->id)->update();
Db::name("student")->inc("hot_count",1)->where("id",$order_detail->id)->update();
$zhuLi = env("ZHULI_VALUE") ?? 150;
Db::name("student")->inc("hot", $zhuLi)->where("id", $order_detail->id)->update();
Db::name("student")->inc("hot_count", 1)->where("id", $order_detail->id)->update();
} else {
$fail('Order not exists.');