pdd物料
This commit is contained in:
@@ -16,7 +16,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
partner.HandlerMap[model.VendorIDPDD] = unionHandler
|
||||
partner.UnionHandlerMap[model.VendorIDPDD] = unionHandler
|
||||
}
|
||||
|
||||
func getAPI() (apiobj *pddapi.API) {
|
||||
|
||||
@@ -2,12 +2,26 @@ package pdd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/pddapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/partner"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
var (
|
||||
sortTypeMap = map[int]int{
|
||||
0: 0, //综合排序
|
||||
partner.JxSortTypeYJ: 1, //按佣金比率升序;
|
||||
-partner.JxSortTypeYJ: 2, //按佣金比例降序;
|
||||
partner.JxSortTypeJG: 3, //按价格升序;
|
||||
-partner.JxSortTypeJG: 4, //按价格降序;
|
||||
partner.JxSortTypeXL: 5, //按销量升序;
|
||||
-partner.JxSortTypeXL: 6, //按销量降序;
|
||||
}
|
||||
)
|
||||
|
||||
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error) {
|
||||
if result, err := api.PddAPI.ResourceURLGen(sID, resourceType); err == nil {
|
||||
switch linkType {
|
||||
@@ -49,3 +63,46 @@ func (s *UnionHandler) CreateUnionPosition(ctx *jxcontext.Context, userID string
|
||||
}
|
||||
return sID, err
|
||||
}
|
||||
|
||||
func jxSortType2PddSortType(jxSortType int) (sortType int) {
|
||||
return sortTypeMap[jxSortType]
|
||||
}
|
||||
|
||||
func (s *UnionHandler) GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (list *partner.MatterList, err error) {
|
||||
var (
|
||||
goodsList []*partner.GoodsList
|
||||
)
|
||||
params := &pddapi.GoodsSearchParam{
|
||||
CatID: utils.Str2Int(vendorCatID),
|
||||
Keyword: keyword,
|
||||
Page: page,
|
||||
PageSize: pageSize,
|
||||
SortType: jxSortType2PddSortType(sortType),
|
||||
ListID: listID,
|
||||
}
|
||||
//-1表示是拼多多的精选
|
||||
if vendorCatID == "-1" {
|
||||
params.ActivityTags = []int{pddapi.GoodsActTagBYBT, pddapi.GoodsActTagJXBK, pddapi.GoodsActTagMS, pddapi.GoodsActTagPPGY, pddapi.GoodsActTagPPHB, pddapi.GoodsActTagQWBT, pddapi.GoodsActTagTZTJ}
|
||||
}
|
||||
if goods, err2 := api.PddAPI.GoodsSearch(params); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
list.ListID = goods.ListID
|
||||
list.TotalCount = goods.TotalCount
|
||||
list.VendorID = model.VendorIDPDD
|
||||
for _, v := range goods.GoodsList {
|
||||
good := &partner.GoodsList{
|
||||
GoodsID: v.GoodsSign,
|
||||
GoodsName: v.GoodsName,
|
||||
Img: v.GoodsThumbnailURL,
|
||||
CouponDiscount: v.CouponDiscount,
|
||||
CouponRemainQuantity: v.CouponRemainQuantity,
|
||||
MinNormalPrice: v.MinNormalPrice,
|
||||
SalesCount: v.SalesTip,
|
||||
}
|
||||
goodsList = append(goodsList, good)
|
||||
}
|
||||
list.GoodsList = goodsList
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user