1.优化后台页面样式
2.优化统一订单中红利的状态和失败原因 3.移除项目中冗余代码和字段
This commit is contained in:
@@ -198,6 +198,7 @@ class AngpowImportJobs
|
||||
if ($code === '0' || $code === 0) {
|
||||
MallOrder::whereIn('id', $orderIds)->update([
|
||||
'grant_status' => MallOrder::GRANT_ACCEPTED,
|
||||
'status' => MallOrder::STATUS_COMPLETED,
|
||||
'fail_reason' => null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
@@ -265,6 +266,21 @@ class AngpowImportJobs
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 单条失败原因压成一行,避免异常信息自带换行导致与 attempt 分段混在一起。
|
||||
*/
|
||||
private function normalizeReasonLine(string $reason): string
|
||||
{
|
||||
$s = trim($reason);
|
||||
if ($s === '') {
|
||||
return '';
|
||||
}
|
||||
$s = str_replace(["\r\n", "\r", "\n"], ' ', $s);
|
||||
$replaced = preg_replace('/\s+/', ' ', $s);
|
||||
|
||||
return is_string($replaced) && $replaced !== '' ? $replaced : $s;
|
||||
}
|
||||
|
||||
private function markFailedAttempt(MallOrder $order, string $reason): void
|
||||
{
|
||||
// retry_count 在“准备发送”阶段已 +1;此处用当前 retry_count 作为 attempt 编号
|
||||
@@ -277,7 +293,7 @@ class AngpowImportJobs
|
||||
|
||||
$prev = $order->fail_reason;
|
||||
$prefix = 'attempt ' . $attempt . ': ';
|
||||
$line = $prefix . $reason;
|
||||
$line = $prefix . $this->normalizeReasonLine($reason);
|
||||
$newReason = $line;
|
||||
if (is_string($prev) && $prev !== '') {
|
||||
$newReason = $prev . "\n" . $line;
|
||||
|
||||
Reference in New Issue
Block a user