Exemplo n.º 1
0
 /**
  * 查询第几部分名称,缓存24小时
  * @param $preTypeId
  * @return mixed
  * @throws \Exception
  */
 public static function findNameById($preTypeId)
 {
     $result = PreType::getDb()->cache(function () use($preTypeId) {
         return PreType::findOne($preTypeId);
     }, 24 * 3600);
     return $result->name;
 }
Exemplo n.º 2
0
 public function getPreType()
 {
     return $this->hasOne(PreType::className(), ['preTypeId' => 'preTypeId']);
 }
Exemplo n.º 3
0
 | <?php 
echo $session->get('testTitle');
?>
            (<?php 
echo $questionNumber;
?>
/<?php 
echo $session->get('totalNumber');
?>
)
        </h3>
    </div>
    <div class="panel-heading">
        <h3 class="panel-title">
            <span><?php 
echo \common\models\PreType::findNameById($preTypeId);
?>
|<?php 
echo \common\models\TestType::findNameById($testTypeId);
?>
</span>
            <?php 
if ($examFlag) {
    //考试需要倒计时
    ?>
            <span class="pull-right">剩余<span class="time">150</span>分钟</span>
            <?php 
}
?>
        </h3>
        <div class="clearfix"></div>