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
41245090
authored
Aug 02, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
初始化供应商搜索标签数据和接入修改流程
parent
53d7cb5c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
12 deletions
app/Http/Services/DataService.php
app/Http/Services/SupplierService.php
app/Http/routes.php
app/Http/Services/DataService.php
View file @
41245090
...
...
@@ -52,17 +52,17 @@ class DataService
$cooperation_agreement
=
array_get
(
$files
,
'cooperation_agreement'
);
$other_attachment
=
array_get
(
$files
,
'other_attachment'
);
$attachment
=
[
'business_license'
=>
$business_license
?
[
$business_license
]
:
''
,
'billing_information'
=>
$billing_information
?
[
$billing_information
]
:
''
,
'registration_certificate'
=>
$registration_certificate
?
[
$registration_certificate
]
:
''
,
'incorporation_certificate'
=>
$incorporation_certificate
?
[
$incorporation_certificate
]
:
''
,
'certification_notice'
=>
$certification_notice
?
[
$certification_notice
]
:
''
,
'supplier_survey'
=>
$supplier_survey
?
[
$supplier_survey
]
:
''
,
'proxy_certificate'
=>
$proxy_certificate
?
[
$proxy_certificate
]
:
''
,
'quality_assurance_agreement'
=>
$quality_assurance_agreement
?
[
$quality_assurance_agreement
]
:
''
,
'confidentiality_agreement'
=>
$confidentiality_agreement
?
[
$confidentiality_agreement
]
:
''
,
'cooperation_agreement'
=>
$cooperation_agreement
?
[
$cooperation_agreement
]
:
''
,
'other_attachment'
=>
$other_attachment
?
[
$other_attachment
]
:
''
,
'business_license'
=>
$business_license
?
[
$business_license
]
:
''
,
'billing_information'
=>
$billing_information
?
[
$billing_information
]
:
''
,
'registration_certificate'
=>
$registration_certificate
?
[
$registration_certificate
]
:
''
,
'incorporation_certificate'
=>
$incorporation_certificate
?
[
$incorporation_certificate
]
:
''
,
'certification_notice'
=>
$certification_notice
?
[
$certification_notice
]
:
''
,
'supplier_survey'
=>
$supplier_survey
?
[
$supplier_survey
]
:
''
,
'proxy_certificate'
=>
$proxy_certificate
?
[
$proxy_certificate
]
:
''
,
'quality_assurance_agreement'
=>
$quality_assurance_agreement
?
[
$quality_assurance_agreement
]
:
''
,
'confidentiality_agreement'
=>
$confidentiality_agreement
?
[
$confidentiality_agreement
]
:
''
,
'cooperation_agreement'
=>
$cooperation_agreement
?
[
$cooperation_agreement
]
:
''
,
'other_attachment'
=>
$other_attachment
?
[
$other_attachment
]
:
''
,
'create_time'
=>
time
(),
'update_time'
=>
time
(),
'supplier_id'
=>
$supplierId
,
...
...
@@ -170,6 +170,32 @@ class DataService
print_r
(
$standardBrandIds
);
}
}
//初始化供应商对应的搜索标签到redis
public
function
initSupplierSearchTags
()
{
//初始化所有正式服务器的标签情况到redis
$supplierModel
=
new
SupplierChannelModel
();
$suppliers
=
$supplierModel
->
where
(
'is_type'
,
0
)
->
get
()
->
toArray
();
$redis
=
new
RedisModel
();
foreach
(
$suppliers
as
$supplier
)
{
//1精选,2原厂直供,3认证,4猎芯自营,100无标签
$tagFlags
=
[];
//先去判断供应商性质是否为原厂,如果是的话,写入标签2
if
(
$supplier
[
'supplier_group'
]
==
4
)
{
$tagFlags
[]
=
2
;
}
if
(
$supplier
[
'has_certification'
]
==
1
)
{
$tagFlags
[]
=
3
;
}
$redis
->
hset
(
'supplier_search_tags'
,
$supplier
[
'supplier_code'
],
json_encode
([
'supplier_code'
=>
$supplier
[
'supplier_code'
],
'tags'
=>
$tagFlags
,
]));
}
}
}
app/Http/Services/SupplierService.php
View file @
41245090
...
...
@@ -158,6 +158,8 @@ class SupplierService
$attachmentService
->
saveAttachment
(
$supplierId
,
$attachment
);
//重新生成外部显示的编码
$this
->
generateSupplierSn
(
$supplierId
,
$channel
[
'supplier_group'
]);
//保存和搜索相关的标签情况
$this
->
saveSupplierSearchTags
(
$supplierId
);
return
true
;
});
...
...
@@ -429,4 +431,26 @@ class SupplierService
]);
}
}
//保存标签情况(搜索相关,不是系统标签和自定义标签)
//供应商性质为原厂(4)的话,写入标签2;已认证的话,写入标签3
public
function
saveSupplierSearchTags
(
$supplierId
)
{
$supplierModel
=
new
SupplierChannelModel
();
$supplier
=
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$tagFlags
=
[];
//先去判断供应商性质是否为原厂,如果是的话,写入标签2
if
(
$supplier
[
'supplier_group'
]
==
4
)
{
$tagFlags
[]
=
2
;
}
if
(
$supplier
[
'has_certification'
]
==
1
)
{
$tagFlags
[]
=
3
;
}
$redis
=
new
RedisModel
();
$redis
->
hset
(
'supplier_search_tags'
,
$supplier
[
'supplier_code'
],
json_encode
([
'supplier_code'
=>
$supplier
[
'supplier_code'
],
'tags'
=>
$tagFlags
,
]));
}
}
\ No newline at end of file
app/Http/routes.php
View file @
41245090
...
...
@@ -45,5 +45,6 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$service
=
new
\App\Http\Services\DataService
();
// $service->initSystemTag();
$service
->
transferFileData
();
// $service->transferFileData();
$service
->
initSupplierSearchTags
();
});
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