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
57555617
authored
Nov 02, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化修改拉黑
parent
ec720665
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
app/Http/Services/SyncSupplierService.php
app/Http/Services/SyncSupplierService.php
View file @
57555617
...
...
@@ -170,6 +170,7 @@ class SyncSupplierService
//接收一体化系统处理好的供应商数据,可能是第一次新增返回的数据,也可能是一体化那边修改的数据需要同步到供应商
public
function
syncSupplierToUnitedResult
(
$syncResult
)
{
$redis
=
new
RedisModel
();
$groupCode
=
array_get
(
$syncResult
,
'group_code'
);
$sourceSn
=
array_get
(
$syncResult
,
'source_sn'
);
$companyCategory
=
array_get
(
$syncResult
,
'company_category'
,
''
);
...
...
@@ -177,20 +178,33 @@ class SyncSupplierService
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$sourceSn
)
->
orWhere
(
'group_code'
,
$groupCode
)
->
first
();
$supplier
=
!
empty
(
$supplier
)
?
$supplier
->
toArray
()
:
[];
$supplierId
=
$supplier
[
'supplier_id'
];
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
if
(
$companyCategory
!=
''
)
{
//实体名单和黑名单都要拉黑,如果不属于黑名单,那么就要将状态改成审核中
if
(
$companyCategory
!=
'普通供应商'
)
{
$data
[
'status'
]
=
SupplierChannelModel
::
STATUS_BLOCK
;
$data
[
'block_reason'
]
=
'一体化系统黑名单供应商'
;
}
elseif
(
$isEntity
)
{
$data
[
'status'
]
=
SupplierChannelModel
::
STATUS_BLOCK
;
$data
[
'block_reason'
]
=
'一体化系统黑名单供应商'
;
$status
=
$supplier
[
'status'
];
//加入实体化之前,要先记录原来的状态
if
(
!
$redis
->
hget
(
'supplier_status_before_disable'
,
$supplierId
))
{
$redis
->
hset
(
'supplier_status_before_disable'
,
$supplierId
,
$status
);
}
$data
[
'status'
]
=
SupplierChannelModel
::
STATUS_DISABLE
;
$data
[
'is_entity'
]
=
SupplierChannelModel
::
IS_ENTITY_TRUE
;
$data
[
'disable_reason'
]
=
'一体化系统实体名单供应商'
;
}
else
{
$preIsEntity
=
$supplier
[
'is_entity'
];
//判断原来是拉黑状态,才变成审核中,因为有可能不是修改公司类型,只是修改公司性质
if
(
$supplier
[
'status'
]
==
SupplierChannelModel
::
STATUS_BLOCK
)
{
if
(
$supplier
[
'status'
]
==
SupplierChannelModel
::
STATUS_BLOCK
)
{
$data
[
'status'
]
=
SupplierChannelModel
::
STATUS_IN_REVIEW
;
}
//如果之前是禁用,并且是实体名单,那么就要恢复之前的状态
if
(
$supplier
[
'status'
]
===
SupplierChannelModel
::
STATUS_DISABLE
&&
$preIsEntity
==
SupplierChannelModel
::
IS_ENTITY_TRUE
)
{
$cacheStatus
=
$redis
->
hget
(
'supplier_status_before_disable'
,
$supplierId
);
$data
[
'status'
]
=
$cacheStatus
?:
SupplierChannelModel
::
STATUS_IN_REVIEW
;
}
}
}
$data
[
'sync_united_status'
]
=
SupplierChannelModel
::
SYNC_UNITED_STATUS_OK
;
...
...
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