优化积分修改时的备注写入适配多语言

This commit is contained in:
2026-07-27 12:34:34 +08:00
parent 881581a8f0
commit 778cdc01da
5 changed files with 38 additions and 38 deletions

View File

@@ -37,9 +37,19 @@ class MallPointsLog extends \app\common\model\MallPointsLog
$model->before = $before;
$model->after = $after;
$pointsAbs = abs($scoreValue);
$model->memo = $scoreValue > 0
? sprintf(__('Administrator added %s points'), $pointsAbs)
: sprintf(__('Administrator deducted %s points'), $pointsAbs);
$memo = trim(strval($model->getData('memo') ?? ''));
if ($memo === '') {
$memo = $scoreValue > 0
? sprintf(__('Administrator added %s points'), $pointsAbs)
: sprintf(__('Administrator deducted %s points'), $pointsAbs);
} else {
if (function_exists('mb_substr')) {
$memo = mb_substr($memo, 0, 255);
} else {
$memo = substr($memo, 0, 255);
}
}
$model->memo = $memo;
$userAsset->available_points = $after;
$userAsset->save();