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
ec5a7457
authored
Apr 07, 2023
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'ysx-rs价格问题-20230407' into dev
parents
01cd9800
5bab8b4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
service/service_price.go
service/service_zy_common.go
service/service_price.go
View file @
ec5a7457
package
service
package
service
import
(
import
(
"fmt"
"go_sku_server/model"
"go_sku_server/model"
c
"go_sku_server/pkg/common"
c
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
"go_sku_server/pkg/gredis"
...
@@ -235,22 +234,17 @@ func getMouserActivityPrice(sku model.LySku) model.LySku {
...
@@ -235,22 +234,17 @@ func getMouserActivityPrice(sku model.LySku) model.LySku {
func
(
ls
*
LyService
)
TransformSpecialSupplierPrice
(
supplierId
int64
,
priceUs
float64
,
usRatio
float64
)
float64
{
func
(
ls
*
LyService
)
TransformSpecialSupplierPrice
(
supplierId
int64
,
priceUs
float64
,
usRatio
float64
)
float64
{
switch
supplierId
{
switch
supplierId
{
case
6
:
case
6
:
fmt
.
Println
(
"特殊处理,原始美金价为 : "
,
priceUs
)
customRate
:=
7.85
//港币转美金
customRate
:=
7.85
//港币转美金
priceUs
=
c
.
MyRound
(
c
.
DivFloat
(
priceUs
,
customRate
),
4
)
priceUs
=
c
.
MyRound
(
c
.
DivFloat
(
priceUs
,
customRate
),
4
)
fmt
.
Println
(
"特殊处理后的美金价为 : "
,
priceUs
)
break
break
case
21
:
case
21
:
fmt
.
Println
(
"特殊处理,原始美金价为 : "
,
priceUs
)
customRate
:=
usRatio
//人民币转美金
customRate
:=
usRatio
//人民币转美金
priceUs
=
c
.
MyRound
(
c
.
DivFloat
(
priceUs
,
customRate
),
4
)
priceUs
=
c
.
MyRound
(
c
.
DivFloat
(
priceUs
,
customRate
),
4
)
fmt
.
Println
(
"特殊处理后的美金价为 : "
,
priceUs
)
priceUs
=
c
.
MyRound
(
c
.
DivFloat
(
priceUs
,
1.13
),
4
)
break
break
case
1676
:
case
1676
:
fmt
.
Println
(
"特殊处理,原始美金价为 : "
,
priceUs
)
customRate
:=
0.93
//欧元转美金
customRate
:=
0.93
//欧元转美金
priceUs
=
c
.
MyRound
(
c
.
DivFloat
(
priceUs
,
customRate
),
4
)
priceUs
=
c
.
MyRound
(
c
.
DivFloat
(
priceUs
,
customRate
),
4
)
fmt
.
Println
(
"特殊处理后的美金价为 : "
,
priceUs
)
break
break
}
}
return
priceUs
return
priceUs
...
...
service/service_zy_common.go
View file @
ec5a7457
...
@@ -3,6 +3,7 @@ package service
...
@@ -3,6 +3,7 @@ package service
import
(
import
(
"go_sku_server/model"
"go_sku_server/model"
"go_sku_server/pkg/common"
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"github.com/gomodule/redigo/redis"
"github.com/gomodule/redigo/redis"
...
@@ -50,10 +51,21 @@ func (qs *ZiyingService) ActivityPrice(ctx *gin.Context, SkuInfo string) *ordere
...
@@ -50,10 +51,21 @@ func (qs *ZiyingService) ActivityPrice(ctx *gin.Context, SkuInfo string) *ordere
//获取活动相关信息
//获取活动相关信息
func
(
qs
*
ZiyingService
)
GetActivity
(
skuInfo
string
)
(
priceActivity
model
.
PriceActivity
,
giftActivity
model
.
GiftActivity
)
{
func
(
qs
*
ZiyingService
)
GetActivity
(
skuInfo
string
)
(
priceActivity
model
.
PriceActivity
,
giftActivity
model
.
GiftActivity
)
{
//去判断是否有活动(促销打折活动和满赠活动)
//去判断是否有活动(促销打折活动和满赠活动)
var
standardBrandId
int
spuId
:=
gjson
.
Get
(
skuInfo
,
"spu_id"
)
.
String
()
redisCon
:=
gredis
.
Conn
(
"default_r"
)
spuStr
,
_
:=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"spu"
,
spuId
))
defer
redisCon
.
Close
()
if
spuStr
==
""
{
standardBrandId
=
0
}
else
{
brandId
:=
gjson
.
Get
(
spuStr
,
"brand_id"
)
.
Int
()
standardBrandId
,
_
=
redis
.
Int
(
redisCon
.
Do
(
"HGET"
,
"standard_brand_mapping"
,
brandId
))
}
checkData
:=
model
.
ActivityCheckData
{
checkData
:=
model
.
ActivityCheckData
{
SupplierId
:
10000
,
SupplierId
:
10000
,
BrandId
:
int
(
gjson
.
Get
(
skuInfo
,
"brand_id"
)
.
Int
()),
BrandId
:
int
(
gjson
.
Get
(
skuInfo
,
"brand_id"
)
.
Int
()),
StandardBrandId
:
int
(
gjson
.
Get
(
skuInfo
,
"standard_brand.standard_brand_id"
)
.
Int
())
,
StandardBrandId
:
standardBrandId
,
GoodsId
:
gjson
.
Get
(
skuInfo
,
"goods_id"
)
.
String
(),
GoodsId
:
gjson
.
Get
(
skuInfo
,
"goods_id"
)
.
String
(),
ClassId
:
int
(
gjson
.
Get
(
skuInfo
,
"class_id2"
)
.
Int
()),
ClassId
:
int
(
gjson
.
Get
(
skuInfo
,
"class_id2"
)
.
Int
()),
}
}
...
...
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