pdd物料
This commit is contained in:
@@ -2015,7 +2015,7 @@ func ShareUnionLink(ctx *jxcontext.Context, jobID, shareType, linkType, resource
|
|||||||
if link, err = handler.ShareUnionLink(ctx, linkType, job.UnionActID, sid, userID, resourceType); err == nil {
|
if link, err = handler.ShareUnionLink(ctx, linkType, job.UnionActID, sid, userID, resourceType); err == nil {
|
||||||
if vendorID == model.VendorIDMTWM || vendorID == model.VendorIDTB {
|
if vendorID == model.VendorIDMTWM || vendorID == model.VendorIDTB {
|
||||||
if linkType == partner.LinkTypeWeiXinMini {
|
if linkType == partner.LinkTypeWeiXinMini {
|
||||||
if resBinary, _, err := jxutils.DownloadFileByURL(link + "?imageView2/1/w/150/h/150/q/75"); err == nil {
|
if resBinary, _, err := jxutils.DownloadFileByURL(link + "?imageView2/1/w/100/h/100/q/75"); err == nil {
|
||||||
if downloadURL, err := jxutils.UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+link[strings.LastIndex(link, "/")+1:len(link)]); err == nil {
|
if downloadURL, err := jxutils.UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+link[strings.LastIndex(link, "/")+1:len(link)]); err == nil {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
link = jxutils.MixWatermarkImg(downloadURL, job.UnionImg, job.UnionQrcodePosition)
|
link = jxutils.MixWatermarkImg(downloadURL, job.UnionImg, job.UnionQrcodePosition)
|
||||||
@@ -2067,3 +2067,8 @@ func GetUnionJobOrderInfo(ctx *jxcontext.Context, jobOrderID int) (getUnionJobOr
|
|||||||
getUnionJobOrderInfoResult.IncomePrice = incomeTotal
|
getUnionJobOrderInfoResult.IncomePrice = incomeTotal
|
||||||
return getUnionJobOrderInfoResult, err
|
return getUnionJobOrderInfoResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetVendorMatters(ctx *jxcontext.Context, vendorID int, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (result *partner.MatterList, err error) {
|
||||||
|
handler := partner.GetHandler(vendorID)
|
||||||
|
return handler.GetUnionMatterList(ctx, vendorCatID, keyword, page, pageSize, sortType, listID)
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
partner.HandlerMap[model.VendorIDJDShop] = unionHandler
|
partner.UnionHandlerMap[model.VendorIDJDShop] = unionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error) {
|
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error) {
|
||||||
@@ -29,3 +29,7 @@ func (s *UnionHandler) GetUnionActList(ctx *jxcontext.Context, actType int) (act
|
|||||||
func (s *UnionHandler) CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error) {
|
func (s *UnionHandler) CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error) {
|
||||||
return sID, err
|
return sID, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *UnionHandler) GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (list *partner.MatterList, err error) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
partner.HandlerMap[model.VendorIDMTWM] = unionHandler
|
partner.UnionHandlerMap[model.VendorIDMTWM] = unionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAPI() (apiobj *mtunionapi.API) {
|
func getAPI() (apiobj *mtunionapi.API) {
|
||||||
|
|||||||
@@ -48,3 +48,7 @@ func (s *UnionHandler) GetUnionActList(ctx *jxcontext.Context, actType int) (act
|
|||||||
func (s *UnionHandler) CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error) {
|
func (s *UnionHandler) CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error) {
|
||||||
return sID, err
|
return sID, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *UnionHandler) GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (list *partner.MatterList, err error) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
HandlerMap map[int]UnionInterface
|
UnionHandlerMap map[int]UnionInterface
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,6 +21,11 @@ const (
|
|||||||
ShareTypeOwn = 2 //自己领
|
ShareTypeOwn = 2 //自己领
|
||||||
|
|
||||||
MtUnionJxSID = "000000001"
|
MtUnionJxSID = "000000001"
|
||||||
|
|
||||||
|
//排序参数,正数升序,负数倒序
|
||||||
|
JxSortTypeYJ = 1 //佣金比
|
||||||
|
JxSortTypeXL = 2 //销量
|
||||||
|
JxSortTypeJG = 3 //价格
|
||||||
)
|
)
|
||||||
|
|
||||||
type UnionOrderInfo struct {
|
type UnionOrderInfo struct {
|
||||||
@@ -40,17 +45,35 @@ type ActivityList struct {
|
|||||||
Img string `json:"img"` //活动图
|
Img string `json:"img"` //活动图
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GoodsList struct {
|
||||||
|
GoodsID string `json:"goodsID"`
|
||||||
|
GoodsName string `json:"goodsName"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
CouponDiscount int `json:"couponDiscount"` //优惠券
|
||||||
|
CouponRemainQuantity int `json:"couponRemainQuantity"` //优惠券剩余数量
|
||||||
|
MinNormalPrice int `json:"minNormalPrice"` //最小购买价格
|
||||||
|
SalesCount string `json:"salesCount"` //销量
|
||||||
|
PromotionRate int `json:"promotionRate"` //佣金比例,千分比
|
||||||
|
}
|
||||||
|
|
||||||
|
type MatterList struct {
|
||||||
|
GoodsList []*GoodsList
|
||||||
|
VendorID int `json:"vendorID"`
|
||||||
|
ListID string `json:"listID"`
|
||||||
|
TotalCount int `json:"totalCount"`
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
HandlerMap = make(map[int]UnionInterface)
|
UnionHandlerMap = make(map[int]UnionInterface)
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnionInterface interface {
|
type UnionInterface interface {
|
||||||
ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error)
|
ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error)
|
||||||
GetUnionActList(ctx *jxcontext.Context, actType int) (result []*ActivityList, err error)
|
GetUnionActList(ctx *jxcontext.Context, actType int) (result []*ActivityList, err error)
|
||||||
CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error)
|
CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error)
|
||||||
//GetUnionCouponList(ctx *jxcontext.Context)
|
GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (result *MatterList, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetHandler(vendorID int) UnionInterface {
|
func GetHandler(vendorID int) UnionInterface {
|
||||||
return HandlerMap[vendorID]
|
return UnionHandlerMap[vendorID]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
partner.HandlerMap[model.VendorIDPDD] = unionHandler
|
partner.UnionHandlerMap[model.VendorIDPDD] = unionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAPI() (apiobj *pddapi.API) {
|
func getAPI() (apiobj *pddapi.API) {
|
||||||
|
|||||||
@@ -2,12 +2,26 @@ package pdd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/pddapi"
|
||||||
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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) {
|
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 {
|
if result, err := api.PddAPI.ResourceURLGen(sID, resourceType); err == nil {
|
||||||
switch linkType {
|
switch linkType {
|
||||||
@@ -49,3 +63,46 @@ func (s *UnionHandler) CreateUnionPosition(ctx *jxcontext.Context, userID string
|
|||||||
}
|
}
|
||||||
return sID, err
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
partner.HandlerMap[model.VendorIDTB] = unionHandler
|
partner.UnionHandlerMap[model.VendorIDTB] = unionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAPI() (apiobj *tbunionapi.API) {
|
func getAPI() (apiobj *tbunionapi.API) {
|
||||||
|
|||||||
@@ -46,3 +46,7 @@ func (s *UnionHandler) GetUnionActList(ctx *jxcontext.Context, actType int) (act
|
|||||||
func (s *UnionHandler) CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error) {
|
func (s *UnionHandler) CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error) {
|
||||||
return sID, err
|
return sID, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *UnionHandler) GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (list *partner.MatterList, err error) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ type VendorMatterCategory struct {
|
|||||||
ModelIDCULD
|
ModelIDCULD
|
||||||
|
|
||||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||||
CategoryID int `orm:"column(category_id)" json:"categoryID"`
|
CategoryID string `orm:"column(category_id)" json:"categoryID"`
|
||||||
CategoryName string `json:"categoryName"`
|
CategoryName string `json:"categoryName"`
|
||||||
ParentID int `orm:"column(parent_id)" json:"parentID"`
|
ParentID int `orm:"column(parent_id)" json:"parentID"`
|
||||||
Level int `json:"level"`
|
Level int `json:"level"`
|
||||||
|
|||||||
@@ -610,3 +610,23 @@ func (c *JobController) GetVendorMatterCategory() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 查询平台物料
|
||||||
|
// @Description 查询平台物料
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param vendorID query int true "平台ID"
|
||||||
|
// @Param vendorCatID query string false "平台分类ID"
|
||||||
|
// @Param keyword query string false "关键字"
|
||||||
|
// @Param page query int false "页码"
|
||||||
|
// @Param pageSize query int false "页大小"
|
||||||
|
// @Param listID query string false "分页用"
|
||||||
|
// @Param sortType query int false "排序类型"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @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)
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -628,6 +628,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: 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: "GetVendorMatters",
|
||||||
|
Router: "/GetVendorMatters",
|
||||||
|
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.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "SubmitJob",
|
Method: "SubmitJob",
|
||||||
|
|||||||
Reference in New Issue
Block a user