优化推送统一订单信息-playxId修改为用户名
This commit is contained in:
@@ -125,13 +125,17 @@ class AngpowImportJobs
|
||||
if (!$order instanceof MallOrder) {
|
||||
continue;
|
||||
}
|
||||
$row = $this->buildAngpowRow($order);
|
||||
if ($row === null) {
|
||||
$rowResult = $this->buildAngpowRow($order);
|
||||
if ($rowResult === null) {
|
||||
// 构造失败:直接标为可重试失败
|
||||
$this->markFailedAttempt($order, 'Build payload failed');
|
||||
continue;
|
||||
}
|
||||
$payload['angpow'][] = $row;
|
||||
if (is_string($rowResult)) {
|
||||
$this->markFailedAttempt($order, $rowResult);
|
||||
continue;
|
||||
}
|
||||
$payload['angpow'][] = $rowResult;
|
||||
$orderIds[] = $order->id;
|
||||
}
|
||||
|
||||
@@ -218,7 +222,10 @@ class AngpowImportJobs
|
||||
}
|
||||
}
|
||||
|
||||
private function buildAngpowRow(MallOrder $order): ?array
|
||||
/**
|
||||
* @return array<string, mixed>|string|null 成功返回行数组;用户名缺失返回错误文案字符串;其它构造失败返回 null
|
||||
*/
|
||||
private function buildAngpowRow(MallOrder $order): array|string|null
|
||||
{
|
||||
$asset = MallUserAsset::where('playx_user_id', $order->user_id)->find();
|
||||
if (!$asset) {
|
||||
@@ -233,6 +240,11 @@ class AngpowImportJobs
|
||||
return null;
|
||||
}
|
||||
|
||||
$memberLogin = trim(strval($asset->username ?? ''));
|
||||
if ($memberLogin === '') {
|
||||
return 'User username empty';
|
||||
}
|
||||
|
||||
$item = null;
|
||||
if ($order->mallItem) {
|
||||
$item = $order->mallItem;
|
||||
@@ -256,7 +268,7 @@ class AngpowImportJobs
|
||||
$end = gmdate('Y-m-d\TH:i:s\Z', strtotime($order->end_time));
|
||||
|
||||
return [
|
||||
'member_login' => strval($asset->playx_user_id),
|
||||
'member_login' => $memberLogin,
|
||||
'start_time' => $start,
|
||||
'end_time' => $end,
|
||||
'amount' => $order->amount,
|
||||
|
||||
Reference in New Issue
Block a user