| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace backend\controllers;
- use common\services\xhAdminService;
- use common\services\xhTMessageService;
- use Yii;
- use yii\web\Controller;
- use yii\filters\AccessControl;
- use common\services\xhMerchantExtendService;
- use common\components\util;
- class SetController extends BackendController
- {
- public function actionIndex()
- {
- return $this->render('index',['merchant' => $this->merchant]);
- }
- public function actionInit()
- {
- $extend = xhMerchantExtendService::getByMerchantId($this->merchantId);
- $gradeList = xhMerchantExtendService::getGradeList($extend);
- return $this->render('init',['extend' => $extend,'gradeList' => $gradeList]);
- }
- public function actionModify()
- {
- $post = Yii::$app->request->post();
- $extend = $this->merchantExtend;
- unset($post['_csrf']);
- if($extend['integral'] == 1){//积分已经修改过,不能第二次修改
- unset($post['gradeList']);
- }else{
- $post['integral'] = 1;
- }
- xhMerchantExtendService::updateByMerchantId($this->merchantId, $post);//上面要先初始化,再执行这边的更新
- util::successInfo();
- }
- public function actionConfirmPassword()
- {
- return $this->render('confirmPassword',['admin' => $this->admin]);
- }
-
- public function actionModifyPassword()
- {
- $post = Yii::$app->request->post();
- $prePassword = isset($post['prePassword']) ? $post['prePassword'] : '';
- $password = isset($post['password']) ? $post['password'] : '';
- $admin = $this->admin;
- $dbPwd = $admin['confirmPassword'];
- if(!empty($dbPwd) && md5($prePassword) != $dbPwd){
- util::failInfo('原密码不正确');
- }
- xhAdminService::updateById($this->adminId, ['confirmPassword'=>md5($password)]);
- util::successInfo();
- }
- }
|