<h2><?php echo $model->username;?></h2> <h4 class="signature"><?php echo $model->signature;?></h4> </div> <div class="col-lg-3 col-lg-offset-4 col-md-3 col-md-offset-4 col-sm-3 col-sm-offset-4 zone-nut"> <ul class="list-inline"> <li class="col-lg-6 col-md-6 col-sm-6 "> <?php if (Common::transTime(UserCourse::userTotalTime($model->id)) == 0): ?> <h4>0</h4> <?php else: ?> <h4><?php echo Common::transTime(UserCourse::userTotalTime($model->id))?></h4> <?php endif ?> <h5>学习时长</h5> </li> <li class="col-lg-6 col-md-6 col-sm-6 "> <h4><?php echo Nut::nutCount($model->id)?></h4> <h5>果果</h5> </li> </ul> </div> </div> <div class="col-lg-2 col-md-2 col-sm-2 zone-user-sex"> <?php if ($model->sex == $model::SEX_FEMALE) : ?> <span class="fa fa-venus"></span> <?php endif; ?> <?php if ($model->sex == $model::SEX_MALE) : ?> <span class="fa fa-mars"></span> <?php endif; ?> <?php if ($model->sex == $model::SEX_SECRET) : ?> <span class="fa fa-genderless"></span>
/** * Finds the Nut model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Nut the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Nut::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionPlayEnd() { $userId = Yii::$app->user->id; $chapterId = Yii::$app->request->post('courseId'); $userPlayModel = new UserPlay(); $userPlayModel = $userPlayModel->findOneLearnModel($userId, $chapterId); $userPlayModel->learn_status = $userPlayModel::LEARN_STATUS_FINISH; if (!Nut::isGetNut($userId, $chapterId)) { Nut::addData($userId, $chapterId); } if ($userPlayModel->save()) { echo Json::encode('true'); return; } else { echo Json::encode('false'); return; } }