feat(credits): free points tasks matrix, day cap, and tasks tab
Add AKSRT_Points_Free for catalog/day-max/daily detail, wire the full earn matrix (login, post, like, favorite, follow, comment, forum), expose 积分任务 + 每日详情 tabs, and expand admin free-task settings.
This commit is contained in:
1 parent
4da003663d
commit
15a883eb54
13 files changed
+728
-232
No files matched your search
@@ -50,6 +50,7 @@ $currency = (string) ($currency_name ?? __('积分', 'aksrt'));
|
||||
</div>
|
||||
</div>
|
||||
<p class="uc-balance-card__tip muted-2-color em09" data-signin-tip></p>
|
||||
<button type="button" class="uc-asset-card__link muted-2-color em09" data-aksrt-asset-tab="points_free"><?php esc_html_e('做任务赚积分', 'aksrt'); ?><i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i></button>
|
||||
</div>
|
||||
|
||||
<?php if ($points_buy_on) :
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Free points tasks list + daily free detail (Zibll points free tab).
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!class_exists('AKSRT_Points_Free') || !AKSRT_Points_Free::enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user_id = (int) ($user_id ?? get_current_user_id());
|
||||
$today = AKSRT_Points_Free::today_total($user_id);
|
||||
$day_max = (int) AKSRT_Points_Free::settings()['day_max'];
|
||||
$tasks = AKSRT_Points_Free::task_list_for_user($user_id);
|
||||
$detail = AKSRT_Points_Free::date_detail($user_id);
|
||||
$pane = isset($points_tasks_pane) ? sanitize_key((string) $points_tasks_pane) : 'tasks';
|
||||
?>
|
||||
|
||||
<?php if ($pane === 'date') : ?>
|
||||
<div class="uc-points-date">
|
||||
<div class="flex jsb ac mb10">
|
||||
<div class="font-bold"><?php esc_html_e('每日免费积分明细', 'aksrt'); ?></div>
|
||||
<button type="button" class="muted-2-color" data-aksrt-asset-tab="points_free">
|
||||
<?php esc_html_e('返回任务', 'aksrt'); ?><i class="fa fa-angle-right ml6 em12" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
<?php if ($detail) : ?>
|
||||
<?php foreach ($detail as $day => $val) : ?>
|
||||
<div class="border-bottom padding-h6 flex jsb ac">
|
||||
<div class="em12"><?php echo esc_html((string) $day); ?></div>
|
||||
<div class="text-right shrink0 focus-color em14 font-bold">+ <?php echo esc_html((string) (int) $val); ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<div class="uc-transactions__empty"><p><?php esc_html_e('暂无免费积分获取明细', 'aksrt'); ?></p></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="uc-points-tasks">
|
||||
<?php if ($today > 0 || $day_max > 0) : ?>
|
||||
<div class="border-bottom padding-h10">
|
||||
<div class="flex jsb ac">
|
||||
<div class="flex1 mr20">
|
||||
<div class="font-bold mb6">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: points */
|
||||
esc_html__('今日累计 %s', 'aksrt'),
|
||||
'<span class="focus-color">+' . esc_html((string) $today) . '</span>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<div class="muted-2-color em09">
|
||||
<?php
|
||||
if ($day_max > 0) {
|
||||
if ($today >= $day_max) {
|
||||
printf(esc_html__('今日获取的免费积分已达到 %s,将不再获取', 'aksrt'), esc_html((string) $day_max));
|
||||
} else {
|
||||
printf(esc_html__('每日可免费获取 %s 积分,超过后将不再获取', 'aksrt'), esc_html((string) $day_max));
|
||||
}
|
||||
} else {
|
||||
esc_html_e('免费积分无每日上限', 'aksrt');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="muted-2-color shrink0" data-aksrt-asset-tab="points_date">
|
||||
<?php esc_html_e('每日详情', 'aksrt'); ?><i class="fa fa-angle-right ml6 em12" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($tasks) : ?>
|
||||
<?php foreach ($tasks as $task) : ?>
|
||||
<div class="border-bottom padding-h10">
|
||||
<div class="flex jsb ac">
|
||||
<div class="flex1 mr20">
|
||||
<div class="font-bold mb6"><?php echo esc_html((string) $task['title']); ?></div>
|
||||
<div class="muted-2-color em09"><?php echo esc_html((string) $task['desc']); ?></div>
|
||||
</div>
|
||||
<span class="focus-color em14 shrink0">
|
||||
<i class="fas fa-coins mr6 em09" aria-hidden="true"></i>+ <?php echo esc_html((string) (int) $task['points']); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<div class="uc-transactions__empty"><p><?php esc_html_e('暂无可用积分任务', 'aksrt'); ?></p></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -48,9 +48,10 @@ if ($show_credits) {
|
||||
// Tabbed ledgers (Zibll record tabs).
|
||||
if ($show_wallet || $show_credits) :
|
||||
$active_record = isset($_GET['asset_tab']) ? sanitize_key(wp_unslash($_GET['asset_tab'])) : '';
|
||||
if ($active_record === '' || !in_array($active_record, ['balance', 'points'], true)) {
|
||||
if ($active_record === '' || !in_array($active_record, ['balance', 'points', 'points_free', 'points_date'], true)) {
|
||||
$active_record = $show_wallet ? 'balance' : 'points';
|
||||
}
|
||||
$show_tasks = $show_credits && class_exists('AKSRT_Points_Free') && AKSRT_Points_Free::enabled();
|
||||
?>
|
||||
<div class="uc-asset-tabs zib-widget">
|
||||
<ul class="uc-asset-tabs__nav list-inline tab-nav-theme font-bold">
|
||||
@@ -64,6 +65,11 @@ if ($show_wallet || $show_credits) :
|
||||
<a href="#record_tab_points" data-aksrt-asset-tab="points"><?php esc_html_e('积分记录', 'aksrt'); ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($show_tasks)) : ?>
|
||||
<li class="<?php echo in_array($active_record, ['points_free', 'points_date'], true) ? 'active' : ''; ?>">
|
||||
<a href="#record_tab_points_free" data-aksrt-asset-tab="points_free"><?php esc_html_e('积分任务', 'aksrt'); ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<div class="uc-asset-tabs__content tab-content">
|
||||
<?php if ($show_wallet) : ?>
|
||||
@@ -100,6 +106,10 @@ if ($show_wallet || $show_credits) :
|
||||
</div>
|
||||
<div class="uc-transactions__amount">
|
||||
<span class="uc-transactions__delta <?php echo esc_attr($delta_class); ?>"><?php echo esc_html($delta_txt); ?></span>
|
||||
<span class="uc-transactions__balance"><?php printf(esc_html__('余额 %s', 'aksrt'), esc_html(class_exists('AKSRT_Balance') ? AKSRT_Balance::format((float) ($row['balance_after'] ?? 0)) : number_format_i18n((float) ($row['balance_after'] ?? 0), 2))); ?></span>
|
||||
<?php if (!empty($row['ref_id'])) : ?>
|
||||
<span class="uc-transactions__ref muted-2-color em09"><?php printf(esc_html__('单号 %s', 'aksrt'), esc_html((string) $row['ref_id'])); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
@@ -123,6 +133,14 @@ if ($show_wallet || $show_credits) :
|
||||
<?php require $dir . '/credits-transactions.php'; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($show_tasks)) : ?>
|
||||
<div class="tab-pane<?php echo $active_record === 'points_free' ? ' is-active' : ''; ?>" id="record_tab_points_free" data-aksrt-asset-pane="points_free"<?php echo $active_record === 'points_free' ? '' : ' hidden'; ?>>
|
||||
<?php $points_tasks_pane = 'tasks'; require $dir . '/credits-points-tasks.php'; ?>
|
||||
</div>
|
||||
<div class="tab-pane<?php echo $active_record === 'points_date' ? ' is-active' : ''; ?>" id="tab_points_date" data-aksrt-asset-pane="points_date"<?php echo $active_record === 'points_date' ? '' : ' hidden'; ?>>
|
||||
<?php $points_tasks_pane = 'date'; require $dir . '/credits-points-tasks.php'; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
Reference in new issue
Block a user