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.
96 lines
3.4 KiB
PHP
96 lines
3.4 KiB
PHP
<?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; ?>
|