|
|
|
@ -6,6 +6,7 @@ import (
|
|
|
|
|
"git.oa00.com/supply-chain/service/lib/bean"
|
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
|
"github.com/smallnest/rpcx/share"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type sku struct {
|
|
|
|
@ -58,11 +59,13 @@ type SkuItem struct {
|
|
|
|
|
CreatedAt int64 `json:"createdAt"`
|
|
|
|
|
UpdatedAt int64 `json:"updatedAt"`
|
|
|
|
|
Highlight SkuItemHighlight `json:"highlight"`
|
|
|
|
|
Tag []string `json:"tag"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ReplySkuList struct {
|
|
|
|
|
Lists []SkuItem `json:"lists"`
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
Lists []SkuItem `json:"lists"`
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
ScrollId string `json:"scrollId"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Lists @Title 商品列表
|
|
|
|
@ -98,12 +101,14 @@ type SkuEsSearch struct {
|
|
|
|
|
Source uint // 所属供应商
|
|
|
|
|
ThirdCategoryIds []uint // 三级分类Ids
|
|
|
|
|
TagIds []uint // 标签Ids
|
|
|
|
|
Tag []string // 标签
|
|
|
|
|
|
|
|
|
|
OrderType uint // 排序类型
|
|
|
|
|
OrderSort uint // 排序顺序
|
|
|
|
|
}
|
|
|
|
|
type SkuEsConfig struct {
|
|
|
|
|
Highlight bool
|
|
|
|
|
Scroll time.Duration
|
|
|
|
|
}
|
|
|
|
|
type ArgsSkuListsEs struct {
|
|
|
|
|
Search SkuEsSearch
|
|
|
|
@ -121,6 +126,21 @@ func (s *sku) ListsEs(ctx context.Context, channelId string, args ArgsSkuListsEs
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ArgsSkuListsEsScroll struct {
|
|
|
|
|
Scroll time.Duration // 缓存时间
|
|
|
|
|
ScrollId string // 滚动标记id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ListsEsScroll @Title es商品列表 目前最大10000条数据,超出不显示
|
|
|
|
|
func (s *sku) ListsEsScroll(ctx context.Context, channelId string, args ArgsSkuListsEsScroll) (reply ReplySkuList, err error) {
|
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "ListsEsScroll", args, &reply)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ArgsSkuDetails struct {
|
|
|
|
|
SkuIds []uint // sku数组
|
|
|
|
|
}
|
|
|
|
@ -154,6 +174,7 @@ type SkuDetailItem struct {
|
|
|
|
|
Imgs []SkuImg `json:"imgs"`
|
|
|
|
|
Specifications []SkuSpecification `json:"specifications"`
|
|
|
|
|
GroupSkuIds []uint `json:"groupSkuIds"`
|
|
|
|
|
Tag []string `json:"tag"`
|
|
|
|
|
}
|
|
|
|
|
type SkuImg struct {
|
|
|
|
|
Path string `json:"path"`
|
|
|
|
|