feat : coupon

This commit is contained in:
2025-03-19 11:46:05 +08:00
parent d8d1ba3193
commit f4d681a23a
2 changed files with 7 additions and 2 deletions

View File

@@ -30,6 +30,11 @@ class CouponController extends AbstractController
return (new HomePopupsService)->handle();
}
/**
* @return array
*/
#[RequestMapping(path: "receive", methods: "POST")]
#[Scene(scene: "receive")]
public function receiveCoupon()
{
return (new ReceiveService)->handle();

View File

@@ -48,7 +48,7 @@ class ReceiveService extends BaseService
$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);
@@ -112,7 +112,7 @@ class ReceiveService extends BaseService
];
}
if (empty($allUpdateData)) return;
if (empty($this->allUpdateData) || empty($this->insertData)) return;
$this->matters();
}