/** * Displays a single DcmdUser model. * @param integer $id * @return mixed */ public function actionView($id) { if (Yii::$app->user->getIdentity()->admin != 1) { Yii::$app->getSession()->setFlash('success', NULL); Yii::$app->getSession()->setFlash('error', "对不起, 你没有权限!"); return $this->redirect(array('index')); } $query = DcmdUserGroup::find()->andWhere("uid=" . $id)->asArray()->all(); $gids = "gid in (0"; ///array(0,); foreach ($query as $item) { $gids = $gids . "," . $item['gid']; } ////array_push($gids ,$item['gid']); $gids = $gids . ")"; $searchModel = new DcmdGroupSearch(); $dataProvider = $searchModel->search(array(), $gids); return $this->render('view', ['model' => $this->findModel($id), 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Lists all DcmdGroup models. * @return mixed */ public function actionIndex() { $searchModel = new DcmdGroupSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }