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
a23205fa
authored
Sep 08, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
币种符号
parent
08c68818
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
model/goods.go
model/ly_sku.go
service/service_price.go
model/goods.go
View file @
a23205fa
package
model
//联营统一返回格式
//
联营统一返回格式
type
LyResponse
struct
{
ErrorCode
int
`json:"error_code"`
ErrorMsg
string
`json:"error_msg"`
Data
interface
{}
`json:"data"`
}
//原始sku梯度
//
原始sku梯度
type
LadderPrice
struct
{
Purchases
int64
`json:"purchases"`
//购买数量
PriceUs
float64
`json:"price_us,omitempty"`
//数量对应的英文价格
...
...
@@ -27,13 +27,13 @@ type OriginPrice struct {
CostPrice
float64
`json:"cost_price"`
}
//立创价格梯度
//
立创价格梯度
type
LadderPriceLc
struct
{
Purchases
int64
`json:"purchases"`
//购买数量
Price
float64
`json:"price"`
//立创价格,人民币
}
//自营属性列表
//
自营属性列表
type
Attrs
struct
{
AttrName
string
`json:"attr_name"`
//属性名称
AttrValue
string
`json:"attr_value"`
//属性值
...
...
model/ly_sku.go
View file @
a23205fa
...
...
@@ -69,17 +69,18 @@ type LySku struct {
AcType
int
`json:"ac_type"`
//活动信息
HasGiftActivity
int
`json:"has_gift_activity"`
GiftActivity
GiftActivity
`json:"gift_activity"`
ActivityInfo
PriceActivity
`json:"activity_info"`
StandardBrand
StandardBrand
`json:"standard_brand"`
GoodsTag
GoodsTag
`json:"goods_tag"`
StockInfo
interface
{}
`json:"stock_info"`
Eccn
string
`json:"eccn"`
DiscountRatio
DiscountRatio
`json:"discount_ratio"`
PriceRatioSort
int
`json:"price_ratio_sort"`
PriceRatio
[]
PriceRatio
`json:"price_ratio"`
Source
int
`json:"source"`
HasGiftActivity
int
`json:"has_gift_activity"`
GiftActivity
GiftActivity
`json:"gift_activity"`
ActivityInfo
PriceActivity
`json:"activity_info"`
StandardBrand
StandardBrand
`json:"standard_brand"`
GoodsTag
GoodsTag
`json:"goods_tag"`
StockInfo
interface
{}
`json:"stock_info"`
Eccn
string
`json:"eccn"`
DiscountRatio
DiscountRatio
`json:"discount_ratio"`
PriceRatioSort
int
`json:"price_ratio_sort"`
PriceRatio
[]
PriceRatio
`json:"price_ratio"`
Source
int
`json:"source"`
OriginCurrencySymbol
string
`json:"origin_currency_symbol,omitempty"`
}
type
DiscountRatio
struct
{
...
...
service/service_price.go
View file @
a23205fa
...
...
@@ -655,12 +655,14 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
}
sku
.
DatabasePrice
=
sku
.
OriginalPrice
hasTax
:=
false
symbol
:=
""
if
currencyConfig
!=
""
{
currency
=
int
(
gjson
.
Get
(
currencyConfig
,
"currency"
)
.
Int
())
if
currency
==
0
{
return
sku
}
hasTax
=
gjson
.
Get
(
currencyConfig
,
"has_tax"
)
.
Bool
()
symbol
=
gjson
.
Get
(
currencyConfig
,
"symbol"
)
.
String
()
//这里进行转换,因为这里都只能取到对应的币种转人民币的比率,我们没有直接各种币种转美金的数据,所以我这边要
//先根据对应币种转人民币,然后根据人民币转美金,才能得到不同币种对应美金的汇率
rmbRatio
,
_
:=
redis
.
Float64
(
redisCon
.
Do
(
"HGET"
,
"erp_rate"
,
currency
))
...
...
@@ -669,7 +671,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
//人民币汇率转美金汇率
usRatio
=
c
.
MyRound
(
c
.
DivFloat
(
rmbRatio
,
usRatio
),
10
)
}
sku
.
OriginCurrencySymbol
=
symbol
for
index
,
price
:=
range
sku
.
LadderPrice
{
priceUs
:=
price
.
PriceUs
priceUs
=
c
.
MyRound
(
c
.
MulFloat
(
priceUs
,
usRatio
),
4
)
...
...
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