1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-26 20:52:44 +08:00

调整推荐课程缓存时间

This commit is contained in:
xiaochong0302 2023-12-11 17:47:07 +08:00
parent 6cee04917c
commit 3e08ad8dcb
4 changed files with 8 additions and 21 deletions

View File

@ -14,13 +14,11 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class FeaturedArticleList extends Cache class FeaturedArticleList extends Cache
{ {
protected $lifetime = 86400; protected $lifetime = 3600;
public function getLifetime() public function getLifetime()
{ {
$tomorrow = strtotime('tomorrow'); return $this->lifetime;
return $tomorrow - time();
} }
public function getKey($id = null) public function getKey($id = null)

View File

@ -14,13 +14,11 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class FeaturedCourseList extends Cache class FeaturedCourseList extends Cache
{ {
protected $lifetime = 86400; protected $lifetime = 3600;
public function getLifetime() public function getLifetime()
{ {
$tomorrow = strtotime('tomorrow'); return $this->lifetime;
return $tomorrow - time();
} }
public function getKey($id = null) public function getKey($id = null)
@ -30,7 +28,7 @@ class FeaturedCourseList extends Cache
public function getContent($id = null) public function getContent($id = null)
{ {
$limit = 8; $limit = 5;
$courses = $this->findCourses($limit); $courses = $this->findCourses($limit);
@ -71,7 +69,7 @@ class FeaturedCourseList extends Cache
* @param int $limit * @param int $limit
* @return ResultsetInterface|Resultset|CourseModel[] * @return ResultsetInterface|Resultset|CourseModel[]
*/ */
protected function findCourses($limit = 8) protected function findCourses($limit = 5)
{ {
return CourseModel::query() return CourseModel::query()
->where('featured = 1') ->where('featured = 1')

View File

@ -14,13 +14,11 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class FeaturedQuestionList extends Cache class FeaturedQuestionList extends Cache
{ {
protected $lifetime = 86400; protected $lifetime = 3600;
public function getLifetime() public function getLifetime()
{ {
$tomorrow = strtotime('tomorrow'); return $this->lifetime;
return $tomorrow - time();
} }
public function getKey($id = null) public function getKey($id = null)

View File

@ -42,13 +42,6 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">匿名</label>
<div class="layui-input-block">
<input type="radio" name="anonymous" value="1" title="是">
<input type="radio" name="anonymous" value="0" title="否">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">删除</label> <label class="layui-form-label">删除</label>
<div class="layui-input-block"> <div class="layui-input-block">