Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_server
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
5197a67a
authored
Mar 21, 2023
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复判断eccn问题
parent
74cb4a8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
5 deletions
service/service_ly_common.go
service/service_ly_common.go
View file @
5197a67a
...
...
@@ -330,9 +330,13 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
priceRatio
.
RatioUsd
=
gjson
.
Get
(
value
.
String
(),
"ratio_usd"
)
.
Float
()
priceRatioList
=
append
(
priceRatioList
,
priceRatio
)
}
var
hasSpecialCheck
=
false
//判断是否有符合的商品名称
goodsNames
:=
gjson
.
Get
(
priceRatioCache
,
"goods_name."
+
sortString
)
.
String
()
if
goodsNames
!=
""
{
hasSpecialCheck
=
true
goodsNameList
:=
strings
.
Split
(
goodsNames
,
"€"
)
//找到有对应的商品名称,那么优先级肯定是最高的了
if
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
...
...
@@ -341,8 +345,9 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
//判断是否有符合的标准品牌ID
brandIds
:=
gjson
.
Get
(
priceRatioCache
,
"brand"
+
sortString
)
.
String
()
brandIds
:=
gjson
.
Get
(
priceRatioCache
,
"brand
.
"
+
sortString
)
.
String
()
if
brandIds
!=
""
{
hasSpecialCheck
=
true
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
"€"
)
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
//找到有对应的品牌,那么优先级肯定是最高的了
...
...
@@ -352,18 +357,54 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
//判断是否有符合的eccn
eccns
:=
gjson
.
Get
(
priceRatioCache
,
"eccn"
+
sortString
)
.
String
()
eccns
:=
gjson
.
Get
(
priceRatioCache
,
"eccn
.
"
+
sortString
)
.
String
()
if
eccns
!=
""
{
eccnList
:=
strings
.
Split
(
eccns
,
"€"
)
fmt
.
Println
(
eccnList
)
//找到有对应的eccn,那么优先级肯定是最高的了
for
_
,
eccn
:=
range
eccnList
{
if
strings
.
Contains
(
sku
.
Eccn
,
eccn
)
{
break
//判断是否有百分号匹配
//如果是纯%,那就是不对的,要跳过
if
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
==
""
{
continue
}
if
strings
.
Contains
(
eccn
,
"%"
)
{
hasPrefix
:=
strings
.
HasPrefix
(
eccn
,
"%"
)
hasSuffix
:=
strings
.
HasSuffix
(
eccn
,
"%"
)
if
hasPrefix
&&
hasSuffix
{
fmt
.
Println
(
"前后匹配"
)
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
Contains
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"前后匹配到"
)
break
}
}
if
hasPrefix
&&
!
hasSuffix
{
fmt
.
Println
(
"前匹配"
)
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
fmt
.
Println
(
sku
.
Eccn
,
eccn
)
if
strings
.
HasSuffix
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"前匹配到"
)
break
}
}
if
!
hasPrefix
&&
hasSuffix
{
fmt
.
Println
(
"后匹配"
)
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
HasPrefix
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"后匹配到"
)
break
}
}
}
}
}
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
break
if
hasSpecialCheck
{
continue
}
else
{
break
}
}
}
sku
.
PriceRatio
=
priceRatioList
...
...
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