Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8de2508d
authored
Mar 02, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fuck
parent
195b4c82
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
24 deletions
app/Console/Commands/RefreshHistoryPurchaseUser.php
app/Console/Commands/RefreshHistoryPurchaseUser.php
View file @
8de2508d
...
...
@@ -40,11 +40,8 @@ class RefreshHistoryPurchaseUser extends Command
$this
->
info
(
'处理数量: '
.
(
$num
>
0
?
$num
:
'不限制'
));
$this
->
info
(
'========================================'
);
// 调用服务方法
$self
=
$this
;
$result
=
SupplierService
::
refreshHistoryPurchaseUserWithProgress
(
$mode
,
$num
,
function
(
$progress
)
use
(
$self
)
{
$self
->
outputProgress
(
$progress
);
});
// 调用服务方法,不使用实时回调输出
$result
=
SupplierService
::
refreshHistoryPurchaseUserWithProgress
(
$mode
,
$num
);
// 输出最终结果
$this
->
info
(
''
);
...
...
@@ -60,7 +57,10 @@ class RefreshHistoryPurchaseUser extends Command
if
(
!
empty
(
$result
[
'details'
]))
{
$this
->
info
(
''
);
$this
->
info
(
'数据变更详情('
.
count
(
$result
[
'details'
])
.
'条):'
);
foreach
(
$result
[
'details'
]
as
$detail
)
{
// 限制输出数量,避免过多输出
$outputLimit
=
50
;
$details
=
array_slice
(
$result
[
'details'
],
0
,
$outputLimit
);
foreach
(
$details
as
$detail
)
{
$supplierId
=
$detail
[
'supplier_id'
];
$supplierCode
=
isset
(
$detail
[
'supplier_code'
])
?
$detail
[
'supplier_code'
]
:
''
;
$supplierName
=
isset
(
$detail
[
'supplier_name'
])
?
$detail
[
'supplier_name'
]
:
''
;
...
...
@@ -87,28 +87,41 @@ class RefreshHistoryPurchaseUser extends Command
$assignInfo
));
}
if
(
count
(
$result
[
'details'
])
>
$outputLimit
)
{
$this
->
info
(
' ... 还有 '
.
(
count
(
$result
[
'details'
])
-
$outputLimit
)
.
' 条记录未显示'
);
}
}
// 打印失败的记录
// 打印失败的记录
,限制数量
if
(
!
empty
(
$result
[
'debug_info'
]))
{
$this
->
info
(
''
);
$this
->
warn
(
'失败详情('
.
count
(
$result
[
'debug_info'
])
.
'条):'
);
$failCount
=
0
;
foreach
(
$result
[
'debug_info'
]
as
$info
)
{
$failReason
=
isset
(
$info
[
'fail_reason'
])
?
$info
[
'fail_reason'
]
:
''
;
$skipReason
=
isset
(
$info
[
'skip_reason'
])
?
$info
[
'skip_reason'
]
:
''
;
$supplierName
=
isset
(
$info
[
'supplier_name'
])
?
$info
[
'supplier_name'
]
:
''
;
$supplierCode
=
isset
(
$info
[
'supplier_code'
])
?
$info
[
'supplier_code'
]
:
''
;
$reason
=
$failReason
?
$failReason
:
$skipReason
;
// 只打印失败的,跳过的不再打印
if
(
$failReason
)
{
$this
->
warn
(
sprintf
(
' [ID:%d %s] %s - %s'
,
$info
[
'supplier_id'
],
$supplierCode
,
$supplierName
,
$reason
));
if
(
isset
(
$info
[
'fail_reason'
])
&&
$info
[
'fail_reason'
])
{
$failCount
++
;
}
}
if
(
$failCount
>
0
)
{
$this
->
info
(
''
);
$this
->
warn
(
'失败详情('
.
$failCount
.
'条):'
);
$failOutputLimit
=
20
;
$outputCount
=
0
;
foreach
(
$result
[
'debug_info'
]
as
$info
)
{
$failReason
=
isset
(
$info
[
'fail_reason'
])
?
$info
[
'fail_reason'
]
:
''
;
if
(
$failReason
&&
$outputCount
<
$failOutputLimit
)
{
$supplierName
=
isset
(
$info
[
'supplier_name'
])
?
$info
[
'supplier_name'
]
:
''
;
$supplierCode
=
isset
(
$info
[
'supplier_code'
])
?
$info
[
'supplier_code'
]
:
''
;
$this
->
warn
(
sprintf
(
' [ID:%d %s] %s - %s'
,
$info
[
'supplier_id'
],
$supplierCode
,
$supplierName
,
$failReason
));
$outputCount
++
;
}
}
if
(
$failCount
>
$failOutputLimit
)
{
$this
->
warn
(
' ... 还有 '
.
(
$failCount
-
$failOutputLimit
)
.
' 条失败记录未显示'
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment