fix(user): close level parity gaps

This commit is contained in:
2026-07-30 10:21:48 +08:00
parent a57b44bd61
commit d4946ee554
8 changed files with 136 additions and 38 deletions
@@ -72,6 +72,30 @@ $day_max = \AKSRT\User\Level::day_max();
</div>
</section>
<section class="uc-level-section zib-widget">
<div class="uc-level-section__head"><h3><?php esc_html_e('获取经验值', 'aksrt'); ?></h3><span><?php esc_html_e('完成互动即可成长', 'aksrt'); ?></span></div>
<div class="uc-level-methods">
<?php
$methods = \AKSRT\User\Level::integral_defaults();
$methods['checkin'] = 0;
$methods['invitation'] = 0;
$methods['shop_gift'] = 0;
$invite_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_invite_reward_settings() : [];
$methods['invitation'] = max(0, (int) ($invite_settings['invit_reward_level'] ?? 0));
foreach ($methods as $key => $default_value) :
if ($key === 'day_max') continue;
$value = in_array($key, ['checkin', 'shop_gift'], true) ? 0 : ($key === 'invitation' ? (int) $default_value : \AKSRT\User\Level::task_points($key));
if ($value <= 0 && !in_array($key, ['checkin', 'shop_gift'], true)) continue;
?>
<div class="uc-level-methods__item">
<span><i class="fas fa-bolt" aria-hidden="true"></i></span>
<div><strong><?php echo esc_html($labels[$key] ?? $key); ?></strong><small><?php echo in_array($key, ['checkin', 'shop_gift'], true) ? esc_html__('按活动或商品配置发放', 'aksrt') : esc_html__('完成后自动计入经验', 'aksrt'); ?></small></div>
<b><?php echo $value > 0 ? '+' . esc_html((string) $value) : esc_html__('动态', 'aksrt'); ?></b>
</div>
<?php endforeach; ?>
</div>
</section>
<div class="uc-level-history-grid">
<section class="uc-level-section zib-widget">
<div class="uc-level-section__head"><h3><?php esc_html_e('经验明细', 'aksrt'); ?></h3><span><?php esc_html_e('最近 50 条', 'aksrt'); ?></span></div>
@@ -83,7 +107,7 @@ $day_max = \AKSRT\User\Level::day_max();
?>
<div class="uc-level-ledger__row">
<span class="uc-level-ledger__icon"><i class="fas fa-chart-line" aria-hidden="true"></i></span>
<div><strong><?php echo esc_html($labels[$key] ?? $key); ?></strong><time><?php echo esc_html((string) ($row['time'] ?? '')); ?></time></div>
<div><strong><?php echo esc_html($labels[$key] ?? $key); ?></strong><time><?php echo esc_html((string) ($row['time'] ?? '')); ?></time><small><?php printf(esc_html__('累计:%d', 'aksrt'), max(0, (int) ($row['integral'] ?? 0))); ?></small></div>
<b>+<?php echo esc_html((string) $value); ?></b>
</div>
<?php endforeach; ?>