feat : coupon
This commit is contained in:
@@ -106,6 +106,12 @@ class DispenseAddService extends BaseService
|
||||
*/
|
||||
private int $dispenseId;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private int $itemCount;
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
@@ -159,7 +165,7 @@ class DispenseAddService extends BaseService
|
||||
$insertData[] = [
|
||||
'coupon_dispense_id' => $dispenseId,
|
||||
'user_id' => $userId,
|
||||
'total_count' => $this->request->input('item_count'),
|
||||
'total_count' => $this->itemCount,
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
}
|
||||
@@ -180,9 +186,9 @@ class DispenseAddService extends BaseService
|
||||
$insertModel->title = $this->request->input('title',date('Ymd').'分发优惠券');
|
||||
$insertModel->coupon_name = $this->request->input('coupon_name', $this->couponTemplateInfo->name);
|
||||
$insertModel->coupon_template_id = $this->couponTemplateInfo->id;
|
||||
$insertModel->total_count = 0;
|
||||
$insertModel->total_count = $this->request->input('total_count',count($this->userIds) * $this->itemCount);
|
||||
$insertModel->receive_count = 0;
|
||||
$insertModel->item_count = 0;
|
||||
$insertModel->item_count = $this->itemCount;
|
||||
$insertModel->appoint_group = $this->groupType;
|
||||
$insertModel->claim_rule = $this->claimRule;
|
||||
$insertModel->claim_value = $this->request->input('claim_value');
|
||||
@@ -215,6 +221,7 @@ class DispenseAddService extends BaseService
|
||||
private function checkCouponTemplate(): void
|
||||
{
|
||||
$this->couponTemplateInfo = $this->couponTemplateModel->getInfoById((int)$this->request->input('coupon_template_id'));
|
||||
$this->itemCount = (int)$this->request->input('item_count',1);
|
||||
|
||||
if (empty($this->couponTemplateInfo)) throw new Exception('未找到该优惠券模板');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user