| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace addons\Member\merchant\controllers;
- use Yii;
- use common\enums\StatusEnum;
- use common\traits\MerchantCurd;
- use common\models\member\Auth;
- use common\models\base\SearchModel;
- use common\enums\MemberTypeEnum;
- /**
- * Class AuthController
- * @package addons\Member\merchant\controllers
- * @author jianyan74 <751393839@qq.com>
- */
- class AuthController extends BaseController
- {
- use MerchantCurd;
- /**
- * @var \yii\db\ActiveRecord
- */
- public $modelClass = Auth::class;
- /**
- * 首页
- *
- * @return string
- * @throws \yii\web\NotFoundHttpException
- */
- public function actionIndex()
- {
- $searchModel = new SearchModel([
- 'model' => $this->modelClass,
- 'scenario' => 'default',
- 'partialMatchAttributes' => ['realname', 'mobile'], // 模糊查询
- 'defaultOrder' => [
- 'id' => SORT_DESC
- ],
- 'pageSize' => $this->pageSize
- ]);
- $dataProvider = $searchModel
- ->search(Yii::$app->request->queryParams);
- $dataProvider->query
- ->andWhere(['status' => StatusEnum::ENABLED])
- ->andWhere(['>', 'member_id', 0])
- ->andWhere(['member_type' => MemberTypeEnum::MEMBER])
- ->andFilterWhere(['merchant_id' => $this->getMerchantId()]);
- return $this->render($this->action->id, [
- 'dataProvider' => $dataProvider,
- 'searchModel' => $searchModel,
- ]);
- }
- }
|