feat : auto coupon

This commit is contained in:
2025-02-26 18:01:02 +08:00
parent 14ca3b6377
commit c8db3e170d
10 changed files with 605 additions and 86 deletions

View File

@@ -31,8 +31,10 @@ trait CouponDispenseTrait
'site' => explode(',', $appointValue['site']),
'sku' => explode(',', $appointValue['goods'])
];
} else {
$this->appointValue = explode(',', $this->request->input('appoint_value'));
}
$this->appointValue = explode(',', $this->request->input('appoint_value'));
unset($cycleInfo);
}
@@ -64,10 +66,10 @@ trait CouponDispenseTrait
}
/**
* @return void
* @return array
* @throws Exception
*/
protected function getUserData(): void
protected function getUserData(): array
{
$userIds = [];
@@ -128,14 +130,74 @@ trait CouponDispenseTrait
break;
}
$this->res = $userIds;
return $userIds;
}
/**
* @return array
* @throws Exception
*/
protected function handleDesignatedUsers(): array
{
$this->checkAppointValue();
return explode(',',$this->request->input('appoint_value'));
}
/**
* @return array
* @throws Exception
*/
protected function handleDesignatedSitesAndGoods(): array
{
$this->checkAppointValue();
$this->getValueAndCheckDate();
$this->checkSite();
$this->checkSku();
return $this->getUserData();
}
/**
* @return array
* @throws Exception
*/
protected function handleDesignatedSites(): array
{
$this->checkAppointValue();
$this->getValueAndCheckDate();
$this->checkSite();
return $this->getUserData();
}
/**
* @return array
* @throws Exception
*/
protected function handleDesignatedGoods(): array
{
$this->checkAppointValue();
$this->getValueAndCheckDate();
$this->checkSku();
return $this->getUserData();
}
/**
* @return void
* @throws Exception
*/
protected function getUserInfoByUserIds(array $userIds)
protected function checkAppointValue(): void
{
if (empty($this->request->input('appoint_value'))) throw new Exception('请选择指定值');
}
}