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
caa83cd8
authored
Sep 11, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
去掉特殊屏蔽以及排序价格
parent
a2f760d9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
12 deletions
model/ly_sku.go
service/service_ly.go
service/service_ly_common.go
service/sorter/origin_price.go
model/ly_sku.go
View file @
caa83cd8
...
...
@@ -39,8 +39,8 @@ type LySku struct {
AllowCoupon
int
`json:"allow_coupon"`
BrandId
int64
`json:"brand_id"`
//系数相关
Coefficient
interface
{}
`json:"coefficient,omitempty"`
OriginalPrice
interface
{}
`json:"original_price,omitempty"`
Coefficient
interface
{}
`json:"coefficient,omitempty"`
OriginalPrice
[]
OriginPrice
`json:"original_price,omitempty"`
//数据库存的价格,因为数据库存的是什么币种都有可能,但是也要展示数据库存的,所以要有这个字段
DatabasePrice
interface
{}
`json:"database_price,omitempty"`
SuppExtendFee
interface
{}
`json:"supp_extend_fee"`
...
...
@@ -277,5 +277,6 @@ func getOriginPrice(ladderPriceStr string) (ladderPrice []OriginPrice) {
ladderPrice
=
[]
OriginPrice
{}
return
}
return
}
service/service_ly.go
View file @
caa83cd8
...
...
@@ -172,21 +172,11 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//判断是否可以购买
sku
.
IsBuy
=
ls
.
GetIsBuy
(
sku
)
//过期修改库存为0
if
sku
.
IsExpire
==
1
&&
sku
.
SupplierId
!=
17
{
sku
.
Stock
=
0
}
//特殊判断,如果是罗侧斯特的ADI的商品,价格为0,库存为0
if
sku
.
StandardBrand
.
StandardBrandId
==
8
&&
sku
.
SupplierId
==
3
{
sku
.
Stock
=
0
sku
.
LadderPriceResult
=
[]
int
{}
sku
.
IsBuy
=
0
sku
.
BatchSn
=
""
sku
.
Attrs
=
[]
int
{}
}
//获取标签信息
var
TagService
TagsService
sku
.
GoodsTag
=
TagService
.
GetTags
(
sku
.
GoodsId
,
0
)
...
...
service/service_ly_common.go
View file @
caa83cd8
...
...
@@ -11,7 +11,9 @@ import (
"go_sku_server/pkg/gredis"
"go_sku_server/pkg/logger"
_
"go_sku_server/pkg/mongo"
"go_sku_server/service/sorter"
_
"gopkg.in/mgo.v2/bson"
"sort"
"strings"
)
...
...
@@ -267,6 +269,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
flag
:=
0
var
data
[]
model
.
LadderPrice
var
originalPrice
[]
model
.
OriginPrice
sort
.
Sort
(
sorter
.
OriginPriceSorter
(
sku
.
OriginalPrice
))
//专卖价格获取
if
sku
.
SupplierId
==
17
{
ladderPrice
:=
sku
.
LadderPrice
...
...
service/sorter/origin_price.go
0 → 100644
View file @
caa83cd8
package
sorter
import
"go_sku_server/model"
// 阶梯价格排序算法
type
OriginPriceSorter
[]
model
.
OriginPrice
func
(
a
OriginPriceSorter
)
Len
()
int
{
return
len
(
a
)
}
func
(
a
OriginPriceSorter
)
Swap
(
i
,
j
int
)
{
a
[
i
],
a
[
j
]
=
a
[
j
],
a
[
i
]
}
func
(
a
OriginPriceSorter
)
Less
(
i
,
j
int
)
bool
{
return
a
[
j
]
.
Purchases
>
a
[
i
]
.
Purchases
}
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