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
9606ad6c
authored
Mar 02, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
972bb128
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
12 deletions
app/Console/Commands/RefreshHistoryPurchaseUser.php
app/Http/Services/SupplierService.php
app/Console/Commands/RefreshHistoryPurchaseUser.php
View file @
9606ad6c
...
...
@@ -56,20 +56,54 @@ class RefreshHistoryPurchaseUser extends Command
$this
->
info
(
'跳过: '
.
$result
[
'skipped'
]);
$this
->
info
(
'========================================'
);
// 如果有失败记录,打印详情
// 只打印有数据变更的公司(成功的)
if
(
!
empty
(
$result
[
'details'
]))
{
$this
->
info
(
''
);
$this
->
info
(
'数据变更详情('
.
count
(
$result
[
'details'
])
.
'条):'
);
foreach
(
$result
[
'details'
]
as
$detail
)
{
$supplierId
=
$detail
[
'supplier_id'
];
$supplierCode
=
isset
(
$detail
[
'supplier_code'
])
?
$detail
[
'supplier_code'
]
:
''
;
$supplierName
=
isset
(
$detail
[
'supplier_name'
])
?
$detail
[
'supplier_name'
]
:
''
;
$action
=
isset
(
$detail
[
'action'
])
?
$detail
[
'action'
]
:
''
;
// 获取分配的采购员信息
$assignInfo
=
''
;
if
(
isset
(
$detail
[
'assign_code_ids'
])
&&
!
empty
(
$detail
[
'assign_code_ids'
]))
{
$assignInfo
=
' 分配采购员codeId: '
.
implode
(
','
,
$detail
[
'assign_code_ids'
]);
}
$this
->
info
(
sprintf
(
' [ID:%d %s] %s - %s%s'
,
$supplierId
,
$supplierCode
,
$supplierName
,
$action
,
$assignInfo
));
}
}
// 打印失败的记录
if
(
!
empty
(
$result
[
'debug_info'
]))
{
$this
->
info
(
''
);
$this
->
warn
(
'失败
/跳过详情
:'
);
$this
->
warn
(
'失败
详情('
.
count
(
$result
[
'debug_info'
])
.
'条)
:'
);
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'
]
:
''
;
$this
->
warn
(
sprintf
(
' [ID:%d] %s - %s'
,
$info
[
'supplier_id'
],
$supplierName
,
$failReason
?
$failReason
:
$skipReason
));
$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
));
}
}
}
...
...
@@ -86,8 +120,13 @@ class RefreshHistoryPurchaseUser extends Command
$action
=
isset
(
$progress
[
'action'
])
?
$progress
[
'action'
]
:
''
;
$status
=
isset
(
$progress
[
'status'
])
?
$progress
[
'status'
]
:
''
;
$statusIcon
=
$status
===
'success'
?
'OK'
:
(
$status
===
'skip'
?
'--'
:
'XX'
);
$statusColor
=
$status
===
'success'
?
'info'
:
(
$status
===
'skip'
?
'comment'
:
'error'
);
// 只打印有变更的记录(成功和失败),跳过的不打印
if
(
$status
===
'skip'
)
{
return
;
}
$statusIcon
=
$status
===
'success'
?
'OK'
:
'XX'
;
$statusColor
=
$status
===
'success'
?
'info'
:
'error'
;
$message
=
sprintf
(
' [%s] ID:%d %s - %s'
,
...
...
@@ -99,8 +138,6 @@ class RefreshHistoryPurchaseUser extends Command
if
(
$statusColor
===
'info'
)
{
$this
->
info
(
$message
);
}
elseif
(
$statusColor
===
'comment'
)
{
$this
->
comment
(
$message
);
}
else
{
$this
->
error
(
$message
);
}
...
...
app/Http/Services/SupplierService.php
View file @
9606ad6c
...
...
@@ -1327,17 +1327,20 @@ class SupplierService
'supplier_code'
=>
$supplier
->
supplier_code
,
'supplier_name'
=>
$supplier
->
supplier_name
,
'action'
=>
'仅分配数据跟单员(基于现有猎芯采购)'
,
'assign_code_ids'
=>
$liexinPurchases
,
];
}
else
{
// 无猎芯采购和数据跟单员:按规则同时分配
$assignResult
=
$supplierService
->
autoAssignPurchaseUser
(
$supplierId
,
$yunxinChannelUid
,
true
);
if
(
$assignResult
[
'success'
])
{
$result
[
'success'
]
++
;
$assignCodeIds
=
isset
(
$assignResult
[
'debug_info'
][
'assign_code_ids'
])
?
$assignResult
[
'debug_info'
][
'assign_code_ids'
]
:
[];
$result
[
'details'
][]
=
[
'supplier_id'
=>
$supplierId
,
'supplier_code'
=>
$supplier
->
supplier_code
,
'supplier_name'
=>
$supplier
->
supplier_name
,
'action'
=>
'分配猎芯采购和数据跟单员'
,
'assign_code_ids'
=>
$assignCodeIds
,
];
}
else
{
$result
[
'failed'
]
++
;
...
...
@@ -1481,6 +1484,7 @@ class SupplierService
'supplier_code'
=>
$supplier
->
supplier_code
,
'supplier_name'
=>
$supplier
->
supplier_name
,
'action'
=>
'仅分配数据跟单员(基于现有猎芯采购)'
,
'assign_code_ids'
=>
$liexinPurchases
,
];
// 回调进度
...
...
@@ -1497,11 +1501,13 @@ class SupplierService
$assignResult
=
$supplierService
->
autoAssignPurchaseUser
(
$supplierId
,
$yunxinChannelUid
,
true
);
if
(
$assignResult
[
'success'
])
{
$result
[
'success'
]
++
;
$assignCodeIds
=
isset
(
$assignResult
[
'debug_info'
][
'assign_code_ids'
])
?
$assignResult
[
'debug_info'
][
'assign_code_ids'
]
:
[];
$result
[
'details'
][]
=
[
'supplier_id'
=>
$supplierId
,
'supplier_code'
=>
$supplier
->
supplier_code
,
'supplier_name'
=>
$supplier
->
supplier_name
,
'action'
=>
'分配猎芯采购和数据跟单员'
,
'assign_code_ids'
=>
$assignCodeIds
,
];
// 回调进度
...
...
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