123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/3/8
- * Time: 上午10:33
- */
- namespace backend\controllers;
- use backend\base\CommonController;
- use backend\base\Help;
- use backend\server\User;
- use Yii;
- class UserController extends CommonController
- {
- /*
- * 用户管理-用户列表页面
- * */
- public function actionHome()
- {
- return $this->render('home');
- }
- /*
- * 用户管理-用户列表数据
- * */
- public function actionHomefrom()
- {
- $model = new User();
- $result = $model->Userlist();
- if ($result != false) {
- return Help::JsonData(0, '成功', $result['count'], $result['data']);
- }
- return Help::JsonData(Help::ERROR, '暂无数据');
- }
- /*
- * 添加用户页面
- * */
- public function actionAdduser()
- {
- return $this->render('adduser');
- }
- /*
- * 添加用户数据
- * */
- public function actionAdduserfrom()
- {
- $model = new User();
- $user = $model->Signup();
- if ($user === true) return Help::JsonCode(Help::SUCCESS, '账号添加成功');
- return Help::JsonCode(Help::ERROR, '账号添加失败');
- }
- /*
- * 用户添加角色页面
- * */
- public function actionAdduserrole()
- {
- $model = new User();
- $result = $model->UserRoleFilter();
- if ($result != false) {
- return $this->render('adduserrole', ['uid' => Yii::$app->request->get('uid'), 'model' => $result]);
- }
- }
- /*
- * 2020.6.23 lyy 设置用户状态
- * */
- public function actionUsersetstatus()
- {
- $model = new \backend\server\User();
- $result = $model->Usersetstatus();
- if ($result === true) return Help::JsonCode(Help::SUCCESS, '设置成功');
- return Help::JsonCode(Help::ERROR, '设置失败');
- }
- /*
- * 用户添加角色
- * */
- public function actionAdduserrolefrom()
- {
- $model = new \backend\server\RoleAuthority();
- if ($model->CreateUserRole() === true) {
- return Help::JsonCode(Help::SUCCESS, '添加成功');
- }
- return Help::JsonCode(Help::ERROR, '添加成功');
- }
- /*
- * 修改用户界面
- * */
- public function actionEdit()
- {
- $model = new \common\models\User();
- $model->uid = Yii::$app->request->get('id');
- $userInfo = $model->findUserName();
- if ($userInfo != null) return $this->render('edit', ['model' => $userInfo]);
- }
- /*
- * 修改用户数据
- * */
- public function actionEditform()
- {
- $model = new \backend\server\User();
- $result = $model->UserSaveForm();
- if ($result === true) return Help::JsonCode(Help::SUCCESS, '修改成功');
- return Help::JsonCode(Help::ERROR, '修改失败', $result);
- }
- /*
- * 个人密码修改
- * */
- public function actionPwdsave()
- {
- return $this->render('pwdsave');
- }
- /*
- * 用户密码修改
- * */
- public function actionPwdsaveform()
- {
- $model = new \backend\server\User();
- $result = $model->PasswordSave();
- if ($result === true) {
- return Help::JsonCode(Help::SUCCESS, '密码修改成功');
- }
- return Help::JsonCode(Help::ERROR, $result);
- }
- }
|