frontend\controllers\StoreController::actionIndex PHP 메소드

actionIndex() 공개 메소드

店铺
public actionIndex ( integer $id, string $category = 'all', $q = '' ) : string
$id integer
$category string
리턴 string
    public function actionIndex($id, $category = 'all', $q = '')
    {
        /* @var $model Store */
        $model = Store::findOne($id);
        if (!$model) {
            throw new NotFoundHttpException('未找到该营业点!');
        }
        if ($model->status === Store::STATUS_DISABLED) {
            throw new BadRequestHttpException('该店铺已被禁用,请重新选择!');
        }
        $modelCate = $category === 'all' ? null : Category::findOne(['slug' => $category]);
        $this->_remember($model);
        return $this->render('index', ['model' => $model, 'modelCate' => $modelCate, 'q' => $q]);
    }