pdd物料推荐

This commit is contained in:
suyl
2021-04-27 17:09:42 +08:00
parent 13d2b1b883
commit b65e808972
8 changed files with 78 additions and 4 deletions

View File

@@ -2068,12 +2068,17 @@ func GetUnionJobOrderInfo(ctx *jxcontext.Context, jobOrderID int) (getUnionJobOr
return getUnionJobOrderInfoResult, err
}
func GetVendorMatters(ctx *jxcontext.Context, vendorID int, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (result *partner.MatterList, err error) {
func GetVendorMatters(ctx *jxcontext.Context, vendorID int, vendorCatID, keyword string, offset, pageSize, sortType int, listID string) (result *partner.MatterList, err error) {
handler := partner.GetHandler(vendorID)
return handler.GetUnionMatterList(ctx, vendorCatID, keyword, page, pageSize, sortType, listID)
return handler.GetUnionMatterList(ctx, vendorCatID, keyword, offset/pageSize+1, pageSize, sortType, listID)
}
func GetVendorMatterDetail(ctx *jxcontext.Context, vendorID int, goodsID string) (goodsDetail *partner.GoodsDetail, err error) {
handler := partner.GetHandler(vendorID)
return handler.GetUnionMatterDetail(ctx, goodsID)
}
func GetVendorMatterRcmmd(ctx *jxcontext.Context, vendorID int, goodsID string, rcmmdType, offset, pageSize int) (result *partner.MatterList, err error) {
handler := partner.GetHandler(vendorID)
return handler.GetUnionMatterListRcmmd(ctx, goodsID, rcmmdType, offset, pageSize)
}

View File

@@ -37,3 +37,7 @@ func (s *UnionHandler) GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, k
func (s *UnionHandler) GetUnionMatterDetail(ctx *jxcontext.Context, goodsID string) (result *partner.GoodsDetail, err error) {
return nil, err
}
func (s *UnionHandler) GetUnionMatterListRcmmd(ctx *jxcontext.Context, goodsID string, rcmmdType, offset, pageSize int) (result *partner.MatterList, err error) {
return nil, err
}

View File

@@ -56,3 +56,7 @@ func (s *UnionHandler) GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, k
func (s *UnionHandler) GetUnionMatterDetail(ctx *jxcontext.Context, goodsID string) (result *partner.GoodsDetail, err error) {
return nil, err
}
func (s *UnionHandler) GetUnionMatterListRcmmd(ctx *jxcontext.Context, goodsID string, rcmmdType, offset, pageSize int) (result *partner.MatterList, err error) {
return nil, err
}

View File

@@ -84,6 +84,7 @@ type UnionInterface interface {
CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error)
GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (result *MatterList, err error)
GetUnionMatterDetail(ctx *jxcontext.Context, goodsID string) (result *GoodsDetail, err error)
GetUnionMatterListRcmmd(ctx *jxcontext.Context, goodsID string, rcmmdType, offset, pageSize int) (result *MatterList, err error)
}
func GetHandler(vendorID int) UnionInterface {

View File

@@ -133,3 +133,32 @@ func (s *UnionHandler) GetUnionMatterDetail(ctx *jxcontext.Context, goodsID stri
}
return result, err
}
func (s *UnionHandler) GetUnionMatterListRcmmd(ctx *jxcontext.Context, goodsID string, rcmmdType, offset, pageSize int) (list *partner.MatterList, err error) {
var (
goodsList []*partner.GoodsList
)
list = &partner.MatterList{}
if goods, err2 := api.PddAPI.GoodsRecommendGet(goodsID, rcmmdType, offset, pageSize); err2 != nil {
return nil, err2
} else {
list.ListID = goods.ListID
list.TotalCount = goods.Total
list.VendorID = model.VendorIDPDD
for _, v := range goods.List {
good := &partner.GoodsList{
GoodsID: v.GoodsSign,
GoodsName: v.GoodsName,
Img: v.GoodsThumbnailURL,
CouponDiscount: v.CouponDiscount,
CouponRemainQuantity: v.CouponRemainQuantity,
MinNormalPrice: v.MinNormalPrice,
SalesCount: v.SalesTip,
PromotionRate: v.PromotionRate,
}
goodsList = append(goodsList, good)
}
list.GoodsList = goodsList
}
return nil, err
}

View File

@@ -54,3 +54,7 @@ func (s *UnionHandler) GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, k
func (s *UnionHandler) GetUnionMatterDetail(ctx *jxcontext.Context, goodsID string) (result *partner.GoodsDetail, err error) {
return nil, err
}
func (s *UnionHandler) GetUnionMatterListRcmmd(ctx *jxcontext.Context, goodsID string, rcmmdType, offset, pageSize int) (result *partner.MatterList, err error) {
return nil, err
}

View File

@@ -617,7 +617,7 @@ func (c *JobController) GetVendorMatterCategory() {
// @Param vendorID query int true "平台ID"
// @Param vendorCatID query string false "平台分类ID"
// @Param keyword query string false "关键字"
// @Param page query int false "页码"
// @Param offset query int false "页码"
// @Param pageSize query int false "页大小"
// @Param listID query string false "分页用"
// @Param sortType query int false "排序类型"
@@ -626,7 +626,7 @@ func (c *JobController) GetVendorMatterCategory() {
// @router /GetVendorMatters [get]
func (c *JobController) GetVendorMatters() {
c.callGetVendorMatters(func(params *tJobGetVendorMattersParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetVendorMatters(params.Ctx, params.VendorID, params.VendorCatID, params.Keyword, params.Page, params.PageSize, params.SortType, params.ListID)
retVal, err = cms.GetVendorMatters(params.Ctx, params.VendorID, params.VendorCatID, params.Keyword, params.Offset, params.PageSize, params.SortType, params.ListID)
return retVal, "", err
})
}
@@ -645,3 +645,21 @@ func (c *JobController) GetVendorMatterDetail() {
return retVal, "", err
})
}
// @Title 查询平台物料推荐
// @Description 查询平台物料推荐
// @Param token header string true "认证token"
// @Param vendorID query int true "平台ID"
// @Param goodsID query string true "平台商品ID"
// @Param rcmmdType query int true "推荐类型1为今日销量榜3为相似商品5为实时热销榜"
// @Param offset query int false "页码"
// @Param pageSize query int false "页大小"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetVendorMatterRcmmd [get]
func (c *JobController) GetVendorMatterRcmmd() {
c.callGetVendorMatterRcmmd(func(params *tJobGetVendorMatterRcmmdParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetVendorMatterRcmmd(params.Ctx, params.VendorID, params.GoodsID, params.RcmmdType, params.Offset, params.PageSize)
return retVal, "", err
})
}

View File

@@ -646,6 +646,15 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"],
beego.ControllerComments{
Method: "GetVendorMatterRcmmd",
Router: "/GetVendorMatterRcmmd",
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"],
beego.ControllerComments{
Method: "SubmitJob",