| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\client\behaviors;
- use app\models\Mch;
- use Yii;
- use yii\base\ActionFilter;
- use yii\helpers\Json;
- use yii\web\Response;
- /**
- * Class MchLogin
- * @package app\modules\client\behaviors
- */
- class MchLogin extends ActionFilter
- {
- public function beforeAction($action)
- {
- $mch = Mch::findOne([
- 'user_id' => get_user_id(),
- 'is_delete' => 0,
- 'review_status' => 1,
- ]);
- if (!$mch) {
- \Yii::$app->response->format = Response::FORMAT_JSON;
- \Yii::$app->response->data = [
- 'code' => 1,
- 'msg' => '请先申请商户入驻。'
- ];
- return false;
- }
- Yii::$app->controller->mch = $mch;
- return true;
- }
- }
|