Commit 9d965f6e by yink

fix: 修复积分支付和订单取消逻辑问题

修复用户积分不足判断条件错误,由检查余额是否小于订单金额改为检查是否小于等于0
在组合支付订单取消时增加积分返还逻辑
parent 6b56fa63
......@@ -384,7 +384,7 @@ public function pay(Request $request)
}
//判断是否有足够的积分支付
if ($userObj->balance < $order_amount) {
if ($userObj->balance <= 0) {
return $this->JsonResponse('', '积分不足!', 500);
}
......@@ -533,6 +533,13 @@ public static function canceOrderFunc($order)
DB::commit();
//未支付直接取消
Log::info($order->id);
//如果组合支付返还积分
if ($order->pay_type == 3) {
//返还用户积分
UserPointChangeRec::pointChangeRecord($order->user_id, $order->point_amount, 1, 4, 1, $order->id);
}
return (new self())->JsonResponse('');
}
......@@ -724,6 +731,7 @@ public function scanCodeVerifi(Request $request)
$orderObj->shipping_goods = $ogItem->shipping_goods;
$orderObj->shipping_at = date("Y-m-d H:i:s");
//更新订单状态为解冻中,解冻7天(汇付会冻结1天),到期后分发佣金
$orderObj->freeze_end_date = date('Y-m-d H:i:s', strtotime('+6 day'));
$orderObj->save();
......
......@@ -469,9 +469,9 @@ public function getMyFriend(Request $request)
$listData = $sql->offset(($page - 1) * $limit)->limit($limit)->orderBy('created_at', 'DESC')->get();
if ($listData->toArray()) {
foreach ($listData as $item) {
$divide_price = UserPointChangeRec::where('change_type', 1)
->where('point_state', 1)
->where('source', 1)
$divide_price = UserPointChangeRec::where('change_type', 1)//增加
->where('point_state', 1)//已完成
->where('source', $type)//直推or间推
->whereHas('order', function($query) use ($item) {
$query->where('user_id', $item->id)
->where('pay_type', 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment