feat : coupon
This commit is contained in:
@@ -30,6 +30,11 @@ class CouponController extends AbstractController
|
|||||||
return (new HomePopupsService)->handle();
|
return (new HomePopupsService)->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
#[RequestMapping(path: "receive", methods: "POST")]
|
||||||
|
#[Scene(scene: "receive")]
|
||||||
public function receiveCoupon()
|
public function receiveCoupon()
|
||||||
{
|
{
|
||||||
return (new ReceiveService)->handle();
|
return (new ReceiveService)->handle();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class ReceiveService extends BaseService
|
|||||||
|
|
||||||
$userBag = $this->userCouponModel->getReceiveCountByUserIds($this->userId, $idArr);
|
$userBag = $this->userCouponModel->getReceiveCountByUserIds($this->userId, $idArr);
|
||||||
|
|
||||||
if (count(array_diff(array_column($couponArr, 'id'), $userBag)) != $couponArr) throw new ErrException('优惠券已领完');
|
if (count(array_diff(array_column($couponArr, 'id'), $userBag)) != count($couponArr)) throw new ErrException('优惠券已领完');
|
||||||
|
|
||||||
$this->receive($couponArr);
|
$this->receive($couponArr);
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ class ReceiveService extends BaseService
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($allUpdateData)) return;
|
if (empty($this->allUpdateData) || empty($this->insertData)) return;
|
||||||
|
|
||||||
$this->matters();
|
$this->matters();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user