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
@@ -22,6 +22,10 @@ export const creditsSchema = {
|
|||||||
points_free_bbs_posts_new: 5,
|
points_free_bbs_posts_new: 5,
|
||||||
points_free_bbs_reply: 2,
|
points_free_bbs_reply: 2,
|
||||||
points_free_bbs_essence: 10,
|
points_free_bbs_essence: 10,
|
||||||
|
points_free_bbs_adopt: 20,
|
||||||
|
points_free_bbs_posts_hot: 5,
|
||||||
|
points_free_bbs_comment_hot: 5,
|
||||||
|
points_free_bbs_score_extra: 3,
|
||||||
points_earn_invite: 10,
|
points_earn_invite: 10,
|
||||||
points_spend_comment: 0,
|
points_spend_comment: 0,
|
||||||
points_spend_download: 0,
|
points_spend_download: 0,
|
||||||
@@ -73,6 +77,10 @@ export const creditsSchema = {
|
|||||||
{ key: 'points_free_bbs_posts_new', label: '论坛发帖', type: 'number', default: 5, min: 0, max: 1000 },
|
{ key: 'points_free_bbs_posts_new', label: '论坛发帖', type: 'number', default: 5, min: 0, max: 1000 },
|
||||||
{ key: 'points_free_bbs_reply', label: '论坛回复', type: 'number', default: 2, min: 0, max: 1000 },
|
{ key: 'points_free_bbs_reply', label: '论坛回复', type: 'number', default: 2, min: 0, max: 1000 },
|
||||||
{ key: 'points_free_bbs_essence', label: '帖子加精', type: 'number', default: 10, min: 0, max: 1000 },
|
{ key: 'points_free_bbs_essence', label: '帖子加精', type: 'number', default: 10, min: 0, max: 1000 },
|
||||||
|
{ key: 'points_free_bbs_adopt', label: '回复被采纳', type: 'number', default: 20, min: 0, max: 1000 },
|
||||||
|
{ key: 'points_free_bbs_posts_hot', label: '热帖奖励', type: 'number', default: 5, min: 0, max: 1000 },
|
||||||
|
{ key: 'points_free_bbs_comment_hot', label: '神评奖励', type: 'number', default: 5, min: 0, max: 1000 },
|
||||||
|
{ key: 'points_free_bbs_score_extra', label: '帖子加分', type: 'number', default: 3, min: 0, max: 1000 },
|
||||||
{ key: 'points_earn_invite', label: '邀请注册奖励', type: 'number', default: 10, min: 0, max: 1000, help: '邀请不计入免费日上限' },
|
{ key: 'points_earn_invite', label: '邀请注册奖励', type: 'number', default: 10, min: 0, max: 1000, help: '邀请不计入免费日上限' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -278,6 +278,7 @@
|
|||||||
.share-item[data-platform="twitter"]:hover { background: #f0f0f0; color: #000; }
|
.share-item[data-platform="twitter"]:hover { background: #f0f0f0; color: #000; }
|
||||||
.share-item[data-platform="wechat"]:hover { background: #e6f7ec; color: #07c160; }
|
.share-item[data-platform="wechat"]:hover { background: #e6f7ec; color: #07c160; }
|
||||||
.share-item[data-platform="copy"]:hover { background: #f0f2f5; color: #555; }
|
.share-item[data-platform="copy"]:hover { background: #f0f2f5; color: #555; }
|
||||||
|
.share-item[data-platform="poster"]:hover { background: #fff4e8; color: #f59e0b; }
|
||||||
|
|
||||||
/* 微信二维码浮层 */
|
/* 微信二维码浮层 */
|
||||||
#share-qrcode-box {
|
#share-qrcode-box {
|
||||||
@@ -332,6 +333,7 @@ html.dark .share-item {
|
|||||||
.theme-dark .share-item[data-platform="twitter"]:hover { background: rgba(255,255,255,0.08); color: #fff; }
|
.theme-dark .share-item[data-platform="twitter"]:hover { background: rgba(255,255,255,0.08); color: #fff; }
|
||||||
.theme-dark .share-item[data-platform="wechat"]:hover { background: rgba(7,193,96,0.12); color: #07c160; }
|
.theme-dark .share-item[data-platform="wechat"]:hover { background: rgba(7,193,96,0.12); color: #07c160; }
|
||||||
.theme-dark .share-item[data-platform="copy"]:hover { background: rgba(255,255,255,0.06); color: #ccc; }
|
.theme-dark .share-item[data-platform="copy"]:hover { background: rgba(255,255,255,0.06); color: #ccc; }
|
||||||
|
.theme-dark .share-item[data-platform="poster"]:hover { background: rgba(245,158,11,0.12); color: #f59e0b; }
|
||||||
|
|
||||||
.theme-dark .post-drop-meta__menu,
|
.theme-dark .post-drop-meta__menu,
|
||||||
html.dark .post-drop-meta__menu {
|
html.dark .post-drop-meta__menu {
|
||||||
|
|||||||
@@ -428,6 +428,10 @@ class AKSRT_Admin_Schema_Users {
|
|||||||
['key' => 'points_free_bbs_posts_new', 'label' => '论坛发帖', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 1000],
|
['key' => 'points_free_bbs_posts_new', 'label' => '论坛发帖', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 1000],
|
||||||
['key' => 'points_free_bbs_reply', 'label' => '论坛回复', 'type' => 'number', 'default' => 2, 'min' => 0, 'max' => 1000],
|
['key' => 'points_free_bbs_reply', 'label' => '论坛回复', 'type' => 'number', 'default' => 2, 'min' => 0, 'max' => 1000],
|
||||||
['key' => 'points_free_bbs_essence', 'label' => '帖子加精', 'type' => 'number', 'default' => 10, 'min' => 0, 'max' => 1000],
|
['key' => 'points_free_bbs_essence', 'label' => '帖子加精', 'type' => 'number', 'default' => 10, 'min' => 0, 'max' => 1000],
|
||||||
|
['key' => 'points_free_bbs_adopt', 'label' => '回复被采纳', 'type' => 'number', 'default' => 20, 'min' => 0, 'max' => 1000],
|
||||||
|
['key' => 'points_free_bbs_posts_hot', 'label' => '热帖奖励', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 1000],
|
||||||
|
['key' => 'points_free_bbs_comment_hot', 'label' => '神评奖励', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 1000],
|
||||||
|
['key' => 'points_free_bbs_score_extra', 'label' => '帖子加分', 'type' => 'number', 'default' => 3, 'min' => 0, 'max' => 1000],
|
||||||
['key' => 'points_earn_invite', 'label' => '邀请注册奖励', 'type' => 'number', 'default' => 10, 'min' => 0, 'max' => 1000, 'help' => '邀请奖励不走免费日上限'],
|
['key' => 'points_earn_invite', 'label' => '邀请注册奖励', 'type' => 'number', 'default' => 10, 'min' => 0, 'max' => 1000, 'help' => '邀请奖励不走免费日上限'],
|
||||||
]],
|
]],
|
||||||
['key' => 'spend', 'title' => '积分消费', 'fields' => [
|
['key' => 'spend', 'title' => '积分消费', 'fields' => [
|
||||||
|
|||||||
@@ -234,22 +234,14 @@ class AKSRT_Credits_Earn {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function on_forum_topic_featured(int $topic_id, int $operator_id): void {
|
/**
|
||||||
unset($operator_id);
|
* Essence reward is owned by AKSRT_Forum::reward_essence() (free-day-cap).
|
||||||
$post = get_post($topic_id);
|
* Keep hook for external integrations only — do not double-grant.
|
||||||
if (!$post || $post->post_type !== 'aksrt_forum_topic') {
|
*
|
||||||
return;
|
* @param int $topic_id
|
||||||
}
|
* @param int $author_or_operator Author id from forum (2nd arg) or operator.
|
||||||
$user_id = (int) $post->post_author;
|
*/
|
||||||
if ($user_id <= 0 || !class_exists('AKSRT_Points_Free')) {
|
public function on_forum_topic_featured(int $topic_id, int $author_or_operator = 0): void {
|
||||||
return;
|
unset($topic_id, $author_or_operator);
|
||||||
}
|
|
||||||
if (get_post_meta($topic_id, 'aksrt_credit_essence_rewarded', true)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$granted = AKSRT_Points_Free::grant($user_id, 'bbs_essence', 0, ['type' => 'post', 'id' => $topic_id]);
|
|
||||||
if (!is_wp_error($granted) && $granted > 0) {
|
|
||||||
update_post_meta($topic_id, 'aksrt_credit_essence_rewarded', 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,10 @@ class AKSRT_Points_Free {
|
|||||||
'bbs_posts_new' => [__('论坛发帖', 'aksrt'), __('发布论坛主题', 'aksrt'), 5],
|
'bbs_posts_new' => [__('论坛发帖', 'aksrt'), __('发布论坛主题', 'aksrt'), 5],
|
||||||
'bbs_reply' => [__('论坛回复', 'aksrt'), __('回复论坛主题', 'aksrt'), 2],
|
'bbs_reply' => [__('论坛回复', 'aksrt'), __('回复论坛主题', 'aksrt'), 2],
|
||||||
'bbs_essence' => [__('帖子加精', 'aksrt'), __('主题被设为精华', 'aksrt'), 10],
|
'bbs_essence' => [__('帖子加精', 'aksrt'), __('主题被设为精华', 'aksrt'), 10],
|
||||||
|
'bbs_adopt' => [__('回复被采纳', 'aksrt'), __('问答帖回复被采纳', 'aksrt'), 20],
|
||||||
|
'bbs_posts_hot' => [__('热帖奖励', 'aksrt'), __('主题成为热帖', 'aksrt'), 5],
|
||||||
|
'bbs_comment_hot'=> [__('神评奖励', 'aksrt'), __('回复成为神评', 'aksrt'), 5],
|
||||||
|
'bbs_score_extra'=> [__('帖子加分', 'aksrt'), __('主题被加分时奖励', 'aksrt'), 3],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +280,36 @@ class AKSRT_Points_Free {
|
|||||||
return max(0, (int) ($f['credits']['comment_new'] ?? $default));
|
return max(0, (int) ($f['credits']['comment_new'] ?? $default));
|
||||||
}
|
}
|
||||||
return $default;
|
return $default;
|
||||||
|
case 'bbs_essence':
|
||||||
|
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_forum_settings')) {
|
||||||
|
$f = AKSRT_Settings::get_forum_settings();
|
||||||
|
return max(0, (int) ($f['credits']['essence'] ?? $default));
|
||||||
|
}
|
||||||
|
return $default;
|
||||||
|
case 'bbs_adopt':
|
||||||
|
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_forum_settings')) {
|
||||||
|
$f = AKSRT_Settings::get_forum_settings();
|
||||||
|
return max(0, (int) ($f['credits']['adopted'] ?? $default));
|
||||||
|
}
|
||||||
|
return $default;
|
||||||
|
case 'bbs_posts_hot':
|
||||||
|
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_forum_settings')) {
|
||||||
|
$f = AKSRT_Settings::get_forum_settings();
|
||||||
|
return max(0, (int) ($f['credits']['posts_hot'] ?? $default));
|
||||||
|
}
|
||||||
|
return $default;
|
||||||
|
case 'bbs_comment_hot':
|
||||||
|
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_forum_settings')) {
|
||||||
|
$f = AKSRT_Settings::get_forum_settings();
|
||||||
|
return max(0, (int) ($f['credits']['comment_hot'] ?? $f['credits']['comment_like'] ?? $default));
|
||||||
|
}
|
||||||
|
return $default;
|
||||||
|
case 'bbs_score_extra':
|
||||||
|
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_forum_settings')) {
|
||||||
|
$f = AKSRT_Settings::get_forum_settings();
|
||||||
|
return max(0, (int) ($f['credits']['score_extra'] ?? $default));
|
||||||
|
}
|
||||||
|
return $default;
|
||||||
default:
|
default:
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,31 @@ class AKSRT_Withdrawal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ok = $wpdb->update($this->table(), $update, ['id' => $withdrawal_id], $format, ['%d']) !== false;
|
$ok = $wpdb->update($this->table(), $update, ['id' => $withdrawal_id], $format, ['%d']) !== false;
|
||||||
return $ok ? true : new WP_Error('aksrt_withdraw_update', __('提现状态更新失败', 'aksrt'));
|
if (!$ok) {
|
||||||
|
return new WP_Error('aksrt_withdraw_update', __('提现状态更新失败', 'aksrt'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify user on terminal status (Zibll withdraw_reply parity).
|
||||||
|
if (class_exists('AKSRT_Message') && $user_id > 0 && in_array($new_status, [self::STATUS_COMPLETED, self::STATUS_REJECTED], true)) {
|
||||||
|
$gross = $this->resolve_gross_amount($row, $meta);
|
||||||
|
$amount_txt = class_exists('AKSRT_Balance') ? AKSRT_Balance::format($gross) : number_format($gross, 2);
|
||||||
|
if ($new_status === self::STATUS_REJECTED) {
|
||||||
|
$title = __('提现已拒绝', 'aksrt');
|
||||||
|
$body = sprintf(__('您申请提现 %s 元已被拒绝,冻结金额已退回钱包。', 'aksrt'), $amount_txt);
|
||||||
|
if ($note !== '') {
|
||||||
|
$body .= ' ' . sprintf(__('备注:%s', 'aksrt'), $note);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$title = __('提现已完成', 'aksrt');
|
||||||
|
$body = sprintf(__('您申请提现 %s 元已处理完成。', 'aksrt'), $amount_txt);
|
||||||
|
}
|
||||||
|
AKSRT_Message::get_instance()->send($user_id, 'withdraw', $body, [
|
||||||
|
'title' => $title,
|
||||||
|
'target_url' => function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url('credits') : '',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -312,17 +312,27 @@ class AKSRT_Forum_Comment_Service {
|
|||||||
update_post_meta($topic_id, '_aksrt_question_status', 1); // QUESTION_SOLVED
|
update_post_meta($topic_id, '_aksrt_question_status', 1); // QUESTION_SOLVED
|
||||||
|
|
||||||
$adoptee_id = (int) $comment->user_id;
|
$adoptee_id = (int) $comment->user_id;
|
||||||
if ($adoptee_id > 0 && class_exists('AKSRT_Credits')) {
|
if ($adoptee_id > 0) {
|
||||||
$config = $this->forum->get_config();
|
$config = $this->forum->get_config();
|
||||||
$amount = (int) ($config['credits']['adopted'] ?? 20);
|
$amount = (int) ($config['credits']['adopted'] ?? 20);
|
||||||
if ($amount > 0) {
|
if ($amount > 0) {
|
||||||
$already = get_comment_meta($comment_id, '_aksrt_adopt_credited', true);
|
$already = get_comment_meta($comment_id, '_aksrt_adopt_credited', true);
|
||||||
if (!$already) {
|
if (!$already) {
|
||||||
\AKSRT_Credits::add($adoptee_id, $amount, 'forum_adopted', [
|
if (class_exists('AKSRT_Points_Free')) {
|
||||||
'type' => 'comment',
|
$granted = \AKSRT_Points_Free::grant($adoptee_id, 'bbs_adopt', $amount, [
|
||||||
'id' => $comment_id,
|
'type' => 'comment',
|
||||||
]);
|
'id' => $comment_id,
|
||||||
update_comment_meta($comment_id, '_aksrt_adopt_credited', '1');
|
]);
|
||||||
|
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');
|
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;
|
$author_id = (int) $comment->user_id;
|
||||||
if ($author_id > 0 && class_exists('AKSRT_Credits')) {
|
if ($author_id > 0) {
|
||||||
$amount = (int) ($config['credits']['comment_like'] ?? 1);
|
$amount = (int) ($config['credits']['comment_hot'] ?? $config['credits']['comment_like'] ?? 5);
|
||||||
if ($amount > 0) {
|
if ($amount > 0) {
|
||||||
\AKSRT_Credits::add($author_id, $amount, 'forum_hot_comment', [
|
if (class_exists('AKSRT_Points_Free')) {
|
||||||
'type' => 'comment',
|
\AKSRT_Points_Free::grant($author_id, 'bbs_comment_hot', $amount, [
|
||||||
'id' => $comment_id,
|
'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;
|
$reputation += $amount;
|
||||||
update_user_meta($author_id, 'aksrt_reputation', $reputation);
|
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);
|
$credits_amount = (int) ($config['credits']['score_extra'] ?? 3);
|
||||||
if ($credits_amount > 0) {
|
if ($credits_amount > 0) {
|
||||||
$daily = $this->today_credits_count($author_id, 'forum_score_extra');
|
if (class_exists('AKSRT_Points_Free')) {
|
||||||
$daily_max = (int) ($config['credits']['daily_max'] ?? 50);
|
AKSRT_Points_Free::grant($author_id, 'bbs_score_extra', $credits_amount, [
|
||||||
if ($daily < $daily_max) {
|
'type' => 'post',
|
||||||
AKSRT_Credits::add($author_id, $credits_amount, 'forum_score_extra', sprintf(
|
'id' => $topic_id,
|
||||||
__('帖子「%s」被加分', 'aksrt'),
|
]);
|
||||||
get_the_title($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');
|
update_post_meta($topic_id, '_aksrt_hot_rewarded', '1');
|
||||||
$config = $this->forum->get_config();
|
$config = $this->forum->get_config();
|
||||||
$amount = (int) ($config['credits']['posts_hot'] ?? 5);
|
$amount = (int) ($config['credits']['posts_hot'] ?? 5);
|
||||||
if ($amount > 0 && class_exists('AKSRT_Credits')) {
|
if ($amount > 0) {
|
||||||
AKSRT_Credits::add($author_id, $amount, 'forum_hot_topic', [
|
if (class_exists('AKSRT_Points_Free')) {
|
||||||
'type' => 'post', 'id' => $topic_id,
|
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(
|
$this->notify($author_id, 'hot', sprintf(
|
||||||
__('你的帖子「%s」成为热帖!', 'aksrt'), get_the_title($topic_id)
|
__('你的帖子「%s」成为热帖!', 'aksrt'), get_the_title($topic_id)
|
||||||
|
|||||||
@@ -245,22 +245,32 @@ trait AKSRT_Forum_Topic_Service_Part_1 {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 积分奖励(§7.7):读 `credits.essence`,带每日上限。
|
// 积分奖励(§7.7):统一走免费积分日上限。
|
||||||
if (class_exists('AKSRT_Credits') && class_exists('AKSRT_Settings')) {
|
if (class_exists('AKSRT_Settings')) {
|
||||||
$cfg = AKSRT_Settings::get_forum_settings();
|
$cfg = AKSRT_Settings::get_forum_settings();
|
||||||
$amount = (int) ($cfg['credits']['essence'] ?? 0);
|
$amount = (int) ($cfg['credits']['essence'] ?? 0);
|
||||||
if ($amount > 0) {
|
if ($amount > 0) {
|
||||||
$daily_max = (int) ($cfg['credits']['daily_max'] ?? 50);
|
$granted = 0;
|
||||||
if ($daily_max > 0 && $this->today_credits_count($author_id, 'forum_essence') >= $daily_max) {
|
if (class_exists('AKSRT_Points_Free')) {
|
||||||
$amount = 0;
|
$result = AKSRT_Points_Free::grant($author_id, 'bbs_essence', $amount, [
|
||||||
}
|
|
||||||
|
|
||||||
if ($amount > 0) {
|
|
||||||
AKSRT_Credits::add($author_id, $amount, 'forum_essence', [
|
|
||||||
'type' => 'post',
|
'type' => 'post',
|
||||||
'id' => $topic_id,
|
'id' => $topic_id,
|
||||||
], __('主题被设为精华', 'aksrt'));
|
]);
|
||||||
|
$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', '1');
|
||||||
update_post_meta($topic_id, '_aksrt_essence_rewarded_at', current_time('mysql'));
|
update_post_meta($topic_id, '_aksrt_essence_rewarded_at', current_time('mysql'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ if (!function_exists('aksrt_credits_label')) {
|
|||||||
'free_bbs_posts_new'=> __('论坛发帖', 'aksrt'),
|
'free_bbs_posts_new'=> __('论坛发帖', 'aksrt'),
|
||||||
'free_bbs_reply'=> __('论坛回复', 'aksrt'),
|
'free_bbs_reply'=> __('论坛回复', 'aksrt'),
|
||||||
'free_bbs_essence'=> __('帖子加精', 'aksrt'),
|
'free_bbs_essence'=> __('帖子加精', 'aksrt'),
|
||||||
|
'free_bbs_adopt'=> __('回复被采纳', 'aksrt'),
|
||||||
|
'free_bbs_posts_hot'=> __('热帖奖励', 'aksrt'),
|
||||||
|
'free_bbs_comment_hot'=> __('神评奖励', 'aksrt'),
|
||||||
|
'free_bbs_score_extra'=> __('帖子加分', 'aksrt'),
|
||||||
];
|
];
|
||||||
if (isset($map[$reason])) {
|
if (isset($map[$reason])) {
|
||||||
return $map[$reason];
|
return $map[$reason];
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ if (!function_exists('aksrt_single_render_actions')) :
|
|||||||
<button type="button" class="share-item" data-platform="twitter"><i class="fab fa-x-twitter"></i><span>X</span></button>
|
<button type="button" class="share-item" data-platform="twitter"><i class="fab fa-x-twitter"></i><span>X</span></button>
|
||||||
<button type="button" class="share-item" data-platform="wechat"><i class="fab fa-weixin"></i><span>微信</span></button>
|
<button type="button" class="share-item" data-platform="wechat"><i class="fab fa-weixin"></i><span>微信</span></button>
|
||||||
<button type="button" class="share-item" data-platform="copy"><i class="fas fa-link"></i><span><?php esc_html_e('复制链接', 'aksrt'); ?></span></button>
|
<button type="button" class="share-item" data-platform="copy"><i class="fas fa-link"></i><span><?php esc_html_e('复制链接', 'aksrt'); ?></span></button>
|
||||||
|
<button type="button" class="share-item" data-platform="poster"><i class="fas fa-image"></i><span><?php esc_html_e('海报分享', 'aksrt'); ?></span></button>
|
||||||
</div>
|
</div>
|
||||||
<div id="share-qrcode-box" aria-hidden="true"><img id="share-qrcode-image" src="" alt="QR Code"></div>
|
<div id="share-qrcode-box" aria-hidden="true"><img id="share-qrcode-image" src="" alt="QR Code"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user