调整活动时间判断
This commit is contained in:
parent
d10333c024
commit
eb0b137284
@ -37,15 +37,13 @@ class StoreActivityOrderDao extends BaseDao
|
||||
->field('group_order_id,sum(amount) amount,sum(pay_price) pay_price,coupon_user_id')
|
||||
->find();
|
||||
if (!empty($consumptionDetail['amount'])) {
|
||||
// 当前订单使用现金抵扣红包 或 使用通用红包后采购金额不足红包金额的2.5倍,视为无效订单
|
||||
// 当前订单使用现金抵扣红包 或 使用通用红包后实付金额不足红包金额的1.5倍,视为无效订单
|
||||
$redPackType = StoreConsumptionUser::where('coupon_id', $consumptionDetail['coupon_user_id'])->value('type');
|
||||
if ($redPackType == StoreConsumptionUser::TYPE_TWO || $consumptionDetail['pay_price'] < $consumptionDetail['amount'] * 1.5) {
|
||||
$model->status = StoreActivityOrder::STATUS_INVALID;
|
||||
}
|
||||
$model->red_pack = $consumptionDetail['amount'];
|
||||
} else {
|
||||
$model->red_pack = 0;
|
||||
}
|
||||
$model->red_pack = $consumptionDetail['amount'] ?? 0;
|
||||
if (!$model->save()) {
|
||||
throw new \Exception('活动订单保存失败');
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class StoreActivityUserDao extends BaseDao
|
||||
public function choose(int $userId, int $couponId, int $activityId)
|
||||
{
|
||||
$consumption = StoreConsumption::where('coupon_id', $couponId)->find();
|
||||
if ($consumption['status'] != 1 || $consumption['start_time'] > time() || $consumption['end_time'] <= time()) {
|
||||
if ($consumption['status'] != 1 || strtotime($consumption['start_time']) > time() || strtotime($consumption['end_time']) <= time()) {
|
||||
throw new \Exception('当前活动已结束');
|
||||
}
|
||||
$model = StoreActivityUser::where('user_id', $userId)->where('value', $couponId)->where('activity_id', $activityId)->find();
|
||||
|
Loading…
x
Reference in New Issue
Block a user