*/ class SingleController extends BaseController { /** * @return string */ public function actionView() { $id = Yii::$app->request->get('single_id'); $model = Yii::$app->tinyBlogService->single->findById($id); if (empty($model)) { throw new UnprocessableEntityHttpException('找不到文章内容...'); } Single::updateAllCounters(['view' => 1], ['id' => $model['id']]); return $this->render($this->action->id,[ 'model' => $model ]); } }