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
88f65816
authored
Mar 21, 2023
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
价格默认取值的问题
parent
45274004
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
service/service_ly_common.go
service/service_ly_common.go
View file @
88f65816
...
@@ -238,10 +238,10 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -238,10 +238,10 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
}
var
cnDiscountRatio
float64
var
cnDiscountRatio
float64
var
usDiscountRatio
float64
var
usDiscountRatio
float64
//是否找到对应的折扣系数,找不到就去找默认
findedDiscountRatio
:=
false
//如果有默认系数,那么就去找默认系数
//如果有默认系数,那么就去找默认系数
if
isDefaultDiscoutRatio
{
if
isDefaultDiscoutRatio
{
cnDiscountRatio
=
gjson
.
Get
(
discountRatio
,
"ration"
)
.
Float
()
usDiscountRatio
=
gjson
.
Get
(
discountRatio
,
"ration_usd"
)
.
Float
()
}
else
{
}
else
{
//拿到系数以后,就要去计算
//拿到系数以后,就要去计算
//拿出里面的所有排序,以人民币系数为准
//拿出里面的所有排序,以人民币系数为准
...
@@ -266,6 +266,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -266,6 +266,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
goodsNameList
:=
strings
.
Split
(
goodsNames
,
"@€@"
)
goodsNameList
:=
strings
.
Split
(
goodsNames
,
"@€@"
)
//找到有对应的商品名称,那么优先级肯定是最高的了
//找到有对应的商品名称,那么优先级肯定是最高的了
if
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
if
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
findedDiscountRatio
=
true
break
break
}
}
}
}
...
@@ -278,17 +279,24 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -278,17 +279,24 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
//找到有对应的品牌,那么优先级肯定是最高的了
//找到有对应的品牌,那么优先级肯定是最高的了
if
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
if
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
findedDiscountRatio
=
true
break
break
}
}
}
}
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if
hasSpecialCheck
{
if
hasSpecialCheck
{
continue
continue
}
}
findedDiscountRatio
=
true
break
break
}
}
}
}
//如果上面都没找到折扣系数,那么就去找全局的
if
!
findedDiscountRatio
{
discountRatio
,
_
=
redis
.
String
(
redisCon
.
Do
(
"GET"
,
"magic_cube_channel_discount_default_daigou"
))
cnDiscountRatio
=
gjson
.
Get
(
discountRatio
,
"ration"
)
.
Float
()
usDiscountRatio
=
gjson
.
Get
(
discountRatio
,
"ration_usd"
)
.
Float
()
}
sku
.
DiscountRatio
.
Ratio
=
cnDiscountRatio
sku
.
DiscountRatio
.
Ratio
=
cnDiscountRatio
sku
.
DiscountRatio
.
RatioUsd
=
usDiscountRatio
sku
.
DiscountRatio
.
RatioUsd
=
usDiscountRatio
fmt
.
Println
(
"折扣系数 : "
,
cnDiscountRatio
,
usDiscountRatio
)
fmt
.
Println
(
"折扣系数 : "
,
cnDiscountRatio
,
usDiscountRatio
)
...
@@ -324,6 +332,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -324,6 +332,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//然后确定排序
//然后确定排序
sortNumbers
=
sorter
.
IntSliceSortDesc
(
sortNumbers
)
sortNumbers
=
sorter
.
IntSliceSortDesc
(
sortNumbers
)
//确定排序以后,就可以进行按排序(从大到小)取系数
//确定排序以后,就可以进行按排序(从大到小)取系数
outerLoop
:
for
_
,
sortNumber
:=
range
sortNumbers
{
for
_
,
sortNumber
:=
range
sortNumbers
{
priceRatioSort
=
sortNumber
priceRatioSort
=
sortNumber
priceRatioList
=
nil
priceRatioList
=
nil
...
@@ -385,7 +394,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -385,7 +394,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if
strings
.
Contains
(
sku
.
Eccn
,
eccn
)
{
if
strings
.
Contains
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"前后匹配到"
)
fmt
.
Println
(
"前后匹配到"
)
findedRatio
=
true
findedRatio
=
true
break
break
outerLoop
}
}
}
}
if
hasPrefix
&&
!
hasSuffix
{
if
hasPrefix
&&
!
hasSuffix
{
...
@@ -395,7 +404,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -395,7 +404,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if
strings
.
HasSuffix
(
sku
.
Eccn
,
eccn
)
{
if
strings
.
HasSuffix
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"前匹配到"
)
fmt
.
Println
(
"前匹配到"
)
findedRatio
=
true
findedRatio
=
true
break
break
outerLoop
}
}
}
}
if
!
hasPrefix
&&
hasSuffix
{
if
!
hasPrefix
&&
hasSuffix
{
...
@@ -404,7 +413,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -404,7 +413,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if
strings
.
HasPrefix
(
sku
.
Eccn
,
eccn
)
{
if
strings
.
HasPrefix
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"后匹配到"
)
fmt
.
Println
(
"后匹配到"
)
findedRatio
=
true
findedRatio
=
true
break
break
outerLoop
}
}
}
}
}
}
...
...
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