*/ class UserAuthController extends OnAuthController { /** * 首页 * * @return ActiveDataProvider */ public function actionIndex() { return new ActiveDataProvider([ 'query' => $this->modelClass::find() ->where(['status' => StatusEnum::ENABLED, 'member_id' => Yii::$app->user->identity->member_id]) ->andFilterWhere(['merchant_id' => $this->getMerchantId()]) ->orderBy('id desc') ->asArray(), 'pagination' => [ 'pageSize' => $this->pageSize, 'validatePage' => false,// 超出分页不返回data ], ]); } /** * @param $id * @return \yii\db\ActiveRecord * @throws NotFoundHttpException */ protected function findModel($id) { /* @var $model \yii\db\ActiveRecord */ if (empty($id) || !($model = $this->modelClass::find()->where([ 'id' => $id, 'status' => StatusEnum::ENABLED, 'member_id' => Yii::$app->user->identity->member_id, ])->andFilterWhere(['merchant_id' => $this->getMerchantId()])->one())) { throw new NotFoundHttpException('请求的数据不存在或您的权限不足.'); } return $model; } }