提交
This commit is contained in:
parent
089dc2e818
commit
710b7e31a2
|
|
@ -807,6 +807,21 @@ class Goods extends Base
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($goods['quanju_xiangou'] > 0) {
|
||||
// <= $user_xiangou_count
|
||||
// return $this->renderError('当前活动限购' . $goods['quanju_xiangou'] . '次');
|
||||
//限购
|
||||
$user_xiangou_count = OrderList::field('id')->where('goods_id', '=', $goods_id)
|
||||
->where('user_id', '=', $user['id'])
|
||||
->where('num', '=', $num)
|
||||
->count();
|
||||
if ($user_xiangou_count >= $goods['quanju_xiangou']) {
|
||||
return $this->renderError('当前活动限购' . $goods['quanju_xiangou'] . '次');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($goods['type'] != 15) {
|
||||
#奖品信息
|
||||
$is_goodslist = GoodsList::field('id')
|
||||
|
|
@ -1168,6 +1183,22 @@ class Goods extends Base
|
|||
} else {
|
||||
$attach = 'order_qts';
|
||||
}
|
||||
|
||||
if ($goods['quanju_xiangou'] > 0) {
|
||||
|
||||
// 查看一天内有没有未支付的订单,未支付的订单要先作废
|
||||
$order_info = Order::where('goods_id', '=', $goods_id)
|
||||
->where('user_id', '=', $user['id'])
|
||||
->where('num', '=', $num)
|
||||
->where('status', '=', 0)
|
||||
->where('addtime', '>=', time() - 86400)
|
||||
->find();
|
||||
if ($order_info) {
|
||||
$order_info->status = 2;
|
||||
$order_info->save();
|
||||
}
|
||||
}
|
||||
|
||||
$payRes = (new Pay())->wxCreateOrder($order_num, $price, $user['openid'], $body, $attach);
|
||||
if ($payRes['status'] == 1) {
|
||||
#结果集
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ class Notify extends Base
|
|||
Db::rollback();
|
||||
}
|
||||
}
|
||||
} elseif ($table == 'order_yfs' || $table == 'order_lts' || $table == 'order_zzs' || $table == 'order_flw'|| $table == 'order_scs') {#抽赏一番赏 擂台赏
|
||||
} elseif ($table == 'order_yfs' || $table == 'order_lts' || $table == 'order_zzs' || $table == 'order_flw' || $table == 'order_scs') {#抽赏一番赏 擂台赏
|
||||
$orderInfo = Order::where('order_num', '=', $out_trade_no)
|
||||
->where('status', '=', 0)
|
||||
->find();
|
||||
|
|
@ -286,6 +286,14 @@ class Notify extends Base
|
|||
} else {
|
||||
Db::rollback();
|
||||
}
|
||||
} else {
|
||||
$tempOrder = Order::where('order_num', '=', $out_trade_no)
|
||||
->find();
|
||||
if ($tempOrder) {
|
||||
// 作废订单支付
|
||||
$tempOrder->status = 3;
|
||||
$tempOrder->save();
|
||||
}
|
||||
}
|
||||
} elseif ($table == 'order_wxs') {#抽赏无限赏
|
||||
$orderInfo = Order::where('order_num', '=', $out_trade_no)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user