Example #1
0
 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;
     }
 }
Example #2
0
 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 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]);
 }
Example #4
0
 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 init()
 {
     $items = Config::find()->all();
     //        $items = Config::findAll($condition);
     foreach ($items as $item) {
         if ($item->param) {
             $this->data[$item->param] = $item->value === '' ? $item->default : $item->value;
         }
     }
 }
Example #6
0
 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]);
 }
Example #7
0
 /**
  * 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;
 }
Example #9
0
 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;
     }
 }
Example #10
0
 /**
  * Lists all Config models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Config::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
Example #11
0
 public function actionAbout()
 {
     $data = Config::find()->select('content, title, description, keyword')->where('com="about"')->one();
     return $this->render('about', ['data' => $data]);
 }
 /**
  * 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);
     }
 }
Example #13
0
 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]);
 }