积分与余额账务系统硬切重构

This commit is contained in:
kate522 committed 2026-08-24 15:59:11 +08:00
1 parent ca12226b39
commit 5cae5b5c93
159 files changed
+7275 -4718

No files matched your search

+1 -3
View File
@@ -52,9 +52,7 @@ $user_credits = 0;
$user_download_count = 0;
if ($is_logged_in) {
$uid = get_current_user_id();
if (class_exists('\AKSRT\Credits\Credits')) {
$user_credits = \AKSRT\Credits\Credits::balance($uid);
}
$user_credits = \AKSRT\Ledger\LedgerService::get_instance()->balance($uid, \AKSRT\Ledger\AssetType::POINTS);
$dl_meta = get_user_meta($uid, '_aksrt_downloaded_resources', true);
$user_download_count = is_array($dl_meta) ? count($dl_meta) : 0;
}
+8 -7
View File
@@ -4,7 +4,7 @@
* Template Post Type: page
*
* 独立消息中心页面 — 两栏布局(左侧导航 + 右侧消息列表)
* 对齐 legacy msg-center:未读 / 评论 / 系统
* 展示未读、评论、资产、交易与系统通知。
*
* @package AKSRT
*/
@@ -47,12 +47,12 @@ $all_notifications = function_exists('aksrt_get_user_all_notifications')
$current_type = isset($_GET['msg_type']) ? sanitize_key(wp_unslash((string) $_GET['msg_type'])) : 'unread';
// 类型分组:对齐 legacy 主 tab 语义,同时兼容历史 type 键。
// 通知类型分组。
$type_groups = [
'unread' => null, // special: !read
'all' => null, // special: all
'comment' => ['comment_reply', 'comment_approved', 'pending_comments'],
'credits' => ['credits_added', 'credits_deducted'],
'credits' => ['asset_points_increase', 'asset_points_decrease', 'asset_balance_increase', 'asset_balance_decrease'],
'pay' => ['pay', 'order_paid', 'order_refund', 'shop_order', 'after_sale'],
'vip' => ['vip', 'pay_vip', 'vip_expire', 'vip_upgrade'],
'medal' => ['medal', 'badge', 'level_up'],
@@ -62,7 +62,6 @@ $type_groups = [
$allowed_types = array_keys($type_groups);
if (!in_array($current_type, $allowed_types, true)) {
// 兼容旧 URL:msg_type=comment_reply 等
$mapped = 'all';
foreach ($type_groups as $group => $types) {
if (is_array($types) && in_array($current_type, $types, true)) {
@@ -120,7 +119,7 @@ $nav_items = [
'unread' => __('未读消息', 'aksrt'),
'all' => __('全部消息', 'aksrt'),
'comment' => __('评论互动', 'aksrt'),
'credits' => __('积分动态', 'aksrt'),
'credits' => __('资产动态', 'aksrt'),
'pay' => __('交易通知', 'aksrt'),
'vip' => __('会员动态', 'aksrt'),
'medal' => __('徽章等级', 'aksrt'),
@@ -131,8 +130,10 @@ $nav_items = [
$icon_map = [
'comment_reply' => 'fa fas fa-comment-dots',
'comment_approved' => 'fa fas fa-check-circle',
'credits_added' => 'fa fas fa-money-bill',
'credits_deducted' => 'fa fas fa-money-bill',
'asset_points_increase' => 'fa fas fa-coins',
'asset_points_decrease' => 'fa fas fa-coins',
'asset_balance_increase' => 'fa fas fa-wallet',
'asset_balance_decrease' => 'fa fas fa-wallet',
'download_ready' => 'fa fas fa-download',
'upload_moderation' => 'fa fas fa-image',
'verify_email' => 'fa fas fa-envelope-open',