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
84490a0b
authored
Mar 21, 2023
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复判断问题
parent
5197a67a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
16 deletions
service/service_ly_common.go
service/service_ly_common.go
View file @
84490a0b
...
...
@@ -257,26 +257,35 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
sortString
:=
strconv
.
Itoa
(
sortNumber
)
cnDiscountRatio
=
gjson
.
Get
(
discountRatio
,
"ration."
+
sortString
)
.
Float
()
usDiscountRatio
=
gjson
.
Get
(
discountRatio
,
"ration_usd."
+
sortString
)
.
Float
()
var
hasSpecialCheck
=
false
//判断是否有符合的商品名称
goodsNames
:=
gjson
.
Get
(
discountRatio
,
"goods_name"
)
.
String
()
goodsNameList
:=
strings
.
Split
(
goodsNames
,
"€"
)
//找到有对应的商品名称,那么优先级肯定是最高的了
if
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
break
goodsNames
:=
gjson
.
Get
(
discountRatio
,
"goods_name."
+
sortString
)
.
String
()
if
goodsNames
!=
""
{
hasSpecialCheck
=
true
goodsNameList
:=
strings
.
Split
(
goodsNames
,
"€"
)
//找到有对应的商品名称,那么优先级肯定是最高的了
if
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
break
}
}
//判断是否有符合的品牌名称
brandIds
:=
gjson
.
Get
(
discountRatio
,
"brand"
)
.
String
()
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
"€"
)
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
//找到有对应的品牌,那么优先级肯定是最高的了
if
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
break
brandIds
:=
gjson
.
Get
(
discountRatio
,
"brand."
+
sortString
)
.
String
()
if
brandIds
!=
""
{
hasSpecialCheck
=
true
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
"€"
)
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
//找到有对应的品牌,那么优先级肯定是最高的了
if
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
break
}
}
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if
len
(
goodsNameList
)
==
0
&&
len
(
standardBrandIdList
)
==
0
{
break
if
hasSpecialCheck
{
continue
}
break
}
}
sku
.
DiscountRatio
.
Ratio
=
cnDiscountRatio
...
...
@@ -402,9 +411,8 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if
hasSpecialCheck
{
continue
}
else
{
break
}
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