public function authenticate() { $record = Account::model()->findByAttributes(array('Username' => $this->username)); if ($record === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if ($record->Pass !== $this->password) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $record->Id; $this->setState('role', $record->Role); $this->setState('fullname', $record->Fullname); $this->setState('my_infrastructureid', ''); $this->setState('my_infrastructurename', ''); $record->LastLogin = new CDbExpression('NOW()'); $record->save(); /* foreach ($record->mikrotiks as $mikrotik){ $my_mikrotik[$mikrotik->m_id] = $mikrotik->m_name; if($record->m_id==0){ $record->m_id = $mikrotik->m_id; $record->save(); } } $this->setState('my_mikrotik',$my_mikrotik); $this->setState('my_mikrotikid', $record->m_id); */ $this->errorCode = self::ERROR_NONE; } } return !$this->errorCode; }
private function getModel() { if (!$this->isGuest && $this->_model === null) { $this->_model = Account::model()->findByAttributes($this->memb___id, array('select' => 'status')); } return $this->_model; }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { if (isset($_POST['Message'])) { $toUsers = explode(',', $_POST['toUsers']); $arrUserIds = array(); foreach ($toUsers as $toUser) { $username = trim(strtok(trim($toUser), '-')); $user = Account::model()->findByAttributes(array('username' => $username)); if ($user && $user->getPrimaryKey() != $this->viewer->getPrimaryKey()) { $arrUserIds = array_merge($arrUserIds, array($user->getPrimaryKey())); } } if (!empty($arrUserIds)) { foreach ($arrUserIds as $userId) { $model = new Message(); $model->subject = $_POST['Message']['subject']; $model->message = $_POST['Message']['message']; $model->id_from = $this->viewer->getPrimaryKey(); $model->id_user = $userId; $model->save(); } } Yii::app()->user->setFlash('message', Yii::t('flexiblearn', 'Your message is sent successfully !!!')); $this->redirect(array('manage')); } Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/jquery.autocomplete-min.js'); Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/stylesheet/autocomplete.css'); $this->render('create', array('model' => new Message())); }
function actionIndex() { $account = Account::model()->findByPk(Yii::app()->user->id); $restrict_arr = unserialize($account['Restrict']); $munu_list = MenuList::getMenuListByMenuNumStr($restrict_arr); $this->renderPartial('home', array('menu_list' => $munu_list)); }
public function actionMylist() { if (false) { $this->redirect(Yii::app()->baseUrl . '/login'); } $msgInfo = "none"; $msgError = "none"; if (!empty($_POST) && $_POST['action'] == "create") { //if(AccountInfrastructure::model()->findByAttributes(array(''=>$_REQUEST['infraname'])) $newinfra = new Infrastructure(); $newinfra->Name = $_POST['infraname']; $newinfra->Device = 1; if ($newinfra->save()) { $newAcctInfra = new AccountInfrastructure(); $newAcctInfra->Account_Id = Yii::app()->user->getId(); $newAcctInfra->Infrastructure_Id = $newinfra->Id; $newAcctInfra->IsOnwer = 1; if ($newAcctInfra->save()) { $msgInfo = "Create the Infrastructure Successfully"; } else { print_r($newAcctInfra->errors); } } else { print_r($newinfra->errors); } } $myaccount = Account::model()->findByPk(Yii::app()->user->getId()); $this->renderPartial('mylist', array('msgError' => $msgError, 'msgInfo' => $msgInfo, 'infralist' => $myaccount)); }
/** * Authenticates a user. * The example implementation makes sure if the username and password * are both 'demo'. * In practical applications, this should be changed to authenticate * against some persistent user identity storage (e.g. database). * @return boolean whether authentication succeeds. */ public function authenticate() { //在这个地方来校验用户名和密码的真实性 //首先来看看是否有此用户名存在 //find() 如果没有查询出来数据,则会返回null //findAll() 空数据会返回空数组 //根据用户名查询是否有一个用户信息 $user_model = Account::model()->find('UserName=:name', array(':name' => $this->username)); //如果用户名不存在 if ($user_model === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; return false; } else { if ($user_model->Valid == 0 || $user_model->PassWord !== md5($this->password)) { //密码判断 $this->errorCode = self::ERROR_PASSWORD_INVALID; return false; } else { $this->_id = $user_model->ID; $this->_name = $user_model->RealName; $this->errorCode = self::ERROR_NONE; return true; } } }
/** * Authenticates a user. * The example implementation makes sure if the username and password * are both 'demo'. * In practical applications, this should be changed to authenticate * against some persistent user identity storage (e.g. database). * @return boolean whether authentication succeeds. */ public function authenticate() { // $users=array( // // username => password // 'demo'=>'demo', // 'admin'=>'admin', // ); // if(!isset($users[$this->username])) // $this->errorCode=self::ERROR_USERNAME_INVALID; // elseif($users[$this->username]!==$this->password) // $this->errorCode=self::ERROR_PASSWORD_INVALID; // else // $this->errorCode=self::ERROR_NONE; // return !$this->errorCode; $account = Account::model()->find('Username=:Username', array('Username' => $this->username)); if ($account === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if (isset($account->Password) && $account->Password != $this->password) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->errorCode = self::ERROR_NONE; Yii::app()->user->setState('idAccount', $account->ID); $user = Users::model()->find('ID_Account=:id', array('id' => $account->ID)); Yii::app()->user->setState('idUser', $user->ID); } } return !$this->errorCode; }
public function actionIndex() { $db = Account::model()->getDbConnection(); $total = $db->createCommand("SELECT SUM(amount) FROM account")->queryScalar(); $criteria = new CDbCriteria(); $criteria->order = "id DESC"; $criteria->limit = 5; $articles = Article::model()->findAll($criteria); $this->render('index', array('total' => $total, 'articles' => $articles)); }
public function getModel() { if (!isset($this->id)) { $this->model = new Account(); } if ($this->model === null) { $this->model = Account::model()->findByPk($this->id); } return $this->model; }
public function init() { $eventHandler = array($this, 'deletePersonsOrAccountsItems'); Contact::model()->attachEventHandler('onAfterDelete', $eventHandler); $this->attachedEventHandlersIndexedByModelClassName['Contact'] = array('onAfterDelete', $eventHandler); User::model()->attachEventHandler('onAfterDelete', $eventHandler); $this->attachedEventHandlersIndexedByModelClassName['User'] = array('onAfterDelete', $eventHandler); Account::model()->attachEventHandler('onAfterDelete', $eventHandler); $this->attachedEventHandlersIndexedByModelClassName['Account'] = array('onAfterDelete', $eventHandler); }
public function actionValidEmail() { $record = Account::model()->findByAttributes(array('Email' => $_REQUEST['email'])); $count = count($record); if ($count === 0) { $output = true; } else { $output = false; } echo json_encode($output); }
public function authenticate() { if (!($user = Account::model()->findByAttributes(['email' => $this->username]))) { $this->errorCode = self::ERROR_USERNAME_INVALID; } elseif (!$user->checkPass($this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $user->id; $this->setState('timezone', $user->getAttribute('timezone')); $this->errorCode = self::ERROR_NONE; } return !$this->errorCode; }
public function init() { // register class paths for extension captcha extended Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php', 'CaptchaExtendedValidator' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedValidator.php')); $this->unreadReceivedMessagesCount = Yii::app()->db->createCommand()->select('count(*)')->from('message')->where(array('and', 'id_user = :id', 'is_read = 0'), array('id' => Yii::app()->user->getId()))->queryScalar(); $this->viewer = null; if (!Yii::app()->user->getIsGuest()) { $this->viewer = Account::model()->findByPk(Yii::app()->user->getId()); } $params = $this->getActionParams(); if (!empty($params) && array_key_exists('code', $params) && $params['code']) { Yii::app()->setLanguage($params['code']); } }
function actionIndex() { $login_model = new LoginForm(); if (isset($_POST['LoginForm'])) { $login_model->attributes = $_POST['LoginForm']; //用户名和密码(包括真实性)判断validate,持久化session信息login if ($login_model->validate() && $login_model->login()) { Account::model()->updateByPk(Yii::app()->user->id, array('LastLoginTime' => date('Y-m-d H:i:s', time()), 'LastLoginIp' => Yii::app()->request->userHostAddress)); // 更新最后登录时间与IP $this->redirect(Yii::app()->createUrl('Home/Index')); } } //调用模板 $this->renderPartial('index', array('login_model' => $login_model)); }
/** * Logs in the user using the given username and password in the model. * @return boolean whether login is successful */ public function login() { if ($this->_identity === null) { $this->_identity = new UserIdentity($this->username, $this->password); $this->_identity->authenticate(); } if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) { $duration = $this->rememberMe ? 3600 * 24 * 30 : 0; // 30 days Yii::app()->user->login($this->_identity, $duration); Account::model()->updateByPk($this->_identity->id, array('last_login' => new CDbExpression('NOW()'), 'ip_add' => Yii::app()->getRequest()->getUserHostAddress())); return true; } else { return false; } }
public function run() { if (!Yii::app()->user->isGuest) { $wechat = Account::model()->findByAttributes(array('account' => Yii::app()->session['wechat']['unionid'], 'status' => 1)); if (Yii::app()->session['wechat'] && !empty($wechat)) { $wechat->status = 0; $wechat->save(); } Yii::app()->session['wechat'] = null; Yii::app()->session['user'] = null; $_identity = new UserIdentity(); $_identity->logout(); $this->controller->redirect('/registered/'); } else { Yii::app()->session['wechat'] = null; Yii::app()->session['user'] = null; } }
public function authenticate() { // find the account by its username $account = Account::model()->findByAttributes(array('ACCOUNT' => $this->username)); // tests the given password against account's if ($account && $account->comparePassword($this->password)) { // when it is successful, set the id with account's $this->_id = $account->ID; // as it is a successful test, no error occurs $this->errorCode = self::ERROR_NONE; // returns the validation summary as TRUE return TRUE; } // this two codes will only be executed when above test fails // set the error as unknown membership // and returns a FALSE value indicating a failed authentication $this->errorCode = self::ERROR_UNKNOWN_IDENTITY; return FALSE; }
/** * Authenticates a user. * The example implementation makes sure if the username and password * are both 'demo'. * In practical applications, this should be changed to authenticate * against some persistent user identity storage (e.g. database). * @return boolean whether authentication succeeds. */ public function authenticate() { $user = Account::model()->find('LOWER(name)=?', array(strtolower($this->username))); if ($user === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if (!$user->validatePassword($this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $user->id; $this->username = $user->name; //$this->type=$user->type; $this->setState('id', $user->id); $this->setState('type', $user->type_id); //$user->saveAttributes(array('last_login_time'=>date("Y-m-d H:i:s", time()),)); $this->errorCode = self::ERROR_NONE; } } return $this->errorCode == self::ERROR_NONE; }
public function authenticate() { $username = strtolower($this->username); $user = Account::model()->find('LOWER(account_email)=?', array($username)); if ($user === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if (!$user->validatePassword($this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $user->account_id; // get Profile detail //$accountContact = CompanyContact::model()->find('account_id=?', array($user->account_id)); $accountProfile = AccountProfile::model()->find('account_id = ?', array($user->account_id)); $accountSubscriptions = AccountSubscription::model()->findSubscriptions($user->account_id); // set currently selected subscription default as first on the list reset($accountSubscriptions); $this->setState('linx_app_selected_subscription', key($accountSubscriptions)); $this->username = $user->account_email; $this->setState('account_email', $user->account_email); $this->setState('account_subscriptions', $accountSubscriptions); $tz = $user->account_timezone; if (trim($tz) == '') { $tz = 'Asia/Singapore'; } $this->setState('timezone', $tz); //$this->setState('isMasterAccount', Account::model()->isMasterAccount($user->account_id) ? YES : NO); if ($accountProfile === null) { $this->setState('account_contact_surname', ''); $this->setState('account_contact_given_name', ''); } else { $this->setState('account_profile_surname', $accountProfile->account_profile_surname); $this->setState('account_profile_given_name', $accountProfile->account_profile_given_name); $this->setState('account_profile_preferred_display_name', $accountProfile->account_profile_preferred_display_name); $this->setState('account_profile_short_name', $accountProfile->getShortFullName()); } $this->errorCode = self::ERROR_NONE; } } return $this->errorCode == self::ERROR_NONE; }
public function authenticate() { $record = Account::model()->findByAttributes(array('memb___id' => $this->username)); $getChar = AccountCharacter::model()->findByAttributes(array('Id' => $this->username)); if ($this->getFConfig('md5') == 0) { if ($record === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if ($record->memb__pwd != $this->password) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $record->memb_guid; $this->username = $record->memb___id; $this->setState('guid', $record->memb_guid); $this->setState('char', $getChar->GameIDC); $this->setState('username', $record->memb___id); $this->setState('role', $record->status); $this->errorCode = self::ERROR_NONE; } } } else { if ($record === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if ($record->memb__pwd != md5($this->password . $this->username)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $record->memb_guid; $this->memb___id = $record->memb___id; $this->setState('char', $getChar->GameIDC); $this->setState('account', $record->memb___id); $this->setState('role', $record->status); $this->errorCode = self::ERROR_NONE; } } } return !$this->errorCode; }
/** * Authenticates a user. * The example implementation makes sure if the username and password * are both 'demo'. * In practical applications, this should be changed to authenticate * against some persistent user identity storage (e.g. database). * @return boolean whether authentication succeeds. */ public function authenticate() { $username = strtolower($this->username); $user = Account::model()->find('LOWER(username)=?', array($username)); if ($user === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if (!$user->validatePassword($this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $user->id; $this->username = $user->username; $this->errorCode = self::ERROR_NONE; if ($user->last_login == null) { $lastLogin = time(); } else { $lastLogin = strtotime($user->last_login); } $this->setState('last_login', $lastLogin); $this->errorCode = self::ERROR_NONE; } } return !$this->errorCode; }
echo $form->labelEx($model, 'name'); ?> <?php echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'name'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'parent_id'); ?> <?php echo CHtml::dropDownList('Account[parent_id]', $model->category_id, CHtml::listData(Account::model()->findAll(array('order' => 'code')), 'id', 'name'), array('empty' => '(Select parent account) ')); ?> <?php echo $form->error($model, 'parent_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'checking'); ?> <?php echo $form->checkBox($model, 'checking', array('size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'chacking');
protected function custAccountInfo($customer_id) { $model = null; if ($customer_id != null) { $model = Account::model()->getAccountInfo($customer_id); } return $model; }
<div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'journaldetail-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data'))); $this->widget('ToolbarButton', array('isSave' => true, 'UrlSave' => 'genjournal/writedetail', 'DialogID' => 'createdialog1', 'DialogGrid' => 'detaildatagrid', 'isCancel' => true, 'UrlCancel' => 'genjournal/cancelwritedetail')); echo $form->hiddenField($model, 'journaldetailid'); echo $form->hiddenField($model, 'genjournalid'); ?> <div class="row"> <?php echo $form->labelEx($model, 'accountid'); echo $form->hiddenField($model, 'accountid'); ?> <input type="text" name="account_name" id="account_name" title="Account name" readonly value="<?php echo Account::model()->findByPk($model->accountid) !== null ? Account::model()->findByPk($model->accountid)->accountname : ''; ?> "> <?php $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'account_dialog', 'options' => array('title' => Yii::t('app', 'Account'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true))); $account = new Account('searchwstatus'); $account->unsetAttributes(); // clear any default values if (isset($_GET['Account'])) { $account->attributes = $_GET['Account']; } $this->widget('zii.widgets.grid.CGridView', array('id' => 'account-grid', 'dataProvider' => $account->Searchwstatus(), 'filter' => $account, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("V", array("name" => "send_absschedule", "id" => "send_absschedule", "onClick" => "$(\\"#account_dialog\\").dialog(\\"close\\"); $(\\"#account_name\\").val(\\"$data->accountname\\"); $(\\"#Journaldetail_accountid\\").val(\\"$data->accountid\\"); "))'), array('name' => 'accountid', 'visible' => false, 'value' => '$data->accountid', 'htmlOptions' => array('width' => '1%')), 'accountcode', 'accountname'))); $this->endWidget('zii.widgets.jui.CJuiDialog');
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Account the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Account::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Set id of current subscription view * * @param int $id */ public static function setCurrentlySelectedSubscription($id) { if (!isset(Yii::app()->user->linx_app_selected_subscription)) { return false; } // check if this user is master account $is_master = Account::model()->isMasterAccount($id); // or a member of this subscription $master_account_id = AccountSubscription::model()->getSubscriptionOwnerID($id); $is_member = AccountTeamMember::model()->isValidMember($master_account_id, Yii::app()->user->id); if ($is_master || $is_member) { Yii::app()->user->linx_app_selected_subscription = $id; return true; } return false; }
public function getTotalDue() { $currency_type = CurrencyType::model()->getActiveCurrency(); $total_data = array(); $total_mc = array(); foreach ($currency_type as $i => $currency) { $total_ = 0; foreach ($this->getCart() as $item) { if ($item['currency_id'] == $currency->currency_id) { $total_ += Common::calDiscount($item['discount'], $item['price'], $item['quantity']); } } $account = Account::model()->getAccountByCurType($this->getCustomer(), $currency->code); if ($account) { foreach ($account as $acc) { $total_ = $acc['current_balance'] + $total_; } } foreach ($this->getPayments() as $payment) { if ($currency->code == $payment["currency_code"]) { $total_ = $total_ - $total_ * $this->getTotalDiscount() / 100 - $payment["payment_amount"]; } } //$total_ = $total_ - $total_*$this->getTotalDiscount()/100; $total_data = array((int) $currency->code => array('currency_code' => $currency->code, 'currency_id' => $currency->currency_id, 'currency_symbol' => $currency->currency_symbol, 'total' => $total_)); $total_mc += $total_data; } return $total_mc; }
private function bindWechat($bind = 0, $user = array()) { $wechat = Yii::app()->session['wechat']; if ($bind == 1 && $wechat) { $account = Account::model()->findByAttributes(array('account' => $wechat['unionid'], 'source' => 1, 'status' => 1)); if (!$account) { $account = new Account(); $account->source = 1; $account->account = $wechat['unionid']; $account->subSource = $wechat['openid']; $account->userId = $user->id; $account->insert(); } } }
/** * 记录订单 */ public function actionOrder() { $this->pageTitle = "购买商品"; $error = ""; if (isset($_GET['id'])) { $pid = $_GET['id']; $product = Product::model()->findByPk($pid); if ($product) { #获得用户的可用资金 $user_id = Yii::app()->user->getId(); #判断用户是否已经填写了送货地址 $userAddress = UserProudctAddress::model()->find("user_id=:user_id", array(":user_id" => $user_id)); if ($userAddress) { $userAccount = Account::model()->find("user_id=:user_id", array(":user_id" => $user_id)); if (!$userAccount->use_money < $product->product_price) { #调有存储过程冻结资金并生成订单 try { $addip = Yii::app()->request->getUserHostAddress(); $in_order_price = $in_order_pay_price = $product->product_price; $in_coupon_id = 0; $in_p_user_id = $product->product_user_id; $p_id = $product->product_id; $in_realname = $userAddress->realname; $in_phone = $userAddress->phone; $in_address = $userAddress->address; $conn = Yii::app()->db; $command = $conn->createCommand('call p_build_Product_Order(:in_user_id,:in_p_user_id,:p_id,:in_order_price,:in_order_pay_price,:in_coupon_id,:in_realname,:in_phone,:in_address,:in_addip,@out_status,@out_remark)'); $command->bindParam(":in_user_id", $user_id, PDO::PARAM_INT); $command->bindParam(":in_p_user_id", $in_p_user_id, PDO::PARAM_INT); $command->bindParam(":p_id", $p_id, PDO::PARAM_INT); $command->bindParam(":in_order_price", $in_order_price, PDO::PARAM_STR, 30); $command->bindParam(":in_order_pay_price", $in_order_pay_price, PDO::PARAM_STR, 30); $command->bindParam(":in_coupon_id", $in_coupon_id, PDO::PARAM_INT); $command->bindParam(":in_realname", $in_realname, PDO::PARAM_STR, 30); $command->bindParam(":in_phone", $in_phone, PDO::PARAM_STR, 30); $command->bindParam(":in_address", $in_address, PDO::PARAM_STR, 200); $command->bindParam(":in_addip", $addip, PDO::PARAM_STR, 50); $command->execute(); $result = $conn->createCommand("select @out_status as status,@out_remark as remark")->queryRow(true); if ($result['status'] == 1) { $error = '购买成功!'; $notices = array('type' => 3, 'msgtitle' => '错误信息', 'message' => $error, 'backurl' => Yii::app()->request->urlReferrer, 'backtitle' => '返回', 'tourl' => Yii::app()->createUrl('/wechat/member/myProduct'), 'totitle' => '查看订单'); } else { $error = $result['remark']; $notices = array('type' => 2, 'msgtitle' => '错误信息', 'message' => $error, 'backurl' => Yii::app()->request->urlReferrer, 'backtitle' => '返回'); } } catch (Exception $e) { $error = '系统繁忙,暂时无法处理'; $notices = array('type' => 2, 'msgtitle' => '错误信息', 'message' => $error, 'backurl' => Yii::app()->request->urlReferrer, 'backtitle' => '返回'); } } else { #跳转到充值页面 $error = "你的可用资金不足以购买此商品。"; $notices = array('type' => 3, 'msgtitle' => '错误信息', 'message' => $error, 'backurl' => Yii::app()->request->urlReferrer, 'backtitle' => '返回', 'tourl' => Yii::app()->createUrl('/wechat/member/addmoney'), 'totitle' => '前往充值'); } } else { #跳转到充值页面 $error = "您没有填写收货地址。"; $notices = array('type' => 3, 'msgtitle' => '错误信息', 'message' => $error, 'backurl' => Yii::app()->request->urlReferrer, 'backtitle' => '返回', 'tourl' => Yii::app()->createUrl('/wechat/member/proAddress'), 'totitle' => '完善送货地址'); } } else { $error = "不存在此商品或者该商品已下架。"; $notices = array('type' => 2, 'msgtitle' => '错误信息', 'message' => $error, 'backurl' => Yii::app()->request->urlReferrer, 'backtitle' => '返回'); } } else { $error = "不存在此商品或者该商品已下架。"; $notices = array('type' => 2, 'msgtitle' => '错误信息', 'message' => $error, 'backurl' => Yii::app()->request->urlReferrer, 'backtitle' => '返回'); } #msg类型:type=1错误信息2指示跳转3返回跳转 Yii::app()->user->setFlash('wechat_fail', array($notices)); $this->redirect(Yii::app()->createUrl('wechat/notice/errors')); }
public function loadModel($name) { $this->_model = Character::model()->with('honor', 'stats')->find('name = ?', array($name)); if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } // Hide GM characters $account = Account::model()->find('id = ?', array($this->_model->account)); if ($account !== null && !$account->isPlayer()) { throw new CHttpException(404, 'The requested page does not exist.'); } return $this->_model; }