/** * Finds the MHelpdoc model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return MHelpdoc the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MHelpdoc::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionHelpdoc() { $this->layout = false; $gh_id = U::getSessionParam('gh_id'); $openid = U::getSessionParam('openid'); $helpdoc_id = $_GET['helpdoc_id']; $helpdoc = MHelpdoc::findOne(['helpdoc_id' => $helpdoc_id]); $helpdoc->sort = $helpdoc->sort + 1; $helpdoc->save(false); return $this->render('helpdoc', ['gh_id' => $gh_id, 'openid' => $openid, 'helpdoc' => $helpdoc]); }
</p> <p class="yuedu">阅读 <?php echo $helpdoc->sort; ?> </p> <ul class="table-view"> <?php if (!empty($helpdoc->relate)) { ?> <h5>查看相关问题</h5> <?php $relates = explode(",", $helpdoc->relate); foreach ($relates as $relate) { $hd = MHelpdoc::findOne(['visual' => 1, 'helpdoc_id' => $relate]); ?> <li class="table-view-cell"> <a data-ignore="push" class="navigate-right" href="<?php echo Url::to(['helpdoc', 'helpdoc_id' => $relate], true); ?> "> <?php echo $hd->title; ?> </a> </li> <?php }