res = []; if (empty($this->request->input('appoint_value'))) throw new Exception('请选择指定值'); match ($this->groupType = (int)$this->request->input('appoint_group',CouponCode::DISPENSE_APPOINT_GROUP_ALL_PEOPLE)) { CouponCode::DISPENSE_APPOINT_GROUP_DESIGNATED_USERS => $this->handleDesignatedUsers(), CouponCode::DISPENSE_APPOINT_GROUP_DESIGNATED_SITES => $this->handleDesignatedSites(), CouponCode::DISPENSE_APPOINT_GROUP_DESIGNATED_GOODS => $this->handleDesignatedGoods(), CouponCode::DISPENSE_APPOINT_GROUP_DESIGNATED_SITES_AND_GOODS => $this->handleDesignatedSitesAndGoods(), default => throw new Exception('不需要渲染用户数据') }; return $this->return->success('success',['list' => $this->res]); }catch (Exception $e) { throw new ErrException($e->getMessage()); } } /** * @return void */ private function handleDesignatedUsers(): void { $this->res = explode(',',$this->request->input('appoint_value')); } /** * @return void * @throws Exception */ private function handleDesignatedSitesAndGoods(): void { $this->getValueAndCheckDate(); $this->checkSite(); $this->checkSku(); $this->getUserData(); } /** * @return void * @throws Exception */ private function handleDesignatedSites(): void { $this->getValueAndCheckDate(); $this->checkSite(); $this->getUserData(); } /** * @return void * @throws Exception */ private function handleDesignatedGoods(): void { $this->getValueAndCheckDate(); $this->checkSku(); $this->getUserData(); } }