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
45274004
authored
Mar 21, 2023
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复eccn
parent
e1d1582d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
12 deletions
service/service_ly_common.go
service/service_ly_common.go
View file @
45274004
...
...
@@ -274,7 +274,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
brandIds
:=
gjson
.
Get
(
discountRatio
,
"brand."
+
sortString
)
.
String
()
if
brandIds
!=
""
{
hasSpecialCheck
=
true
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
"
@€@
"
)
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
"
,
"
)
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
//找到有对应的品牌,那么优先级肯定是最高的了
if
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
...
...
@@ -307,17 +307,11 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
var
priceRatioSort
int
//这个就是最终要获取到的价格系数
var
priceRatioList
[]
model
.
PriceRatio
//是否找到系数的标志位
findedRatio
:=
false
//如果只有默认系数,那么就去找默认系数
if
isDefaultPriceRatio
{
priceRatioArr
:=
gjson
.
Get
(
priceRatioCache
,
"ladder_price"
)
.
Array
()
for
_
,
value
:=
range
priceRatioArr
{
priceRatioList
=
nil
var
priceRatio
model
.
PriceRatio
priceRatio
.
Ratio
=
gjson
.
Get
(
value
.
String
(),
"ratio"
)
.
Float
()
priceRatio
.
RatioUsd
=
gjson
.
Get
(
value
.
String
(),
"ratio_usd"
)
.
Float
()
priceRatioList
=
append
(
priceRatioList
,
priceRatio
)
}
priceRatioSort
=
-
1
}
else
{
//拿到系数以后,就要去计算
//拿出里面的所有排序
...
...
@@ -351,6 +345,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
goodsNameList
:=
strings
.
Split
(
goodsNames
,
"@€@"
)
//找到有对应的商品名称,那么优先级肯定是最高的了
if
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
findedRatio
=
true
break
}
}
...
...
@@ -359,10 +354,11 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
brandIds
:=
gjson
.
Get
(
priceRatioCache
,
"brand."
+
sortString
)
.
String
()
if
brandIds
!=
""
{
hasSpecialCheck
=
true
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
"
@€@
"
)
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
"
,
"
)
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
//找到有对应的品牌,那么优先级肯定是最高的了
if
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
findedRatio
=
true
break
}
}
...
...
@@ -370,7 +366,8 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//判断是否有符合的eccn
eccns
:=
gjson
.
Get
(
priceRatioCache
,
"eccn."
+
sortString
)
.
String
()
if
eccns
!=
""
{
eccnList
:=
strings
.
Split
(
eccns
,
"@€@"
)
hasSpecialCheck
=
true
eccnList
:=
strings
.
Split
(
eccns
,
","
)
fmt
.
Println
(
eccnList
)
//找到有对应的eccn,那么优先级肯定是最高的了
for
_
,
eccn
:=
range
eccnList
{
...
...
@@ -387,6 +384,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
Contains
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"前后匹配到"
)
findedRatio
=
true
break
}
}
...
...
@@ -396,6 +394,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
fmt
.
Println
(
sku
.
Eccn
,
eccn
)
if
strings
.
HasSuffix
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"前匹配到"
)
findedRatio
=
true
break
}
}
...
...
@@ -404,6 +403,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
HasPrefix
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"后匹配到"
)
findedRatio
=
true
break
}
}
...
...
@@ -414,8 +414,22 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if
hasSpecialCheck
{
continue
}
findedRatio
=
true
break
}
//找不到特定的系数,那就去找全局的
if
!
findedRatio
{
priceRatioCache
,
_
=
redis
.
String
(
redisCon
.
Do
(
"GET"
,
"magic_cube_price_rule_channel_default"
))
priceRatioArr
:=
gjson
.
Get
(
priceRatioCache
,
"ladder_price"
)
.
Array
()
priceRatioList
=
nil
for
_
,
value
:=
range
priceRatioArr
{
var
priceRatio
model
.
PriceRatio
priceRatio
.
Ratio
=
gjson
.
Get
(
value
.
String
(),
"ratio"
)
.
Float
()
priceRatio
.
RatioUsd
=
gjson
.
Get
(
value
.
String
(),
"ratio_usd"
)
.
Float
()
priceRatioList
=
append
(
priceRatioList
,
priceRatio
)
}
priceRatioSort
=
-
1
}
}
sku
.
PriceRatio
=
priceRatioList
sku
.
PriceRatioSort
=
priceRatioSort
...
...
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