feat : coupon template
This commit is contained in:
@@ -24,10 +24,23 @@ trait CouponDispenseTrait
|
||||
if (empty($cycleInfo)) throw new Exception('未找到该点餐周期');
|
||||
|
||||
$this->cycleId = $cycleInfo->id;
|
||||
|
||||
if ($this->groupType == CouponCode::DISPENSE_APPOINT_GROUP_DESIGNATED_SITES_AND_GOODS) {
|
||||
$appointValue = json_encode($this->request->input('appoint_value'));
|
||||
$this->appointValue = [
|
||||
'site' => explode(',', $appointValue['site']),
|
||||
'sku' => explode(',', $appointValue['goods'])
|
||||
];
|
||||
}
|
||||
$this->appointValue = explode(',', $this->request->input('appoint_value'));
|
||||
unset($cycleInfo);
|
||||
}
|
||||
|
||||
protected function getSiteAndGoodsValueAndCheckDate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws Exception
|
||||
@@ -51,10 +64,10 @@ trait CouponDispenseTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function getUserData(): array
|
||||
protected function getUserData(): void
|
||||
{
|
||||
$userIds = [];
|
||||
|
||||
@@ -95,16 +108,16 @@ trait CouponDispenseTrait
|
||||
case CouponCode::DISPENSE_APPOINT_GROUP_DESIGNATED_SITES_AND_GOODS:
|
||||
$orderIds = $this->orderModel
|
||||
->where('cycle_id',$this->cycleId)
|
||||
->whereIn('site_id',$this->appointValue)
|
||||
->whereIn('site_id',$this->appointValue['site'])
|
||||
->where('status',OrderCode::FINISH)
|
||||
->pluck('user_id','order_id')
|
||||
->toArray();
|
||||
|
||||
if (empty($orderIds)) throw new Exception('未找到该周期的订单');
|
||||
if (empty($orderIds)) throw new Exception('未找到该周期该地点的订单');
|
||||
|
||||
$skuOrderIds = $this->orderGoodModel
|
||||
->whereIn('order_id',array_keys($orderIds))
|
||||
->whereIn('sku_id',$this->appointValue)
|
||||
->whereIn('sku_id',$this->appointValue['sku'])
|
||||
->pluck('order_id')
|
||||
->toArray();
|
||||
$skuOrderIds = array_unique($skuOrderIds);
|
||||
@@ -115,7 +128,7 @@ trait CouponDispenseTrait
|
||||
break;
|
||||
}
|
||||
|
||||
return $userIds;
|
||||
$this->res = $userIds;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user