Ejemplo n.º 1
0
 public function actionEdit()
 {
     $gid = $this->_getParam('id');
     $adminGroupModel = \app\models\WAdminGroup::findOne($gid);
     if ($adminGroupModel) {
         if (\Yii::$app->request->isPost) {
             $getPost = $this->_getPost('WAdminGroup');
             if ($this->buildInsert($adminGroupModel, $getPost)) {
                 \app\common\XUtils::message('success', '用户组更新成功!', \Yii::$app->urlManager->createUrl(['iadmin/auth/edit', 'id' => $id]));
             }
         }
         return $this->render('edit', ['model' => $adminGroupModel]);
     }
     \app\models\XUtils::message('error', '无此用户组信息', \Yii::$app->urlManager->createUrl('iadmin/auth/index'));
 }
Ejemplo n.º 2
0
 /**
  * 获取所有用户数据
  * @param  [type] $start    [description]
  * @param  [type] $pageSize [description]
  * @param  [type] $where    [description]
  * @return [type]           [description]
  */
 public function getAdminList($start, $pageSize, $where)
 {
     $connection = Yii::$app->db;
     $sqlOne = 'select a.id, a.username, a.last_login_time, g.group_name from ' . WAdmin::tableName() . ' as a left join ' . WAdminGroup::tableName() . ' as g on a.group_id = g.id where ' . $where . ' order by a.last_login_time desc, a.id asc limit ' . $start . ',' . $pageSize;
     $sqlTwo = 'select count(a.id) as n from ' . WAdmin::tableName() . ' as a left join ' . WAdminGroup::tableName() . ' as g on a.group_id = g.id where ' . $where;
     return array('data' => $connection->createCommand($sqlOne)->queryAll(), 'count' => $connection->createCommand($sqlTwo)->queryOne());
 }