- aksrt_ticket gains urge_count / last_urge_time (schema 3.1.0) - cooldown moves from transient to an atomic conditional UPDATE - urge inserts a system reply rendered as a centered notice (not quotable) - admin list badge + info card row for urge count / last time - new ticket_urge_admin mail event via aksrt_ticket_urged Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
54 lines
2.1 KiB
PHP
54 lines
2.1 KiB
PHP
<?php
|
||
/**
|
||
* @package AKSRT
|
||
*/
|
||
|
||
namespace AKSRT\Core;
|
||
|
||
defined('ABSPATH') || exit;
|
||
|
||
class DBMigrator {
|
||
use DBMigratorPart2;
|
||
use DBMigratorPart3;
|
||
use DBMigratorIdentity;
|
||
use DBMigratorVip;
|
||
use DBMigratorTicket;
|
||
|
||
/** Current schema version; changing it re-runs dbDelta. */
|
||
// 2.5.1: order_aftersale 新增 images 列(售后举证图片)。dbDelta 仅在版本变化时
|
||
// 重跑,新增/调整列必须同步升版本,否则老安装不会执行 ALTER TABLE。
|
||
// 2.5.2: order_aftersale 新增 apply_form 列(结构化申请表单:预置原因 / 申请资料 / 申请说明)。
|
||
// 2.6.0: order_aftersale 新增 handling_log 列(处理记录:每次状态提交一条
|
||
// 「状态 + 备注 + 来源 + 时间」),取代单一的 admin_note / reviewed_at / completed_at,
|
||
// 并移除从未被写入的 gateway_request_id / gateway_refund_id / gateway_result。
|
||
// 3.0.0: 售后(order_aftersale)整体替换为工单系统(6 张 aksrt_ticket* 表)。
|
||
// 工单不再绑定订单退款流程:标题 + 部门 + 描述为必填,关联订单为可选项;
|
||
// 沟通记录从工单上的 JSON 日志升级为独立的 ticket_reply 行(支持引用回复)。
|
||
// 3.1.0: aksrt_ticket 新增 urge_count / last_urge_time(催单次数与最近催单时间),
|
||
// 催单冷却改由 last_urge_time 判定,不再依赖 transient;催单同时写入 system 类型的 ticket_reply。
|
||
const SCHEMA_VERSION = '3.1.0';
|
||
|
||
const OPT_KEY = 'aksrt_db_schema_version';
|
||
|
||
/**
|
||
* Register hooks.
|
||
*/
|
||
public static function init(): void {
|
||
add_action('after_switch_theme', [self::class, 'maybe_migrate']);
|
||
add_action('admin_init', [self::class, 'maybe_migrate']);
|
||
}
|
||
|
||
/**
|
||
* Run table schema upgrade when version mismatches.
|
||
*/
|
||
public static function maybe_migrate(): void {
|
||
$current = get_option(self::OPT_KEY, '');
|
||
if ($current === self::SCHEMA_VERSION) {
|
||
return;
|
||
}
|
||
|
||
self::run();
|
||
update_option(self::OPT_KEY, self::SCHEMA_VERSION);
|
||
}
|
||
}
|