aa
This commit is contained in:
@@ -62,18 +62,20 @@ type GoodsDetail2 struct {
|
|||||||
StoreImg string `json:"storeImg"` //店铺图片
|
StoreImg string `json:"storeImg"` //店铺图片
|
||||||
StoreName string `json:"storeName"` //店铺名
|
StoreName string `json:"storeName"` //店铺名
|
||||||
Tpwd string `json:"tpwd"` //淘口令
|
Tpwd string `json:"tpwd"` //淘口令
|
||||||
|
UrlL string `json:"urlL"` //推广地址长链
|
||||||
|
UrlS string `json:"urlS"` //推广地址短链
|
||||||
}
|
}
|
||||||
|
|
||||||
type GoodsList struct {
|
type GoodsList struct {
|
||||||
GoodsID string `json:"goodsID"`
|
GoodsID string `json:"goodsID"`
|
||||||
GoodsName string `json:"goodsName"`
|
GoodsName string `json:"goodsName"`
|
||||||
Img string `json:"img"`
|
Img string `json:"img"`
|
||||||
CouponDiscount int `json:"couponDiscount"` //优惠券
|
CouponDiscount int `json:"couponDiscount"` //优惠券
|
||||||
CouponRemainQuantity int `json:"couponRemainQuantity"` //优惠券剩余数量
|
CouponRemainQuantity int `json:"couponRemainQuantity"` //优惠券剩余数量
|
||||||
MinNormalPrice int `json:"minNormalPrice"` //最小购买价格
|
MinNormalPrice int `json:"minNormalPrice"` //最小购买价格
|
||||||
SalesCount string `json:"salesCount"` //销量
|
SalesCount string `json:"salesCount"` //销量
|
||||||
PromotionRate int `json:"promotionRate"` //佣金比例,千分比
|
PromotionRate int `json:"promotionRate"` //佣金比例,千分比
|
||||||
GoodsDetail []*GoodsDetail2 `json:"goodsDetail"` //淘宝用
|
GoodsDetail *GoodsDetail2 `json:"goodsDetail"` //淘宝用
|
||||||
}
|
}
|
||||||
|
|
||||||
type MatterList struct {
|
type MatterList struct {
|
||||||
|
|||||||
@@ -2,10 +2,25 @@ package taobao
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/tbunionapi"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/partner"
|
"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/jxutils/jxcontext"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
sortTypeMap = map[int]string{
|
||||||
|
0: "", //综合排序
|
||||||
|
partner.JxSortTypeYJ: "tk_total_commi_asc", //按佣金比率升序;
|
||||||
|
-partner.JxSortTypeYJ: "tk_total_commi_des", //按佣金比例降序;
|
||||||
|
partner.JxSortTypeJG: "price_asc", //按价格升序;
|
||||||
|
-partner.JxSortTypeJG: "price_des", //按价格降序;
|
||||||
|
partner.JxSortTypeXL: "total_sales_asc", //按销量升序;
|
||||||
|
-partner.JxSortTypeXL: "total_sales_des", //按销量降序;
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int, goodsID string) (link string, err error) {
|
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int, goodsID string) (link string, err error) {
|
||||||
@@ -48,6 +63,47 @@ func (s *UnionHandler) CreateUnionPosition(ctx *jxcontext.Context, userID string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *UnionHandler) GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (list *partner.MatterList, err error) {
|
func (s *UnionHandler) GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (list *partner.MatterList, err error) {
|
||||||
|
list = &partner.MatterList{
|
||||||
|
VendorID: model.VendorIDTB,
|
||||||
|
}
|
||||||
|
var goodsList []*partner.GoodsList
|
||||||
|
//传了keyword就是物料搜索
|
||||||
|
//没传就是物料精选。。
|
||||||
|
if keyword != "" {
|
||||||
|
params := &tbunionapi.MaterialOptionalParam{
|
||||||
|
Q: keyword,
|
||||||
|
AdzoneID: tbunionapi.JxAdzoneID,
|
||||||
|
PageNo: page,
|
||||||
|
PageSize: pageSize,
|
||||||
|
}
|
||||||
|
if sortType != 0 {
|
||||||
|
params.Sort = jxSortType2TbunionSortType(sortType)
|
||||||
|
}
|
||||||
|
if materResults, err := api.TbUnionAPI.MaterialOptional(params); err == nil {
|
||||||
|
list.TotalCount = materResults.TotalResults
|
||||||
|
for _, v := range materResults.ResultList {
|
||||||
|
good := &partner.GoodsList{
|
||||||
|
GoodsID: utils.Int64ToStr(v.ItemID),
|
||||||
|
GoodsName: v.Title,
|
||||||
|
Img: v.PictURL,
|
||||||
|
CouponDiscount: utils.Str2Int(v.CouponAmount),
|
||||||
|
CouponRemainQuantity: v.CouponRemainCount,
|
||||||
|
MinNormalPrice: utils.Str2Int(v.ReservePrice),
|
||||||
|
SalesCount: utils.Int2Str(v.Volume),
|
||||||
|
PromotionRate: utils.Str2Int(v.CommissionRate),
|
||||||
|
}
|
||||||
|
good.GoodsDetail.MainImg = v.WhiteImage
|
||||||
|
good.GoodsDetail.StoreName = v.ShopTitle
|
||||||
|
good.GoodsDetail.Imgs = strings.Join(v.SmallImages, ",")
|
||||||
|
goodsList = append(goodsList, good)
|
||||||
|
}
|
||||||
|
list.GoodsList = goodsList
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if materResults, err := api.TbUnionAPI.OptimusMaterial(utils.Str2Int(vendorCatID), tbunionapi.JxAdzoneID, page, pageSize); err == nil {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,3 +114,7 @@ func (s *UnionHandler) GetUnionMatterDetail(ctx *jxcontext.Context, goodsID stri
|
|||||||
func (s *UnionHandler) GetUnionMatterListRcmmd(ctx *jxcontext.Context, goodsID string, rcmmdType, offset, pageSize int) (result *partner.MatterList, err error) {
|
func (s *UnionHandler) GetUnionMatterListRcmmd(ctx *jxcontext.Context, goodsID string, rcmmdType, offset, pageSize int) (result *partner.MatterList, err error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func jxSortType2TbunionSortType(sort int) (tbsort string) {
|
||||||
|
return sortTypeMap[sort]
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user