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
56c2b210
authored
Sep 05, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'ysx-商品活动价逻辑修改-20230823'
parents
94765a4c
0481f707
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
6 deletions
model/activity.go
service/service_activity.go
service/service_ly.go
service/service_ly_common.go
service/service_price.go
service/service_zy_common.go
model/activity.go
View file @
56c2b210
...
...
@@ -44,6 +44,7 @@ type Activity struct {
ExcludeStandardBrandIdList
[]
string
CurrencyRmb
int
`json:"currency_rmb"`
CurrencyUs
int
`json:"currency_us"`
UseType
int
`json:"use_type"`
}
type
ActivityItem
struct
{
...
...
@@ -58,9 +59,10 @@ type ActivityItem struct {
AddTime
int
`json:"add_time"`
}
//用于检查是否有活动情况的结构体
//
用于检查是否有活动情况的结构体
type
ActivityCheckData
struct
{
SupplierId
int
GoodsName
string
BrandId
int
StandardBrandId
int
GoodsId
string
...
...
service/service_activity.go
View file @
56c2b210
This diff is collapsed.
Click to expand it.
service/service_ly.go
View file @
56c2b210
...
...
@@ -211,6 +211,7 @@ func (ls *LyService) GetActivity(sku model.LySku) model.LySku {
GoodsId
:
sku
.
GoodsId
,
Canal
:
sku
.
Canal
,
ClassId
:
sku
.
ClassID2
,
GoodsName
:
sku
.
GoodsName
,
}
var
activityService
ActivityService
priceActivity
,
giftActivity
:=
activityService
.
GetActivityData
(
checkData
)
...
...
service/service_ly_common.go
View file @
56c2b210
...
...
@@ -294,11 +294,14 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
priceUs
:=
c
.
MyRound
(
price
.
PriceUs
,
4
)
priceUs
=
c
.
MyRound
(
c
.
MulFloat
(
price
.
PriceUs
,
sku
.
DiscountRatio
.
RatioUsd
),
4
)
data
[
key
]
.
PriceUs
=
priceUs
price
.
PriceAcUs
=
priceUs
}
if
price
.
PriceCn
!=
0
{
priceCn
:=
c
.
MyRound
(
price
.
PriceCn
,
4
)
priceCn
=
c
.
MyRound
(
c
.
MulFloat
(
price
.
PriceCn
,
sku
.
DiscountRatio
.
Ratio
),
4
)
data
[
key
]
.
PriceCn
=
priceCn
price
.
PriceCn
=
priceCn
}
//专卖成本价
...
...
service/service_price.go
View file @
56c2b210
...
...
@@ -93,6 +93,7 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku {
if
brandIds
!=
""
{
hasSpecialCheck
=
true
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
","
)
//fmt.Println(standardBrandIdList)
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
//找到有对应的品牌,那么优先级肯定是最高的了
if
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
...
...
service/service_zy_common.go
View file @
56c2b210
...
...
@@ -38,7 +38,7 @@ func (qs *ZiyingService) skuLockNum(c *redis.Conn, goodsId string) int64 {
}
/*
获取自营活动价
获取自营活动价
*/
func
(
qs
*
ZiyingService
)
ActivityPrice
(
ctx
*
gin
.
Context
,
SkuInfo
string
)
*
orderedmap
.
OrderedMap
{
data
:=
qs
.
HDActivityPrice
(
SkuInfo
)
...
...
@@ -48,7 +48,7 @@ func (qs *ZiyingService) ActivityPrice(ctx *gin.Context, SkuInfo string) *ordere
return
nil
}
//获取活动相关信息
//
获取活动相关信息
func
(
qs
*
ZiyingService
)
GetActivity
(
skuInfo
string
)
(
priceActivity
model
.
PriceActivity
,
giftActivity
model
.
GiftActivity
)
{
//去判断是否有活动(促销打折活动和满赠活动)
var
standardBrandId
int
...
...
@@ -72,6 +72,7 @@ func (qs *ZiyingService) GetActivity(skuInfo string) (priceActivity model.PriceA
StandardBrandId
:
standardBrandId
,
GoodsId
:
gjson
.
Get
(
skuInfo
,
"goods_id"
)
.
String
(),
ClassId
:
int
(
gjson
.
Get
(
skuInfo
,
"class_id2"
)
.
Int
()),
GoodsName
:
gjson
.
Get
(
skuInfo
,
"goods_name"
)
.
String
(),
}
var
activityService
ActivityService
priceActivity
,
giftActivity
=
activityService
.
GetActivityData
(
checkData
)
...
...
@@ -79,13 +80,12 @@ func (qs *ZiyingService) GetActivity(skuInfo string) (priceActivity model.PriceA
}
/*
计算活动价
计算活动价
ac_type说明: 0 没有活动
活动名称 ac_type 类型
自营系数 6 自营
折扣(系数)活动 10 自营/联营
*/
func
(
qs
*
ZiyingService
)
HDActivityPrice
(
SkuInfo
string
)
*
orderedmap
.
OrderedMap
{
priceActivity
,
giftActivity
:=
qs
.
GetActivity
(
SkuInfo
)
...
...
@@ -132,7 +132,7 @@ func (qs *ZiyingService) HDActivityPrice(SkuInfo string) *orderedmap.OrderedMap
}
/*
获取当前锁住的库存
获取当前锁住的库存
*/
func
(
qs
*
ZiyingService
)
HDGoodsLimit
(
SkuID
string
,
Stock
string
,
c
*
redis
.
Conn
)
*
orderedmap
.
OrderedMap
{
...
...
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