fix(frontend): 统一计数缩写口径并将流水号改为订单号
前台各处评论、浏览、点赞、收藏、已售数量统一走 aksrt_format_number() 缩写(≥10000 → 1.2W+,≥1000 → 1.5K), 缩写后缀统一为大写 K,与既有 W+ 保持一致。PHP 渲染缩写文本的 同时保留 data-base-count 原始整数,JS 增量计算不受影响; article.js / comment-ajax.js 内的 formatStatCount / formatCount 与 PHP 规则保持同一套,避免点赞收藏后文本回跳成全量数字。 文章详情页购买信息卡、用户中心创作者收益明细、后台分成与提现 管理页、支付设置页以及四封订单/提现邮件模板中,面向用户展示的 「流水号」字样统一改为「订单号」;代码注释、内部错误码与 WP_Error 文案保留原表述。 验证:node --test "tests/*/*.test.cjs" 508 项全部通过; php -l 检查全部改动文件无语法错误;重新构建 admin SPA 与 前台 runtime bundle。
This commit is contained in:
1 parent
fe57022550
commit
2595bb02db
23 files changed
+136
-37
No files matched your search
+1
-1
@@ -489,7 +489,7 @@ add_action('manage_post_posts_custom_column', function ($column, $post_id) {
|
||||
|
||||
$format = function (int $n): string {
|
||||
if ($n >= 10000) return round($n / 10000, 1) . '万';
|
||||
if ($n >= 1000) return round($n / 1000, 1) . 'k';
|
||||
if ($n >= 1000) return round($n / 1000, 1) . 'K';
|
||||
return (string) $n;
|
||||
};
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ if (! function_exists('aksrt_format_number')) :
|
||||
if ($num >= 10000) {
|
||||
return round($num / 10000, 1) . 'W+';
|
||||
} elseif ($num >= 1000) {
|
||||
return round($num / 1000, 1) . 'k';
|
||||
return round($num / 1000, 1) . 'K';
|
||||
}
|
||||
return (string) number_format_i18n($num);
|
||||
}
|
||||
|
||||
@@ -1379,7 +1379,8 @@ if (!function_exists('aksrt_get_paywall_html')) {
|
||||
$price = aksrt_get_show_pay_price_html($meta, $priced);
|
||||
$vip = aksrt_get_posts_vip_price($meta);
|
||||
$attrs = aksrt_get_pay_attributes_html($post, 'pay-attr');
|
||||
$count = $sales > 0 ? '<badge class="img-badge hot jb-blue px12">' . esc_html(sprintf(__('已售 %s', 'aksrt'), $sales)) . '</badge>' : '';
|
||||
$sales_label = function_exists('aksrt_format_number') ? aksrt_format_number($sales) : number_format_i18n($sales);
|
||||
$count = $sales > 0 ? '<badge class="img-badge hot jb-blue px12">' . esc_html(sprintf(__('已售 %s', 'aksrt'), $sales_label)) . '</badge>' : '';
|
||||
$service = aksrt_get_pay_service_html('muted-2-color');
|
||||
$widget_service = $service !== '' ? '<div class="px12 muted-2-color">' . $service . '</div>' : '';
|
||||
$article_service = $service !== '' ? '<div class="px12 muted-2-color mt10 text-right">' . $service . '</div>' : '';
|
||||
@@ -1538,7 +1539,8 @@ if (!function_exists('aksrt_get_paid_box_html')) {
|
||||
$title = get_the_title($post);
|
||||
$sales = max(0, (int) ($meta['virtual_sales'] ?? 0));
|
||||
$sales += max(0, (int) get_post_meta($post->ID, \AKSRT\Core\DomainModel::RESOURCE_SALES_VOLUME_KEY, true));
|
||||
$count = $sales > 0 ? '<badge class="img-badge hot jb-blue px12">' . esc_html(sprintf(__('已售 %s', 'aksrt'), $sales)) . '</badge>' : '';
|
||||
$sales_label = function_exists('aksrt_format_number') ? aksrt_format_number($sales) : number_format_i18n($sales);
|
||||
$count = $sales > 0 ? '<badge class="img-badge hot jb-blue px12">' . esc_html(sprintf(__('已售 %s', 'aksrt'), $sales_label)) . '</badge>' : '';
|
||||
$order = aksrt_get_current_content_paid_order($post);
|
||||
$priced = aksrt_get_user_pay_price($post);
|
||||
$vip_level = max(0, min(2, (int) ($priced['vip_level'] ?? 0)));
|
||||
@@ -1561,7 +1563,7 @@ if (!function_exists('aksrt_get_paid_box_html')) {
|
||||
}
|
||||
$amount_text = $cash_symbol . aksrt_format_price($order_amount);
|
||||
}
|
||||
$paid_info = '<div class="flex jsb"><span>' . esc_html__('流水号', 'aksrt') . '</span><span>' . esc_html($order_number) . '</span></div>';
|
||||
$paid_info = '<div class="flex jsb"><span>' . esc_html__('订单号', 'aksrt') . '</span><span>' . esc_html($order_number) . '</span></div>';
|
||||
if ($paid_at !== '') {
|
||||
$paid_info .= '<div class="flex jsb"><span>' . esc_html__('支付时间', 'aksrt') . '</span><span>' . esc_html($paid_at) . '</span></div>';
|
||||
}
|
||||
|
||||
@@ -73,8 +73,9 @@ if (!function_exists('aksrt_get_posts_meta_items_html')) :
|
||||
? 'javascript:(typeof scrollTopTo===\'function\'?scrollTopTo(\'#comments\'):void(0));'
|
||||
: get_comments_link($post_id);
|
||||
$count = (int) get_comments_number($post_id);
|
||||
$count_label = function_exists('aksrt_format_number') ? aksrt_format_number($count) : number_format_i18n($count);
|
||||
$html .= '<span class="item meta-comm"><a rel="nofollow" href="' . esc_attr($href) . '" title="' . esc_attr__('去评论', 'aksrt') . '">'
|
||||
. '<i class="fa fas fa-comment" aria-hidden="true"></i> ' . esc_html((string) $count) . '</a></span>';
|
||||
. '<i class="fa fas fa-comment" aria-hidden="true"></i> ' . esc_html((string) $count_label) . '</a></span>';
|
||||
}
|
||||
|
||||
$views = function_exists('aksrt_get_post_views') ? (int) aksrt_get_post_views($post_id) : 0;
|
||||
@@ -88,7 +89,8 @@ if (!function_exists('aksrt_get_posts_meta_items_html')) :
|
||||
}
|
||||
if ($like_on && $post->post_type === 'post') {
|
||||
$likes = function_exists('aksrt_get_post_likes') ? (int) aksrt_get_post_likes($post_id) : 0;
|
||||
$html .= '<span class="item meta-like"><i class="fa fas fa-heart" aria-hidden="true"></i> ' . esc_html((string) $likes) . '</span>';
|
||||
$likes_label = function_exists('aksrt_format_number') ? aksrt_format_number($likes) : number_format_i18n($likes);
|
||||
$html .= '<span class="item meta-like"><i class="fa fas fa-heart" aria-hidden="true"></i> ' . esc_html((string) $likes_label) . '</span>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
@@ -197,10 +197,11 @@ if (!function_exists('aksrt_single_render_actions')) :
|
||||
<div class="text-center post-actions">
|
||||
<?php
|
||||
$like_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-like') : '';
|
||||
$like_label = function_exists('aksrt_format_number') ? aksrt_format_number($like_count) : number_format_i18n($like_count);
|
||||
if (!empty($settings['like_enabled'])) : ?>
|
||||
<button type="button" class="action action-like<?php echo $is_liked ? ' actived' : ''; ?>" id="action-like" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_liked ? '1' : '0'; ?>">
|
||||
<?php echo $like_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
|
||||
<text><?php esc_html_e('点赞', 'aksrt'); ?></text><count data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></count>
|
||||
<text><?php esc_html_e('点赞', 'aksrt'); ?></text><count data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_label); ?></count>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -221,10 +222,11 @@ if (!function_exists('aksrt_single_render_actions')) :
|
||||
|
||||
<?php
|
||||
$favorite_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-favorite') : '';
|
||||
$favorite_label = function_exists('aksrt_format_number') ? aksrt_format_number($favorite_count) : number_format_i18n($favorite_count);
|
||||
if (!empty($settings['favorite_enabled'])) : ?>
|
||||
<button type="button" class="action action-favorite<?php echo $is_favorited ? ' actived' : ''; ?>" id="action-favorite" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_favorited ? '1' : '0'; ?>">
|
||||
<?php echo $favorite_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
|
||||
<text><?php esc_html_e('收藏', 'aksrt'); ?></text><count data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></count>
|
||||
<text><?php esc_html_e('收藏', 'aksrt'); ?></text><count data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_label); ?></count>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
@@ -27,6 +27,7 @@ if (!function_exists('aksrt_get_comment_like_html')) :
|
||||
return '';
|
||||
}
|
||||
$like_count = function_exists('aksrt_get_comment_likes') ? (int) aksrt_get_comment_likes($comment_id) : 0;
|
||||
$like_label = function_exists('aksrt_format_number') ? aksrt_format_number($like_count) : number_format_i18n($like_count);
|
||||
$is_liked = function_exists('aksrt_is_comment_liked') && aksrt_is_comment_liked($comment_id);
|
||||
$classes = 'action action-comment-like muted-2-color flex0 ml10' . ($is_liked ? ' actived' : '');
|
||||
$icon = function_exists('aksrt_get_comment_icon') ? aksrt_get_comment_icon('like', 'icon mr3') : '';
|
||||
@@ -38,7 +39,7 @@ if (!function_exists('aksrt_get_comment_like_html')) :
|
||||
$is_liked ? '1' : '0',
|
||||
$is_liked ? 'true' : 'false',
|
||||
$icon, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup.
|
||||
esc_html((string) $like_count)
|
||||
esc_html((string) $like_label)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -264,7 +264,7 @@ if (!function_exists('aksrt_renderer_meta')) {
|
||||
|
||||
$right = '';
|
||||
if (!empty($data['comments_open']) && empty($cfg['close_comments'])) {
|
||||
$right .= '<item class="meta-comm"><a rel="nofollow" data-toggle="tooltip" title="' . esc_attr__('去评论', 'aksrt') . '" href="' . esc_url((string) $data['comments_link']) . '">' . aksrt_renderer_svg_icon('comment') . esc_html((string) $data['comments']) . '</a></item>';
|
||||
$right .= '<item class="meta-comm"><a rel="nofollow" data-toggle="tooltip" title="' . esc_attr__('去评论', 'aksrt') . '" href="' . esc_url((string) $data['comments_link']) . '">' . aksrt_renderer_svg_icon('comment') . esc_html(aksrt_renderer_meta_number((int) $data['comments'])) . '</a></item>';
|
||||
}
|
||||
$right .= '<item class="meta-view">' . aksrt_renderer_svg_icon('view') . esc_html(aksrt_renderer_meta_number((int) $data['views'])) . '</item>';
|
||||
if (!empty($cfg['show_like']) && (string) ($data['post_type'] ?? '') === 'post') {
|
||||
|
||||
@@ -422,6 +422,9 @@ if (!function_exists('aksrt_render_footer_tabbar_single_extend')) :
|
||||
$is_liked = function_exists('aksrt_is_post_liked') ? aksrt_is_post_liked($post_id) : false;
|
||||
$is_favorited = function_exists('aksrt_is_post_favorited') ? aksrt_is_post_favorited($post_id) : false;
|
||||
$comment_count = (int) get_comments_number($post_id);
|
||||
$like_label = function_exists('aksrt_format_number') ? aksrt_format_number($like_count) : number_format_i18n($like_count);
|
||||
$favorite_label = function_exists('aksrt_format_number') ? aksrt_format_number($favorite_count) : number_format_i18n($favorite_count);
|
||||
$comment_label = function_exists('aksrt_format_number') ? aksrt_format_number($comment_count) : number_format_i18n($comment_count);
|
||||
|
||||
if ($like_on) :
|
||||
$like_tabbar_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-like') : '';
|
||||
@@ -433,7 +436,7 @@ if (!function_exists('aksrt_render_footer_tabbar_single_extend')) :
|
||||
data-initial-active="<?php echo $is_liked ? '1' : '0'; ?>"
|
||||
aria-label="<?php esc_attr_e('点赞', 'aksrt'); ?>">
|
||||
<?php echo $like_tabbar_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
|
||||
<?php if ($show_text) : ?><count data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></count><?php endif; ?>
|
||||
<?php if ($show_text) : ?><count data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_label); ?></count><?php endif; ?>
|
||||
</button>
|
||||
<?php
|
||||
endif;
|
||||
@@ -448,7 +451,7 @@ if (!function_exists('aksrt_render_footer_tabbar_single_extend')) :
|
||||
data-initial-active="<?php echo $is_favorited ? '1' : '0'; ?>"
|
||||
aria-label="<?php esc_attr_e('收藏', 'aksrt'); ?>">
|
||||
<?php echo $favorite_tabbar_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
|
||||
<?php if ($show_text) : ?><count data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></count><?php endif; ?>
|
||||
<?php if ($show_text) : ?><count data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_label); ?></count><?php endif; ?>
|
||||
</button>
|
||||
<?php
|
||||
endif;
|
||||
@@ -464,7 +467,7 @@ if (!function_exists('aksrt_render_footer_tabbar_single_extend')) :
|
||||
data-type="comment"
|
||||
aria-label="<?php esc_attr_e('评论', 'aksrt'); ?>">
|
||||
<i class="fa fas fa-comment" aria-hidden="true"></i>
|
||||
<?php if ($show_text) : ?><span><?php echo esc_html((string) $comment_count); ?></span><?php endif; ?>
|
||||
<?php if ($show_text) : ?><span><?php echo esc_html((string) $comment_label); ?></span><?php endif; ?>
|
||||
</a>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
@@ -102,7 +102,7 @@ $currency_labels = [
|
||||
$status = (string) ($item['status'] ?? '') === 'pending' ? 'pending' : 'settled';
|
||||
$amount = $format($item['amount'] ?? 0, $unit);
|
||||
$order_number = trim((string) ($item['order_number'] ?? ''));
|
||||
$order_number = $order_number !== '' ? $order_number : __('流水号未知', 'aksrt');
|
||||
$order_number = $order_number !== '' ? $order_number : __('订单号未知', 'aksrt');
|
||||
$post = get_post((int) ($item['post_id'] ?? 0));
|
||||
$source = $post instanceof WP_Post && $post->post_type === 'post'
|
||||
? get_the_title($post)
|
||||
|
||||
Reference in new issue
Block a user