public function beforeAction($action) { if (parent::beforeAction($action)) { //读取站点配置 $config = Config::find(['id' => 1])->asArray()->one(); if ($config) { $this->view->params['siteconfig'] = $config; } else { die('site config is error'); } if (!Yii::$app->session->isActive) { Yii::$app->session->open(); } if (Yii::$app->session->hasFlash("key")) { $xxxaaa = Yii::$app->session->getFlash("key"); if ($xxxaaa) { echo "<script>alert('" . $xxxaaa . "');</script>"; } unset($xxxaaa); } return true; } else { return false; } }
public function actionIndex($invitation = null) { if ($invitation !== null) { $_GET['parent'] = $invitation; } $request = wanhunet::$app->request; $wechat = wanhunet::app()->wechat; $token = $wechat->getOauth2AccessToken($request->get('code')); $refreshToken = $wechat->refreshOauth2AccessToken($token['refresh_token']); $info = $wechat->getSnsMemberInfo($refreshToken['openid'], $refreshToken['access_token']); if (is_bool($info)) { return "请在微信中打开"; } /** @var ShareGift $shareGift */ if (($shareGift = ShareGift::find()->where(['wechat_id' => $refreshToken['openid']])->one()) === null) { $shareGift = new ShareGift(); $shareGift->wechat_info = json_encode($info); $shareGift->wechat_id = $refreshToken['openid']; $giftList = explode(',', Config::getInstance()->getProperty("setIncEM.gift")); $shareGift->gift_limit = $giftList[rand(0, count($giftList) - 1)]; if (!is_numeric($shareGift->gift_limit)) { return "请在微信中打开"; } $shareGift->save(); } else { if ($shareGift->has_gift == ShareGift::HAS_GIFT) { return $this->hasGift($shareGift); } } /** @var Invest $invest */ $invest = Invest::find()->where(["type" => Invest::TYPE_REG])->one(); $num = $shareGift->gift_limit * $invest->invest_date * ($invest->rate / 100) / 12; $num = sprintf("%.2f", $num); return $this->view("index", ['shareGift' => $shareGift, 'num' => $num, 'wechat_id' => $info['openid']]); }
private function rechargeList($startTime = 0, $endTime = 0, $where = []) { $endTime = $endTime == 0 ? time() : $endTime; $assetMoneys = AssetMoney::find()->joinWith(['member' => function ($query) { /** @var \yii\db\ActiveQuery $query */ $query->select(Member::$SELECT_ROW); }])->andWhere(ArrayHelper::merge(['type' => AssetMoney::TYPE_MENTION], $where))->andWhere(['>=', 'wh_asset_money.created_at', $startTime])->andWhere(['<=', 'wh_asset_money.created_at', $endTime])->orderBy('id desc')->asArray()->all(); $actions = Config::getInstance()->getProperty('assetLog'); foreach ($assetMoneys as &$assetMoney) { $assetMoney['action'] = isset($actions[$assetMoney['action']]) ? $actions[$assetMoney['action']] : "赠送"; $assetMoney['created_at'] = date('Y-m-d', $assetMoney['created_at']); $assetMoney['updated_at'] = date('Y-m-d', $assetMoney['updated_at']); $assetMoney['type'] = AssetMoney::get_type($assetMoney['type']); $assetMoney['status'] = AssetMoney::get_status($assetMoney['status']); if (isset($assetMoney['member'])) { $assetMoney['member']['idcard_status'] = Member::get_auth_status($assetMoney['member']['idcard_status']); $assetMoney['member']['email_status'] = Member::get_auth_status($assetMoney['member']['email_status']); $assetMoney['member']['status'] = Member::get_record_status($assetMoney['member']['status']); $assetMoney['member']['created_at'] = date('Y-m-d', $assetMoney['member']['created_at']); foreach ($assetMoney['member'] as $key => &$memberInfo) { $assetMoney['member_' . $key] = $memberInfo; } unset($assetMoney['member']); } } return $assetMoneys; }
public function actionUpdate($id) { $configModel = Config::find()->where(['id_config' => $id])->one(); if ($configModel->load(Yii::$app->request->post()) && $configModel->save()) { return $this->redirect(['index']); } return $this->render('update', ['model' => $configModel]); }
/** * Finds the Config model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Config the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Config::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionIndex() { $data = Config::find()->select('content, title, description, keyword')->where('com="support"')->one(); $this->title = 'Support'; $models = Support::find()->orderBy('featured DESC, created_date DESC')->all(); $dataProvider = new ActiveDataProvider(['query' => Support::find()->orderBy('featured DESC, created_date DESC'), 'pagination' => ['pageSize' => 10]]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function __construct($id, $module, $config = []) { $this->post = Yii::$app->request->post(); // 加载数据库配置 \Yii::$app->params['category'] = Config::article_category(); \Yii::$app->params['tag'] = Config::article_tag(); parent::__construct($id, $module, $config = []); }
public function actionConfigClass() { if (is_array(Config::article_category())) { echo "Config::article_category()测试通过\n"; } if (is_array(Config::article_tag())) { echo "Config::article_tag()测试通过\n"; } }
public function set($key, $value) { $model = Config::findOne(['param' => $key]); if (!$model) { throw new Exception('Undefined parameter ' . $key); } $this->data[$key] = $value; $model->value = $value; $model->save(); }
public function search($params) { $query = Config::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'value', $this->value])->andFilterWhere(['like', 'datatype', $this->datatype]); return $dataProvider; }
public function actionConfig() { $configs = Config::find()->indexBy('id')->all(); if (Model::loadMultiple($configs, \Yii::$app->request->post()) && Model::validateMultiple($configs)) { foreach ($configs as $config) { $config->save(false); } return $this->redirect('config'); } return $this->render('config', ['configs' => $configs]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Config::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'sitename', $this->sitename])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'keywords', $this->keywords])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'beianhao', $this->beianhao])->andFilterWhere(['like', 'tongji', $this->tongji])->andFilterWhere(['like', 'n1', $this->n1])->andFilterWhere(['like', 'n2', $this->n2])->andFilterWhere(['like', 'n3', $this->n3])->andFilterWhere(['like', 'n4', $this->n4])->andFilterWhere(['like', 'n5', $this->n5])->andFilterWhere(['like', 'n6', $this->n6])->andFilterWhere(['like', 'n7', $this->n7])->andFilterWhere(['like', 'n8', $this->n8]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Config::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'param', $this->param])->andFilterWhere(['like', 'value', $this->value])->andFilterWhere(['like', 'default', $this->default])->andFilterWhere(['like', 'label', $this->label])->andFilterWhere(['like', 'type', $this->type]); return $dataProvider; }
public function beforeAction($action) { if (parent::beforeAction($action)) { //读取站点配置 $config = Config::find(['id' => 1])->asArray()->one(); if ($config) { $this->view->params['siteconfig'] = $config; } else { die('site config is error'); } if (!Yii::$app->session->isActive) { Yii::$app->session->open(); } return true; } else { return false; } }
public function __construct($id, $module, $config = []) { //用户是否登录判断 if (isset($_COOKIE['LoginKey'])) { $cookie = $_COOKIE['LoginKey']; //LoginKey是登录凭证 $sql = "select * from user where cookie = '{$cookie}'"; $res = \Yii::$app->db->createCommand($sql)->queryAll(); if ($res) { Yii::$app->view->params['user'] = $res[0]; //已经登录用户,保存用户信息 } } // 加载数据库配置 \Yii::$app->params['category'] = Config::article_category(); \Yii::$app->params['tag'] = Config::article_tag(); parent::__construct($id, $module, $config = []); }
public function beforeAction($action) { //判断管理员是否登录 //登录后的管理员会在客户端存下 access_token //该access_token 与 Cache里面的 admin_login 比对下,正确就是已登录管理员 if ('/site/login.html' != $_SERVER['REQUEST_URI']) { if (!isset($_COOKIE['access_token'])) { header("Location:/site/login.html"); exit; } // 暂时先注释掉,只要有access_token就可以登录了 // $access_token = Cache::get('admin_login'); // if($_COOKIE['access_token']!= $access_token){ // header("Location:/site/login.html"); // exit(); // } } // 加载数据库配置 \Yii::$app->params['category'] = Config::article_category(); \Yii::$app->params['tag'] = Config::article_tag(); $this->post_data = \Yii::$app->request->post(); }
/** * @return array * @throws \yii\db\Exception * * verify_success_email //验证邮箱成功 * verify_success_phone //验证手机成功 * firstMoney //第一次充值 * firstIdcard //填写身份证 * jiuxin //绑定玖信账号 * setIncEM.wechat /绑定玖信账号 * setIncEM.invitationParent //用户通过邀请码注册父级得分 * setIncEM.invitationParentConut9 //用户通过邀请码第九个注册父级得分 * setIncEM.invitationConut9 //用户通过邀请码第九个注册自己得分 */ public function actionSetting() { $request = wanhunet::$app->request; if ($request->isGet) { $configs = Config::getInstance()->config; foreach ($configs as $key => &$config) { if (strstr($key, 'setIncEM.')) { $configs[str_replace('setIncEM.', '', $key)] = $config; unset($configs[$key]); } } return json_encode($configs); } else { $connection = wanhunet::$app->db; $rs = []; foreach ($request->post() as $key => $value) { try { $rs[] = $connection->createCommand()->update('wh_config', ['value' => $value], ['key' => 'setIncEM.' . $key])->execute(); } catch (\Exception $e) { } } return $rs; } }
<div class="shezhi_td_od"> <img src="<?php echo $root; ?> images/to2.png" alt=""> </div> <div class="shezhi_td_d"> <p>绑定玖信账号</p> </div> <div class="shezhi_td_th"> <p> <?php if (($memberOther = $member->getOtherInfo(\modules\member\models\MemberOther::TABLE_JIUXIN)) !== null) { echo '已认证'; } else { echo '认证获' . \common\models\Config::getInstance()->getProperty('setIncEM.jiuxin') . '体验金'; } ?> </p> </div> </div> </aside> </a> <a href="<?php echo \yii\helpers\Url::to(['site/recharge']); ?> "> <aside class="shezhi_aside"> <div class="shezhi_div"> <div class="shezhi_td_od"> <img src="<?php
/** * 首次验证手机 * @param $event */ public function setIncPhone($event) { /** @var Event $event */ /** @var \modules\member\models\Member $member */ $member = wanhunet::app()->member; if (($parentModel = Member::findByInvitation($member->parent_id)) !== null) { $asset = new Asset(['userId' => $parentModel->id]); $config = Config::getInstance(); $asset->setIncExperienceMoney($config->getProperty('setIncEM.invitationParent'), 'site/invitationParent'); if ($parentModel->findFriends(true) == 9) { $asset->setIncExperienceMoney($config->getProperty('setIncEM.invitationParentConut9'), 'site/invitationParentConut9'); $this->setIncEM(new Event(['name' => 'invitationConut9'])); } $asset->saveExperienceMoney(); } $this->setIncEM(new Event(['name' => 'verify_success_phone'])); $this->setIncEMMax(new Event(['name' => 'verify_success_phone'])); }
public static function getAlreadyBuyCount(Invest $invest) { $id = $invest->id; $config = Config::getInstance(); $isset = $config->hasProperty('setTime.' . self::NAME_ORDER_EXPIRE); $timeExpire = $isset ? $config->getProperty('setTime.' . self::NAME_ORDER_EXPIRE) : 30 * 3600; return $ordersCount = self::find()->where('invest_id=:invest_id and status=:status_payed', [':invest_id' => $id, ':status_payed' => self::STATUS_PAYED])->count(); }
public function __construct($id, $module, $config = []) { $user = ''; // 变量,数组,用户 do { if (isset($_COOKIE['LoginKey'])) { $cookie = $_COOKIE['LoginKey']; debug($cookie, 'cookie'); $sql = "select * from user where cookie = '{$cookie}'"; $res = \Yii::$app->db->createCommand($sql)->queryAll(); // 用户已经登录,跳出用户相关业务逻辑 if ($res) { Yii::$app->view->params['user'] = $res[0]; //已经登录用户,保存用户信息 break; } } //用户未登录,判断是否微信端 //用户不使用微信 if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') === false) { break; } //用户使用微信 $go_to_weixin = $this->actionGetWeixinCode(); //用户打开mobile端,跳转到微信获取授权 if (!isset($_GET['state'])) { header("location:{$go_to_weixin}"); exit; } //微信用户授权后跳转回mobile端 //未授权 if (!isset($_GET['code'])) { //以游客身份登录? //提醒用户必须授权,不授权不让用 break; } //已授权 //获取特殊的获取用户信息的access_token $res = $this->_get_weixin_user_access_token($_GET['code']); //获取特殊access_token失败 if (isset($res->errcode)) { debug("get access_token fail"); break; } //获取成功 //获取用户信息 $userinfo = $this->_get_weixin_user_info($res); //获取用户信息失败 if (!isset($userinfo->nickname)) { break; } // 已注册用户 // 通过openid判断该用户是否是已经 $user = User::find()->where("openid = '{$userinfo->openid}'")->one(); //新注册用户 if (!$user) { $user = new User(); $user->openid = $userinfo->openid; $user->nickname = $userinfo->nickname; $user->sex = $userinfo->sex; $user->city = $userinfo->city; $user->province = $userinfo->province; $user->avatar = $userinfo->headimgurl; $user->register_time = date("Y-m-d H:i:s", time()); $user->status = 0; $user->type = 0; } $user->cookie = User::Generate_cookie_key(); // 用户保存失败 $user->save(); // 给前端发送秘钥 $user = User::find()->where("id = '{$user->id}'")->asArray()->one(); setCookie('LoginKey', $user['cookie'], time() + 3600); //已经登录用户,保存用户信息 Yii::$app->view->params['user'] = $user; } while (false); // 使用微信js_sdk $this->use_js_sdk(); // 加载数据库配置 \Yii::$app->params['category'] = Config::article_category(); \Yii::$app->params['tag'] = Config::article_tag(); parent::__construct($id, $module, $config = []); }
public function setIncExperienceMoneyInc($step = 0) { $this->experience_money_max_inc += $step; $incMax = Config::getInstance()->getProperty('setIncMax.Inc'); if ($this->experience_money_max_inc > $incMax) { $time = (int) ($this->experience_money_max_inc / $incMax); $this->experience_money_max_inc = $this->experience_money_max_inc % $incMax; $this->setIncExperienceMoneyMax($incMax * $time); return $this->saveExperienceMoneyMax(); } return $this->update(); }
?> <?php $this->registerMetaTag(['name' => 'description', 'content' => \common\models\Config::get('SEO_SITE_DESCRIPTION')]); ?> <?php $this->head(); ?> </head> <body> <?php $this->beginBody(); ?> <div class="wrap"> <header class="header" style="background:url(<?php echo \common\models\Config::get('PAGE_TOP_BG'); ?> ) no-repeat;background-size: cover;"> <h1><?php echo Html::a(Yii::$app->name, Yii::$app->homeUrl); ?> </h1> </header> <?php NavBar::begin(['brandLabel' => Yii::$app->name, 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]); $menuItems = []; foreach (\common\models\Category::find()->all() as $nav) { $menuItems[] = ['label' => $nav['title'], 'url' => ['/article/index', 'cate' => $nav['name']]]; } echo Nav::widget(['options' => ['class' => 'navbar-nav'], 'items' => $menuItems]); $rightMenuItems = [];
} ?> <div class="password-reset"> <p><?php echo Yii::t('app', 'Dear '); echo Html::encode($user_name); echo Yii::t('app', ','); ?> </p> <p><?php echo Yii::t('app', 'Congratulations, we’ve approved your application for your new BriteLine! You were approved for a $'); echo Html::encode(number_format($loan->loc)); echo Yii::t('app', ' Line of Credit. The current interest rate is '); echo number_format(Config::get('libor') + $loan->margin_rate, 2); echo Yii::t('app', '%, with an Annual Percentage Rate ("APR") of '); echo number_format((Config::get('libor') + $loan->margin_rate) * 365 / 360, 2); echo Yii::t('app', '%. Your rate is variable and will change based on the current market Index of 1 Month LIBOR plus a Margin of '); echo Html::encode(number_format($loan->margin_rate, 2)); echo Yii::t('app', '%. LIBOR, or the London Interbank Offered Rate, is a benchmark used to determine interest rates on various types of loans and lines of credit arround the world.'); ?> </p> <p><?php echo Yii::t('app', 'The final steps are for you to sign 4 key documents before you can start making advances on your BriteLine. Three of these documents must be electronically signed using DocuSign. You must sign a hard copy of the fourth document. '); ?> </p> <p><?php echo Yii::t('app', 'Immediately following this email, you\'ll see an email from DocuSign inviting you to electronically sign the following three documents:'); ?> </p> <ul> <li><?php
public function actionAbout() { $data = Config::find()->select('content, title, description, keyword')->where('com="about"')->one(); return $this->render('about', ['data' => $data]); }
public function actionDoupdate() { $loc = loan::find()->where(['id_loan' => $this->loan->id_loan])->one(); // 读取 payment if (!empty($this->loan->id_loan) && $this->loan->status == Dict::LOAN_STATUS_ACTIVE) { $payment = LoanBorrower::find()->where(['id_loan' => $this->loan->id_loan])->one(); $LoanPaymentPreferenceModel = LoanPaymentPreference::find()->where(['id_loan' => $this->loan->id_loan])->one(); $type_checked = $LoanPaymentPreferenceModel['type']; $bankAccountModel = LoanBankAcount::find()->andWhere(['id_loan' => $this->loan->id_loan, 'account_type' => '2'])->one(); $bankAccountModel_1 = LoanBankAcount::find()->andWhere(['id_loan' => $this->loan->id_loan, 'account_type' => '1'])->one(); $acheck = 2; if ($bankAccountModel['bank_name'] == $bankAccountModel_1['bank_name'] && $bankAccountModel['routing_number'] == $bankAccountModel_1['routing_number'] && $bankAccountModel['account_name'] == $bankAccountModel_1['account_name'] && $bankAccountModel['account_number'] == $bankAccountModel_1['account_number']) { $acheck = 1; } if (empty($bankAccountModel)) { $bankAccountModel = $bankAccountModel_1; $acheck = 1; $no_val = null; } else { $no_val = $bankAccountModel; } if ($type_checked != 1) { $acheck = 1; } } else { return $this->render("payment", ['status' => 0]); } // 读取 bank account if ($LoanPaymentPreferenceModel->load(Yii::$app->request->post())) { $paymentPost = Yii::$app->request->post('LoanPaymentPreference'); $achchecked = Yii::$app->request->post('optionsRadios'); $LoanBankAcount = Yii::$app->request->post('LoanBankAcount'); //得到LoanPaymentPreference数据 if (!empty($LoanPaymentPreferenceModel)) { $LoanPaymentPreferenceModel->type = $paymentPost['type']; $LoanPaymentPreferenceModel->save(); } $bankaccoun = LoanBankAcount::find()->andWhere(['id_loan' => $this->loan->id_loan, 'account_type' => '2'])->one(); if (empty($bankaccoun)) { $bankaccoun = new LoanBankAcount(); } if ($paymentPost['type'] == Dict::LOAN_PAYMENT_ACH) { if ($achchecked == 1) { $bannaccoun1 = LoanBankAcount::find()->andWhere(['id_loan' => $this->loan->id_loan, 'account_type' => '1'])->one(); $bankaccoun->bank_name = $bannaccoun1->bank_name; $bankaccoun->routing_number = $bannaccoun1->routing_number; $bankaccoun->account_name = $bannaccoun1->account_name; $bankaccoun->account_number = $bannaccoun1->account_number; } else { $bankaccoun->bank_name = $LoanBankAcount['bank_name']; $bankaccoun->routing_number = $LoanBankAcount['routing_number']; $bankaccoun->account_name = $LoanBankAcount['account_name']; $bankaccoun->account_number = $LoanBankAcount['account_number']; } $bankaccoun->id_loan = $this->loan->id_loan; $bankaccoun->account_type = 2; $bankaccoun->save(false); } else { $bankaccoun->id_loan = $this->loan->id_loan; $bankaccoun->account_type = 2; $bankaccoun->save(false); } $this->redirect('/loan/payment'); } $config_pay = Config::find()->where(['config_name' => "pay_to_adress"])->one(); $config_fee = Config::find()->where(['config_name' => "check_processing_fee"])->one(); $config['pay'] = $config_pay['config_value']; $config['fee'] = $config_fee['config_value']; $config['loc'] = $loc['loc'] * Dict::LOAN_PAYMENT_RATE / Dict::LOAN_PAYMENT_MONTH; $config['acheck'] = $acheck; $LoanPaymentPreferenceModel->type = $type_checked; return $this->render('update_payment', ['config' => $config, 'status' => Dict::LOAN_STATUS_ACTIVE, 'type_checked' => $type_checked, 'loan' => $this->loan, 'payment' => $payment, 'no_val' => $no_val, 'bankAccountModel' => $bankAccountModel, 'LoanPaymentPreference' => $LoanPaymentPreferenceModel, 'bankAccountModel_1' => $bankAccountModel_1]); }
use kartik\widgets\DatePicker; use common\models\Config; // 生成 label 样式 $label_css = ''; switch ($model->status) { case 1: $label_css = 'label-default'; break; case 2: $label_css = 'label-warning'; break; case 3: $label_css = 'label-success'; break; } $libor = number_format(floatval(Config::get('libor')), 5, '.', ''); $auth = $this->context->AUTH == Dict::AUTH_OPERATE ? false : true; /* @var $this yii\web\View */ /* @var $model common\models\Application */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Applications'), 'url' => ['/application/index']]; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', $model->application->application_name), 'url' => ['/application/view', 'id' => $model->id_application]]; $this->params['breadcrumbs'][] = $this->title; ?> <section class="content-wrap"> <div class="container"> <?php echo $this->render('../application/_status', ['model' => $model->application]); ?> <div class="row pt50">
/** * @throws ErrorException */ private function _sendVcode() { $vcodeTime = Config::getInstance()->getProperty('setTime.vcode'); $content = '您的验证码为:' . $this->code . '请在' . $vcodeTime / 60 . '分钟内进行处理'; if (($old = self::findByField($this->field)) !== null && $old->created_at > time() - $vcodeTime) { throw new ErrorException($vcodeTime - (time() - $old->created_at), ErrorCode::Vcode_short_time); } if ($this->type == self::TYPE_EMAIL) { try { Utils::sendEmail($this->field, '玖信贷邮箱验证码', $content); } catch (\Exception $e) { throw new ErrorException('验证码发送错误', ErrorCode::Send_email_error); } } else { if (Utils::sendSMS($this->field, $content) < 0) { throw new ErrorException('验证码发送错误', ErrorCode::Send_phone_error); } } }
public function actionEmailCaptcha() { $request = wanhunet::$app->request; $params = []; if ($request->isPost) { $email = $request->post('email'); $params['email'] = $email; try { $vcode = new VerificationCode(); $vcode->field = $email; $vcode->save(); $params['info'] = '发送成功'; $params['min'] = Config::getInstance()->getProperty('setTime.vcode'); } catch (\ErrorException $e) { if ($e->getCode() == ErrorCode::Vcode_short_time) { $params['min'] = $e->getMessage(); $params['info'] = '时间间隔过短'; } else { $params['info'] = $e->getMessage(); } } } return $this->goBack($params, Url::to(['site/email'])); }
/** * Finds the Config model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Config the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModelAll($id) { if (($model = Config::find()->where(['id' => $id])->all()) !== null) { return $model; } else { throw new HttpException(404); } }