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
76981993
authored
Sep 11, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'ysx-特殊币种人民币是否含税-20230828' into dev
parents
6475ae3e
c1c3d29f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
2 deletions
model/goods.go
model/ly_sku.go
service/service_ly_common.go
service/service_price.go
model/goods.go
View file @
76981993
...
...
@@ -27,6 +27,14 @@ type OriginPrice struct {
CostPrice
float64
`json:"cost_price"`
}
type
DatabasePrice
struct
{
Purchases
int64
`json:"purchases"`
//购买数量
PriceUs
float64
`json:"price_us"`
//数量对应的英文价格
PriceCn
float64
`json:"price_cn"`
//数量对应的中文价格
PriceAc
float64
`json:"price_ac,omitempty"`
CostPrice
float64
`json:"cost_price"`
}
// 立创价格梯度
type
LadderPriceLc
struct
{
Purchases
int64
`json:"purchases"`
//购买数量
...
...
model/ly_sku.go
View file @
76981993
...
...
@@ -237,6 +237,7 @@ func InitSkuData(sku string) (data LySku) {
LadderPriceStr
:=
gjson
.
Get
(
sku
,
"ladder_price"
)
.
String
()
data
.
LadderPrice
=
getLadderPrice
(
LadderPriceStr
)
data
.
OriginalPrice
=
getOriginPrice
(
LadderPriceStr
)
data
.
DatabasePrice
=
getDatabasePrice
(
LadderPriceStr
)
return
}
...
...
@@ -281,3 +282,23 @@ func getOriginPrice(ladderPriceStr string) (ladderPrice []OriginPrice) {
return
}
// 获取原始价格
func
getDatabasePrice
(
ladderPriceStr
string
)
(
ladderPrice
[]
DatabasePrice
)
{
ladderPriceArr
:=
gjson
.
Parse
(
ladderPriceStr
)
.
Array
()
for
_
,
price
:=
range
ladderPriceArr
{
ladderPrice
=
append
(
ladderPrice
,
DatabasePrice
{
Purchases
:
price
.
Get
(
"purchases"
)
.
Int
(),
PriceUs
:
price
.
Get
(
"price_us"
)
.
Float
(),
PriceCn
:
price
.
Get
(
"price_cn"
)
.
Float
(),
PriceAc
:
price
.
Get
(
"price_ac"
)
.
Float
(),
CostPrice
:
price
.
Get
(
"cost_price"
)
.
Float
(),
})
}
if
len
(
ladderPrice
)
==
0
{
ladderPrice
=
[]
DatabasePrice
{}
return
}
return
}
service/service_ly_common.go
View file @
76981993
...
...
@@ -270,6 +270,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
var
data
[]
model
.
LadderPrice
var
originalPrice
[]
model
.
OriginPrice
sort
.
Sort
(
sorter
.
OriginPriceSorter
(
sku
.
OriginalPrice
))
//专卖价格获取
if
sku
.
SupplierId
==
17
{
ladderPrice
:=
sku
.
LadderPrice
...
...
@@ -287,6 +288,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
data
=
make
([]
model
.
LadderPrice
,
len
(
ladderPrice
))
sku
=
priceService
.
TransformSpecialSupplierPrice
(
sku
)
for
key
,
price
:=
range
ladderPrice
{
if
price
.
Purchases
==
0
{
continue
...
...
service/service_price.go
View file @
76981993
...
...
@@ -655,7 +655,6 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
}
else
{
currencyConfig
,
_
=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"magic_cube_supplier_currency"
,
sku
.
Canal
))
}
sku
.
DatabasePrice
=
sku
.
OriginalPrice
hasTax
:=
false
symbol
:=
"$"
if
currencyConfig
!=
""
{
...
...
@@ -679,9 +678,9 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
priceUs
=
c
.
MyRound
(
c
.
DivFloat
(
priceUs
,
1.13
),
4
)
}
sku
.
LadderPrice
[
index
]
.
PriceUs
=
priceUs
sku
.
OriginalPrice
[
index
]
.
PriceUs
=
priceUs
}
}
sku
.
OriginCurrencySymbol
=
symbol
return
sku
}
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