/** * 充值提现 */ public function actionMoney() { $user_id = Yii::app()->user->getId(); $thisuser = Users::model()->findByPk($user_id); #获得用户的银行卡 $thisbank = Bankcard::model()->find("user_id=:user_id", array(":user_id" => $user_id)); if (!$thisbank) { $thisbank = new Bankcard(); } if (isset($_POST['Bankcard'])) { if (empty($_POST['Bankcard']['bank_name'])) { $_POST['Bankcard']['bank_name'] = "工商银行"; } $thisbank->setAttributes($_POST['Bankcard']); //赋值真实姓名 $thisbank->setAttribute("realname", $thisuser->realname); if ($thisbank->validate()) { if ($thisbank->isNewRecord) { $thisbank->save(); } else { $thisbank->update(); } } $_REQUEST['tab'] = "tab2"; } $this->render('money', array("thisuser" => $thisuser, "thisbank" => $thisbank)); }
/** * 用户银行卡信息 */ public function actionBankCard() { $user_id = Yii::app()->user->getId(); $bankCard = Bankcard::model()->find("user_id=:user_id", array(":user_id" => $user_id)); if (!$bankCard) { $bankCard = new Bankcard(); } if (isset($_POST['Bankcard'])) { $bankCard = MemberService::saveBankCard($bankCard, $user_id); } $this->pageTitle = "银行卡"; $this->render('member_bankcard', array("bankCard" => $bankCard)); }