mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-15 21:02:20 +08:00
还原分页中kg_array_object
This commit is contained in:
parent
e27a203ac8
commit
9d8ed0f863
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||
* @license https://opensource.org/licenses/GPL-2.0
|
||||
* @link https://www.koogua.com
|
||||
*/
|
||||
|
||||
namespace App\Caches;
|
||||
|
||||
use App\Models\Comment as CommentModel;
|
||||
|
||||
class MaxCommentId extends Cache
|
||||
{
|
||||
|
||||
protected $lifetime = 365 * 86400;
|
||||
|
||||
public function getLifetime()
|
||||
{
|
||||
return $this->lifetime;
|
||||
}
|
||||
|
||||
public function getKey($id = null)
|
||||
{
|
||||
return 'max_comment_id';
|
||||
}
|
||||
|
||||
public function getContent($id = null)
|
||||
{
|
||||
$comment = CommentModel::findFirst(['order' => 'id DESC']);
|
||||
|
||||
return $comment->id ?? 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
{%- macro item_type_info(value) %}
|
||||
{% if value == 1 %}
|
||||
课程
|
||||
{% elseif value == 2 %}
|
||||
套餐
|
||||
{% elseif value == 3 %}
|
||||
会员
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro item_full_info(item_type,item_info) %}
|
||||
{% if item_type == 1 %}
|
||||
{% set course = item_info.course %}
|
||||
<p>名称:{{ course.title }}({{ course.id }})</p>
|
||||
<p>类型:{{ item_type_info(item_type) }} 价格:{{ '¥%0.2f'|format(course.market_price) }}</p>
|
||||
{% elseif item_type == 2 %}
|
||||
{% set package = item_info.package %}
|
||||
<p>名称:{{ package.title }}({{ package.id }})</p>
|
||||
<p>类型:{{ item_type_info(item_type) }} 价格:{{ '¥%0.2f'|format(package.market_price) }}</p>
|
||||
{% elseif item_type == 3 %}
|
||||
{% set vip = item_info.vip %}
|
||||
<p>期限:{{ '%d个月'|format(vip.expiry) }}({{ vip.id }})</p>
|
||||
<p>类型:{{ item_type_info(item_type) }} 价格:{{ '¥%0.2f'|format(vip.price) }}</p>
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro schedules_info(schedules) %}
|
||||
{% for value in schedules %}
|
||||
<span class="layui-badge layui-bg-gray">{{ value }}点</span>
|
||||
{% endfor %}
|
||||
{%- endmacro %}
|
@ -33,7 +33,7 @@ class View extends PhView
|
||||
/**
|
||||
* 分页数据
|
||||
*/
|
||||
if (isset($var->items) && is_array($var->items)) {
|
||||
if (isset($var->total_items)) {
|
||||
$var->items = kg_array_object($var->items);
|
||||
} elseif (is_array($var)) {
|
||||
$var = kg_array_object($var);
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Caches\MaxCommentId as MaxCommentIdCache;
|
||||
use Phalcon\Mvc\Model\Behavior\SoftDelete;
|
||||
|
||||
class Comment extends Model
|
||||
@ -167,18 +166,12 @@ class Comment extends Model
|
||||
$this->update_time = time();
|
||||
}
|
||||
|
||||
public function afterCreate()
|
||||
{
|
||||
$cache = new MaxCommentIdCache();
|
||||
|
||||
$cache->rebuild();
|
||||
}
|
||||
|
||||
public static function itemTypes()
|
||||
{
|
||||
return [
|
||||
self::ITEM_CHAPTER => '章节',
|
||||
self::ITEM_ARTICLE => '文章',
|
||||
self::ITEM_QUESTION => '问题',
|
||||
self::ITEM_ANSWER => '回答',
|
||||
];
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ class RefundCreate extends LogicService
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$logger = $this->getLogger('refund');
|
||||
|
||||
$post = $this->request->getPost();
|
||||
|
||||
$order = $this->checkOrderBySn($post['order_sn']);
|
||||
@ -74,13 +72,8 @@ class RefundCreate extends LogicService
|
||||
|
||||
$task = new TaskModel();
|
||||
|
||||
$itemInfo = [
|
||||
'refund' => ['id' => $refund->id],
|
||||
];
|
||||
|
||||
$task->item_id = $refund->id;
|
||||
$task->item_type = TaskModel::TYPE_REFUND;
|
||||
$task->item_info = $itemInfo;
|
||||
$task->priority = TaskModel::PRIORITY_MIDDLE;
|
||||
$task->status = TaskModel::STATUS_PENDING;
|
||||
|
||||
@ -96,6 +89,8 @@ class RefundCreate extends LogicService
|
||||
|
||||
$this->db->rollback();
|
||||
|
||||
$logger = $this->getLogger('refund');
|
||||
|
||||
$logger->error('Create Refund Exception ' . kg_json_encode([
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine(),
|
||||
|
@ -26,7 +26,7 @@ class TradeInfo extends LogicService
|
||||
{
|
||||
$trade = $this->checkTradeBySn($sn);
|
||||
|
||||
$user = $this->getCurrentUser();
|
||||
$user = $this->getLoginUser(true);
|
||||
|
||||
return $this->handleTrade($trade, $user);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user