| | |
| | | |
| | | $newData[] = [ |
| | | 'code' => $item->code, |
| | | 'card_no' => $item->card_no, |
| | | 'r_raffled_at' => $item->r_raffled_at, |
| | | 'last_num' => $last_num, |
| | | 'status' => $item->status, |
| | |
| | | throw new \Exception('数据不存在'); |
| | | } |
| | | $rewards = CommonModel::getFormatRewards($codeModel->r_rewards); |
| | | $card_platform = CommonModel::getLibrary($codeModel->library_id,\Yii::$app->mall->id); |
| | | return [ |
| | | 'code' => ApiCode::CODE_SUCCESS, |
| | | 'msg' => '获取成功', |
| | | 'data' => [ |
| | | 'codeModel' => $codeModel, |
| | | 'rewards' => $rewards, |
| | | 'card_platform' => $card_platform |
| | | ], |
| | | ]; |
| | | } catch (\Exception $exception) { |
| | |
| | | $this->mall_id = $mall_id; |
| | | } |
| | | |
| | | public function setCodeModel($code) |
| | | public function setCodeModel($code,$card_no) |
| | | { |
| | | $this->codeModel = ExchangeCode::find()->where([ |
| | | 'code' => $code, |
| | | //'card_no' => $card_no, |
| | | 'card_no' => $card_no, |
| | | 'mall_id' => $this->mall_id, |
| | | ])->one(); |
| | | } |
| | |
| | | } |
| | | |
| | | //后台 |
| | | public function admin($mall_id, $code) |
| | | public function admin($mall_id, $code,$card_no) |
| | | { |
| | | $this->validate->setMallId($mall_id); |
| | | $this->validate->setCodeModel($code); |
| | | $this->validate->setCodeModel($code,$card_no); |
| | | $this->validate->hasCode();//是否存在码 |
| | | $this->validate->hasExchange();//是否兑换 |
| | | $this->validate->hasDisable();//是否禁用 |