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
deda29e4
authored
Jan 10, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复标准品牌问题
parent
668ecc50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
app/Http/Services/StatisticsSkuUploadService.php
app/Http/Services/StatisticsSkuUploadService.php
View file @
deda29e4
...
@@ -56,7 +56,7 @@ class StatisticsSkuUploadService
...
@@ -56,7 +56,7 @@ class StatisticsSkuUploadService
if
(
empty
(
$brandCountMap
))
{
if
(
empty
(
$brandCountMap
))
{
continue
;
continue
;
}
}
dump
(
"完成供应商
$supplierCode
"
.
PHP_EOL
);
dump
(
"完成供应商
$supplierCode
"
.
PHP_EOL
);
$redis
->
hset
(
'half_year_brand_sku_upload_statistics'
,
$supplierCode
,
json_encode
(
$brandCountMap
));
$redis
->
hset
(
'half_year_brand_sku_upload_statistics'
,
$supplierCode
,
json_encode
(
$brandCountMap
));
}
}
}
}
...
@@ -80,7 +80,37 @@ class StatisticsSkuUploadService
...
@@ -80,7 +80,37 @@ class StatisticsSkuUploadService
}
}
$data
=
json_decode
(
$data
,
true
);
$data
=
json_decode
(
$data
,
true
);
arsort
(
$data
);
dump
(
$data
);
$countByBrandName
=
[];
foreach
(
$data
as
$brandName
=>
$skuCount
)
{
//然后获取每个品牌的标准品牌
$brandNameAllKey
=
md5
(
strtolower
(
$brandName
));
$brandId
=
$redis
->
hget
(
'brand_name_all'
,
$brandNameAllKey
);
//然后找到标准品牌id
$standardBrandId
=
$redis
->
hget
(
'standard_brand_mapping'
,
$brandId
);
$standardBrand
=
$redis
->
hget
(
'standard_brand'
,
$standardBrandId
);
$standardBrand
=
json_decode
(
$standardBrand
,
true
);
$countByBrandName
[]
=
[
'standard_brand_id'
=>
$standardBrandId
,
'standard_brand_name'
=>
$standardBrand
[
'brand_name'
],
'sku_count'
=>
$skuCount
,
];
}
//统计标品的sku数量
$dataByStandardBrandName
=
collect
(
$countByBrandName
)
->
groupBy
(
'standard_brand_name'
)
->
toArray
();
$countByStandardBrandName
=
[];
foreach
(
$dataByStandardBrandName
as
$brandName
=>
$standardBrandItem
)
{
if
(
empty
(
$brandName
))
{
continue
;
}
$skuCount
=
0
;
foreach
(
$standardBrandItem
as
$value
)
{
$skuCount
=
$value
[
'sku_count'
];
}
$countByStandardBrandName
[
$brandName
]
=
$skuCount
;
}
arsort
(
$countByStandardBrandName
);
return
$data
;
return
$data
;
}
}
...
...
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