attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->search()); } /** * 核销卡详情页 */ public function actionVerifyDetail(){ $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->detail()); } /** * 修改密码 */ public function actionVerifyChangePass(){ return $this->asJson([ 'code' => 1, 'msg' => '暂不支持修改', ]); $form = new VerifyIndexForm(); $form->attributes = post_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->changePass()); } /** * 核销卡使用记录页 */ public function actionVerifyLog(){ $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->log()); } /** * 核销卡核销详情页 */ public function actionVerifyOrder(){ $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->order()); } /** * 添加新卡 */ public function actionVerifyAdd() { $form = new VerifyIndexForm(); $form->attributes = post_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->add()); } /** * 兑换详情 */ public function actionVerifyExchangeDetail() { $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->exchangeDetail()); } /** * 卡券兑换 */ public function actionVerifyExchange() { $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->exchange()); } /** * 卡券领取 */ public function actionReceive() { $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->receive()); } /** * 视频状态更新 */ public function actionVideo() { $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->videoUpdate()); } /** * 删除个人卡券 */ public function actionDel() { $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->delVerifyCard()); } /** * 获取核销记录 */ public function actionVerifyMdLog() { $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->getVerifyLog()); } public function actionList() { $form = new VerifyIndexForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); return $this->asJson($form->v_list()); } public function actionDetail($id = null){ $verify_card_info = VerifyCard::findOne($id); $verify_card_info->begin_time = $verify_card_info->begin_time? date("Y-m-d H:i:s",$verify_card_info->begin_time) : ''; $verify_card_info->end_time = $verify_card_info->end_time? date("Y-m-d H:i:s",$verify_card_info->end_time): ''; $verify_card_info->num = $verify_card_info->num - $verify_card_info->send_times; return $this->asJson([ 'code' => 0, 'data' => $verify_card_info, 'msg' => 'success', ]); } public function actionAddReceive(){ $form = new VerifyIndexForm(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); $form->share_user_id = \Yii::$app->request->get('share_user_id'); $form->verify_card_id = \Yii::$app->request->get('id'); return $this->asJson($form->add_receive()); } /** * 模块名:actionVerifyForCash * 代码描述:礼品卡折现 * 作者:WPing丶 * 请求方式:GET * 创建时间:2024/03/14 11:43:29 * @param int account_id 卡券id */ public function actionVerifyForCash() { $account_id = get_params('account_id', 0); $user_id = get_user_id(); $store_id = get_store_id(); $card = VerifyCardSale::findOne(['store_id' => $store_id, 'user_id' => $user_id, 'account_id' => $account_id, 'is_delete' => 0, 'status' => 0]); if(!$card) { return $this->asJson([ 'code' => 1, 'msg' => '礼品卡不存在或已使用', ]); } $account = VerifyCardAccount::findOne($account_id); $VerifyCard = VerifyCard::findOne($account->card_id); if(!$VerifyCard) { return $this->asJson([ 'code' => 1, 'msg' => '礼品卡不存在', ]); } /* begin 2025/07/26 17:15:52 修复礼品卡折现为0可以折现的BUG WPing丶 */ if(!$VerifyCard->for_cash) { return $this->asJson([ 'code' => 1, 'msg' => '此卡券不能折现', ]); } /* end */ $card->status = VerifyCardSale::STATUS_USED; $card->left_num = 0; $card->is_cash = 1; if(!$card->save()) { return $this->asJson([ 'code' => 1, 'msg' => '修改礼品卡状态失败', ]); } else { $res = AccountLog::saveLog($user_id,$VerifyCard->for_cash,AccountLog::TYPE_BALANCE, AccountLog::LOG_TYPE_INCOME,0,0,"礼品卡:".$account->account."折现"); if($res) { return $this->asJson([ 'code' => 0, 'msg' => '折现成功', ]); } } } }