fix(payment): close creator income contract gaps
This commit is contained in:
@@ -13,6 +13,7 @@ class Metrics {
|
||||
public const META_COMMENT_LIKE_SUM = 'aksrt_comment_like_sum';
|
||||
public const META_POSTS_VIEWS_SUM = 'aksrt_posts_views_sum';
|
||||
public const META_PAY_INCOME = 'aksrt_pay_income_sum';
|
||||
public const META_PAY_INCOME_POINTS = 'aksrt_pay_income_points_sum';
|
||||
public const META_PAY_REBATE = 'aksrt_pay_rebate_sum';
|
||||
public const META_CHECKIN_ALL_DAY = 'aksrt_checkin_all_day';
|
||||
|
||||
@@ -132,13 +133,14 @@ class Metrics {
|
||||
* @param array $context
|
||||
*/
|
||||
public function on_creator_income_added($user_id, $amount, $context = []): void {
|
||||
unset($context);
|
||||
$currency = sanitize_key((string) ($context['currency'] ?? 'CNY'));
|
||||
$user_id = (int) $user_id;
|
||||
$amount = (float) $amount;
|
||||
if ($user_id <= 0 || $amount <= 0) {
|
||||
return;
|
||||
}
|
||||
self::bump_user_meta($user_id, self::META_PAY_INCOME, $amount);
|
||||
$meta_key = $currency === 'points' ? self::META_PAY_INCOME_POINTS : self::META_PAY_INCOME;
|
||||
self::bump_user_meta($user_id, $meta_key, $amount);
|
||||
self::reevaluate_medals($user_id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user