feat(assets): forum free-task depth, withdraw notices, share poster
Route forum essence/adopt/hot/score rewards through free-points day cap, notify users on withdraw complete/reject, surface 海报分享 on single share grid, and extend admin free-task keys for the remaining matrix.
This commit is contained in:
1 parent
c3eee3fa7e
commit
b1731f7a8d
11 files changed
+165
-55
No files matched your search
@@ -312,17 +312,27 @@ class AKSRT_Forum_Comment_Service {
|
||||
update_post_meta($topic_id, '_aksrt_question_status', 1); // QUESTION_SOLVED
|
||||
|
||||
$adoptee_id = (int) $comment->user_id;
|
||||
if ($adoptee_id > 0 && class_exists('AKSRT_Credits')) {
|
||||
if ($adoptee_id > 0) {
|
||||
$config = $this->forum->get_config();
|
||||
$amount = (int) ($config['credits']['adopted'] ?? 20);
|
||||
if ($amount > 0) {
|
||||
$already = get_comment_meta($comment_id, '_aksrt_adopt_credited', true);
|
||||
if (!$already) {
|
||||
\AKSRT_Credits::add($adoptee_id, $amount, 'forum_adopted', [
|
||||
'type' => 'comment',
|
||||
'id' => $comment_id,
|
||||
]);
|
||||
update_comment_meta($comment_id, '_aksrt_adopt_credited', '1');
|
||||
if (class_exists('AKSRT_Points_Free')) {
|
||||
$granted = \AKSRT_Points_Free::grant($adoptee_id, 'bbs_adopt', $amount, [
|
||||
'type' => 'comment',
|
||||
'id' => $comment_id,
|
||||
]);
|
||||
if (!is_wp_error($granted) && (int) $granted > 0) {
|
||||
update_comment_meta($comment_id, '_aksrt_adopt_credited', '1');
|
||||
}
|
||||
} elseif (class_exists('AKSRT_Credits')) {
|
||||
\AKSRT_Credits::add($adoptee_id, $amount, 'forum_adopted', [
|
||||
'type' => 'comment',
|
||||
'id' => $comment_id,
|
||||
]);
|
||||
update_comment_meta($comment_id, '_aksrt_adopt_credited', '1');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,15 +508,22 @@ class AKSRT_Forum_Comment_Service {
|
||||
|
||||
update_comment_meta($comment_id, '_aksrt_is_hot', '1');
|
||||
|
||||
// Credit the comment author
|
||||
// Credit the comment author (free-task day cap).
|
||||
$author_id = (int) $comment->user_id;
|
||||
if ($author_id > 0 && class_exists('AKSRT_Credits')) {
|
||||
$amount = (int) ($config['credits']['comment_like'] ?? 1);
|
||||
if ($author_id > 0) {
|
||||
$amount = (int) ($config['credits']['comment_hot'] ?? $config['credits']['comment_like'] ?? 5);
|
||||
if ($amount > 0) {
|
||||
\AKSRT_Credits::add($author_id, $amount, 'forum_hot_comment', [
|
||||
'type' => 'comment',
|
||||
'id' => $comment_id,
|
||||
]);
|
||||
if (class_exists('AKSRT_Points_Free')) {
|
||||
\AKSRT_Points_Free::grant($author_id, 'bbs_comment_hot', $amount, [
|
||||
'type' => 'comment',
|
||||
'id' => $comment_id,
|
||||
]);
|
||||
} elseif (class_exists('AKSRT_Credits')) {
|
||||
\AKSRT_Credits::add($author_id, $amount, 'forum_hot_comment', [
|
||||
'type' => 'comment',
|
||||
'id' => $comment_id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,16 +126,23 @@ class AKSRT_Forum_Score_Service {
|
||||
$reputation += $amount;
|
||||
update_user_meta($author_id, 'aksrt_reputation', $reputation);
|
||||
|
||||
if ($amount > 0 && class_exists('AKSRT_Credits')) {
|
||||
if ($amount > 0) {
|
||||
$credits_amount = (int) ($config['credits']['score_extra'] ?? 3);
|
||||
if ($credits_amount > 0) {
|
||||
$daily = $this->today_credits_count($author_id, 'forum_score_extra');
|
||||
$daily_max = (int) ($config['credits']['daily_max'] ?? 50);
|
||||
if ($daily < $daily_max) {
|
||||
AKSRT_Credits::add($author_id, $credits_amount, 'forum_score_extra', sprintf(
|
||||
__('帖子「%s」被加分', 'aksrt'),
|
||||
get_the_title($topic_id)
|
||||
));
|
||||
if (class_exists('AKSRT_Points_Free')) {
|
||||
AKSRT_Points_Free::grant($author_id, 'bbs_score_extra', $credits_amount, [
|
||||
'type' => 'post',
|
||||
'id' => $topic_id,
|
||||
]);
|
||||
} elseif (class_exists('AKSRT_Credits')) {
|
||||
$daily = $this->today_credits_count($author_id, 'forum_score_extra');
|
||||
$daily_max = (int) ($config['credits']['daily_max'] ?? 50);
|
||||
if ($daily < $daily_max) {
|
||||
AKSRT_Credits::add($author_id, $credits_amount, 'forum_score_extra', sprintf(
|
||||
__('帖子「%s」被加分', 'aksrt'),
|
||||
get_the_title($topic_id)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,10 +239,17 @@ class AKSRT_Forum_Score_Service {
|
||||
update_post_meta($topic_id, '_aksrt_hot_rewarded', '1');
|
||||
$config = $this->forum->get_config();
|
||||
$amount = (int) ($config['credits']['posts_hot'] ?? 5);
|
||||
if ($amount > 0 && class_exists('AKSRT_Credits')) {
|
||||
AKSRT_Credits::add($author_id, $amount, 'forum_hot_topic', [
|
||||
'type' => 'post', 'id' => $topic_id,
|
||||
]);
|
||||
if ($amount > 0) {
|
||||
if (class_exists('AKSRT_Points_Free')) {
|
||||
AKSRT_Points_Free::grant($author_id, 'bbs_posts_hot', $amount, [
|
||||
'type' => 'post',
|
||||
'id' => $topic_id,
|
||||
]);
|
||||
} elseif (class_exists('AKSRT_Credits')) {
|
||||
AKSRT_Credits::add($author_id, $amount, 'forum_hot_topic', [
|
||||
'type' => 'post', 'id' => $topic_id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
$this->notify($author_id, 'hot', sprintf(
|
||||
__('你的帖子「%s」成为热帖!', 'aksrt'), get_the_title($topic_id)
|
||||
|
||||
@@ -245,22 +245,32 @@ trait AKSRT_Forum_Topic_Service_Part_1 {
|
||||
return;
|
||||
}
|
||||
|
||||
// 积分奖励(§7.7):读 `credits.essence`,带每日上限。
|
||||
if (class_exists('AKSRT_Credits') && class_exists('AKSRT_Settings')) {
|
||||
// 积分奖励(§7.7):统一走免费积分日上限。
|
||||
if (class_exists('AKSRT_Settings')) {
|
||||
$cfg = AKSRT_Settings::get_forum_settings();
|
||||
$amount = (int) ($cfg['credits']['essence'] ?? 0);
|
||||
if ($amount > 0) {
|
||||
$daily_max = (int) ($cfg['credits']['daily_max'] ?? 50);
|
||||
if ($daily_max > 0 && $this->today_credits_count($author_id, 'forum_essence') >= $daily_max) {
|
||||
$amount = 0;
|
||||
}
|
||||
|
||||
if ($amount > 0) {
|
||||
AKSRT_Credits::add($author_id, $amount, 'forum_essence', [
|
||||
$granted = 0;
|
||||
if (class_exists('AKSRT_Points_Free')) {
|
||||
$result = AKSRT_Points_Free::grant($author_id, 'bbs_essence', $amount, [
|
||||
'type' => 'post',
|
||||
'id' => $topic_id,
|
||||
], __('主题被设为精华', 'aksrt'));
|
||||
|
||||
'id' => $topic_id,
|
||||
]);
|
||||
$granted = is_wp_error($result) ? 0 : (int) $result;
|
||||
} elseif (class_exists('AKSRT_Credits')) {
|
||||
$daily_max = (int) ($cfg['credits']['daily_max'] ?? 50);
|
||||
if ($daily_max > 0 && $this->today_credits_count($author_id, 'forum_essence') >= $daily_max) {
|
||||
$amount = 0;
|
||||
}
|
||||
if ($amount > 0) {
|
||||
AKSRT_Credits::add($author_id, $amount, 'forum_essence', [
|
||||
'type' => 'post',
|
||||
'id' => $topic_id,
|
||||
], __('主题被设为精华', 'aksrt'));
|
||||
$granted = $amount;
|
||||
}
|
||||
}
|
||||
if ($granted > 0) {
|
||||
update_post_meta($topic_id, '_aksrt_essence_rewarded', '1');
|
||||
update_post_meta($topic_id, '_aksrt_essence_rewarded_at', current_time('mysql'));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user