Files
wordpress-theme-aksrt/src/Core/DBMigratorPart3.php
T
kate522 3dd3f71c97 feat(invite-code): one-time invite codes with rewards, usage log, import/export
- 一次性邀请码:批量生成(次数/有效期/备注/四类奖励)、原子消费防超发、
  开启注册验证时奖励延迟发放(账本幂等键)
- Zibll 兼容文本导入(points/balance/vip/vip_time/level_integral,分隔符可自定义,
  第三段标识存为备注)、CSV 全字段导出与可回流文本导出
- 使用记录表 aksrt_invite_code_usage + 后台使用者列;注册表单 400ms 防抖实时校验
- 注册门控三模式(close/open/must)设置链路(PHP schema + admin SPA schema)
- 契约测试覆盖建表/消费竞态/导入导出/备注全链路
2026-09-21 20:53:36 +08:00

53 lines
2.0 KiB
PHP

<?php
/**
* @package AKSRT
*/
namespace AKSRT\Core;
defined('ABSPATH') || exit;
trait DBMigratorPart3 {
/**
* 表名访问器(其它模块通过此函数取,避免散落硬编码)。
*/
public static function table(string $name): string {
global $wpdb;
$allowed = [
'asset_account' => 'aksrt_asset_account',
'asset_transaction' => 'aksrt_asset_transaction',
'asset_entry' => 'aksrt_asset_entry',
'financial_flow' => 'aksrt_financial_flow',
'financial_flow_entry' => 'aksrt_financial_flow_entry',
'signin_log' => 'aksrt_signin_log',
'dl_token' => 'aksrt_dl_token',
'notification' => 'aksrt_notification',
'order' => 'aksrt_order',
'order_item' => 'aksrt_order_item',
'revenue' => 'aksrt_revenue',
'withdrawal' => 'aksrt_withdrawal',
'report' => 'aksrt_report',
'follow' => 'aksrt_follow',
'coupon' => 'aksrt_coupon',
'charge_card' => 'aksrt_charge_card',
'invite_code' => 'aksrt_invite_code',
'invite_code_usage' => 'aksrt_invite_code_usage',
'affiliate_relation' => 'aksrt_affiliate_relation',
'commission_ledger' => 'aksrt_commission_ledger',
'commission_adjustment' => 'aksrt_commission_adjustment',
'payout_account' => 'aksrt_payout_account',
'coupon_usage' => 'aksrt_coupon_usage',
'user_restriction' => 'aksrt_user_restriction',
'identity_application' => 'aksrt_identity_application',
'identity_event' => 'aksrt_identity_event',
'vip_membership_event' => 'aksrt_vip_membership_event',
];
if (!isset($allowed[$name])) {
return '';
}
return $wpdb->prefix . $allowed[$name];
}
}