增加积分调整日志

This commit is contained in:
2026-07-21 18:59:45 +08:00
parent 4fbc4500fd
commit 140a068b88
23 changed files with 673 additions and 18 deletions

View File

@@ -847,7 +847,7 @@ class Playx extends Api
}
/**
* 积分流水(领取/兑换/退回)
* 积分流水(领取/兑换/退回/管理员调整
* GET /api/v1/mall/pointsLogs
*
* 鉴权token / session_id / user_id同 assets/orders
@@ -981,6 +981,28 @@ FROM (
FROM mall_order o
LEFT JOIN mall_item i ON i.id = o.mall_item_id
WHERE o.user_id = :user_id_refund AND o.status = 'REJECTED' AND o.points_cost > 0 AND o.update_time IS NOT NULL
UNION ALL
SELECT
'ADMIN_ADJUST' AS biz_type,
CASE WHEN pl.score_value > 0 THEN 'IN' ELSE 'OUT' END AS direction,
ABS(pl.score_value) AS points,
pl.create_time AS ts,
pl.id AS ref_id,
'' AS order_no,
'' AS order_status,
0 AS item_id,
'' AS item_title,
0 AS item_type,
0 AS item_score,
0 AS item_amount,
0 AS item_multiplier,
'' AS item_category,
'' AS item_category_title,
CONCAT(LPAD(pl.create_time, 10, '0'), '_4_', LPAD(pl.id, 10, '0')) AS sort_key
FROM mall_points_log pl
WHERE pl.user_asset_id = :user_asset_id_adjust
) t
WHERE 1=1
SQL;
@@ -989,6 +1011,7 @@ SQL;
'user_id_claim' => $playxUserId,
'user_id_redeem' => $playxUserId,
'user_id_refund' => $playxUserId,
'user_asset_id_adjust' => $assetId,
];
if ($cursor !== '') {
@@ -1016,10 +1039,18 @@ SQL;
if (!is_array($row)) {
continue;
}
$memo = '';
if (($row['biz_type'] ?? '') === 'ADMIN_ADJUST') {
$memoKey = ($row['direction'] ?? '') === 'OUT'
? 'Administrator deducted %s points'
: 'Administrator added %s points';
$memo = __($memoKey, [$row['points'] ?? 0]);
}
$list[] = [
'biz_type' => $row['biz_type'] ?? '',
'direction' => $row['direction'] ?? '',
'points' => $row['points'] ?? 0,
'memo' => $memo,
'ts' => $row['ts'] ?? null,
'ref_id' => $row['ref_id'] ?? '',
'order_no' => $row['order_no'] ?? '',