jd

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

jd-go - 京东联盟开发 Golang SDK(开发工具包)

travis-image License

使用方式

注意:最新版本(包括测试版)为 GitHub release

go get -u github.com/cliod/jd-go

使用Demo

公众号使用例子

j := NewJdService("<app_key>", "<app_secret>")
g := j.GetGoodsService()
res,err := g.GoodsJingfenQuery(nil)
if err != nil {
    fmt.Println(res)
}

Documentation

Overview

jd联盟go-sdk

jd联盟go-sdk

jd联盟go-sdk

Index

Constants

View Source
const (
	BaseUrl = "https://router.jd.com/api"
)

Variables

This section is empty.

Functions

func NewParameter added in v1.0.0

func NewParameter(config *Config, pj map[string]interface{}) *parameter

Types

type ActivityQueryRequest

type ActivityQueryRequest struct {
	PageIndex  uint64 `json:"pageIndex,omitempty"`  // 页码,默认1
	PageSize   uint64 `json:"pageSize,omitempty"`   // 每页数量,默认20,上限50
	PoolId     uint64 `json:"poolId,omitempty"`     // 活动物料ID,1:营销日历热门会场;2:营销日历热门榜单;6:PC站长端官方活动
	ActiveDate uint64 `json:"activeDate,omitempty"` // 按单个日期查询活动,查询日期范围为过去或未来15天。建议按日期依次查询当天及未来的活动
}

type ActivityQueryResult

type ActivityQueryResult struct {
	BaseResult
	JdUnionOpenActivityQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_activity_query_response"`
}

type BaseResult

type BaseResult struct {
	ErrorResponse struct {
		Code   string `json:"code"`
		ZhDesc string `json:"zh_desc"`
		EnDesc string `json:"en_desc"`
	} `json:"error_response"`
}

func (*BaseResult) GetResult

func (b *BaseResult) GetResult() ([]byte, error)

type CategoryGoodsGetRequest

type CategoryGoodsGetRequest struct {
	ParentId uint64 `json:"parentId"` // 父类目id(一级父类目为0)
	Grade    uint64 `json:"grade"`    // 类目级别(类目级别 0,1,2 代表一、二、三级类目)
}

type CategoryGoodsGetResult

type CategoryGoodsGetResult struct {
	BaseResult
	JdUnionOpenCategoryGoodsGetResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	}
}

type Config

type Config struct {
	Method      Method `json:"method" url:"method"`                       // API接口名称
	AppKey      string `json:"app_key" url:"app_key"`                     // 分配给应用的AppKey
	AccessToken string `json:"access_token,omitempty" url:"access_token"` // Oauth2颁发的动态令牌,根据API属性标签,如果需要授权,则此参数必传;如果不需要授权,则此参数不需要传
	Timestamp   string `json:"timestamp" url:"timestamp"`                 // 时间戳,格式为yyyy-MM-dd  HH:mm:ss,时区为GMT+8。API服务端允许客户端请求最大时间误差为10分钟
	Format      string `json:"format" url:"format"`                       // 响应格式。暂时只支持json
	Version     string `json:"v" url:"v"`                                 // API协议版本,可选值:2.0,请根据API具体版本号传入此参数,一般为1.0
	SignMethod  string `json:"sign_method" url:"sign_method"`             // 签名的摘要算法, md5
	Sign        string `json:"sign" url:"sign"`                           // API输入参数签名结果
	SecretKey   string `json:"-" url:"-"`                                 // api秘钥
}

系统配置

func NewConfig

func NewConfig(appKey, secretKey string) *Config

type CouponGiftGetRequest

type CouponGiftGetRequest struct {
	SkuMaterialId    string  `json:"skuMaterialId"`    // 商品skuId或落地页地址
	Discount         float64 `json:"discount"`         // 优惠券面额,最小不可低于1元,最大不可超过pop商品价格的80%,自营商品价格的50%
	Amount           uint64  `json:"amount"`           // 总数量
	ReceiveStartTime string  `json:"receiveStartTime"` // 领取开始时间(yyyy-MM-dd HH),区间为(创建当天0点直至未来6天内),系统补充为yyyy-MM-dd HH:00:00
	ReceiveEndTime   string  `json:"receiveEndTime"`   // 领取结束时间(yyyy-MM-dd HH),区间为(创建当前时间点直至未来6天内),系统补充为yyyy-MM-dd HH:59:59
	IsSpu            uint64  `json:"isSpu"`            // 是否绑定同spu商品(1:是;0:否),例如skuMaterialId输入一款37码的鞋,当isSpu选择1时,此款鞋的全部尺码均可推广这张礼金;当isSpu选择0时,此款鞋仅37码可推广这张礼金,其他鞋码不支持
	ExpireType       uint64  `json:"expireType"`       // 使用时间类型:1.相对时间,需配合effectiveDays一同传入;2.绝对时间,需配合useStartTime和useEndTime一同传入
	Share            uint64  `json:"share"`            // 每个礼金推广链接是否限制仅可领取1张礼金:-1不限,1限制

	EffectiveDays uint64 `json:"effectiveDays,omitempty"` // 消费者领取后n天内可用,时间天数1至7,当expireType=1时,必须设置该字段
	UseStartTime  string `json:"useStartTime,omitempty"`  // 消费者领取后的使用开始时间,格式:yyyy-MM-dd,系统补充为yyyy-MM-dd HH:00:00,当expireType=2时,必须设置该字段
	UseEndTime    string `json:"useEndTime,omitempty"`    // 消费者领取后的使用结束时间,格式:yyyy-MM-dd,系统补充为yyyy-MM-dd HH:59:59,当expireType=2时,必须设置该字段
	ContentMatch  uint64 `json:"contentMatch,omitempty"`  // 是否允许通过内容平台推广,0:不允许,1:允许;默认为0
}

type CouponGiftGetResult

type CouponGiftGetResult struct {
	BaseResult
	JdUnionOpenCouponGiftGetResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_coupon_gift_get_response"`
}

type CouponGiftStopRequest

type CouponGiftStopRequest struct {
	GiftCouponKey string `json:"giftCouponKey"` // 礼金批次ID
}

type CouponGiftStopResult

type CouponGiftStopResult struct {
	BaseResult
	JdUnionOpenCouponGiftStopResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_coupon_gift_stop_response"`
}

type CouponQueryRequest

type CouponQueryRequest struct {
	CouponUrl string `json:"couponUrl"` // 优惠券链接
}

type CouponQueryResult

type CouponQueryResult struct {
	BaseResult
	JdUnionOpenCouponQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_coupon_query_response"`
}

type CouponService

type CouponService interface {
	// 优惠券领取情况查询接口【申请】
	CouponQuery([]*CouponQueryRequest) (*CouponQueryResult, error)
	// 优惠券领取情况查询接口【申请】
	CouponQueryByList(urls ...string) (*CouponQueryResult, error)
}

type CouponServiceImpl

type CouponServiceImpl struct {
	// contains filtered or unexported fields
}

func (CouponServiceImpl) CouponQuery

func (c CouponServiceImpl) CouponQuery(request []*CouponQueryRequest) (*CouponQueryResult, error)

func (*CouponServiceImpl) CouponQueryByList

func (c *CouponServiceImpl) CouponQueryByList(urls ...string) (*CouponQueryResult, error)

type GiftService

type GiftService interface {
	// 礼金创建
	CouponGiftGet(*CouponGiftGetRequest) (*CouponGiftGetResult, error)
	// 礼金停止
	CouponGiftStop(*CouponGiftStopRequest) (*CouponGiftStopResult, error)
	// 礼金效果数据
	GiftStatisticCouponQuery(*GiftStatisticCouponQueryRequest) (*GiftStatisticCouponQueryResult, error)
}

type GiftServiceImpl

type GiftServiceImpl struct {
	// contains filtered or unexported fields
}

func (*GiftServiceImpl) CouponGiftGet

func (p *GiftServiceImpl) CouponGiftGet(request *CouponGiftGetRequest) (*CouponGiftGetResult, error)

func (*GiftServiceImpl) CouponGiftStop

func (p *GiftServiceImpl) CouponGiftStop(request *CouponGiftStopRequest) (*CouponGiftStopResult, error)

func (*GiftServiceImpl) GiftStatisticCouponQuery added in v1.0.0

func (p *GiftServiceImpl) GiftStatisticCouponQuery(request *GiftStatisticCouponQueryRequest) (*GiftStatisticCouponQueryResult, error)

type GiftStatisticCouponQueryRequest added in v1.0.0

type GiftStatisticCouponQueryRequest struct {
	SkuId         uint64 `json:"skuId"`         // 查询该SKU您创建的推客礼金,以及该SKU您可推广的联盟礼金。 skuId和giftCouponKey二选一,不可同时入参。
	GiftCouponKey string `json:"giftCouponKey"` // 根据礼金批次ID精确查询礼金信息,请勿和createTime同时传入。 skuId和giftCouponKey二选一,不可同时入参。
	CreateTime    string `json:"createTime"`    // 可查询此日期及以后创建的礼金,如不传则不限日期。 格式:yyyy-MM-dd
	StartTime     string `json:"startTime"`     // 可查询此日期及以后下单的礼金效果数据,如不传则不限日期。 格式:yyyy-MM-dd
}

type GiftStatisticCouponQueryResult added in v1.0.0

type GiftStatisticCouponQueryResult struct {
	BaseResult
	JdUnionOpenGiftStatisticCouponQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_gift_statistic_coupon_query_response"`
}

type GoodsGigfieldRequest added in v1.0.0

type GoodsGigfieldRequest struct {
	SkuIds []uint64 `json:"skuIds"` // skuId集合,最多支持批量入参10个sku

	Fields []string `json:"fields,omitempty"` // 查询域集合,不填写则查询全部,目目前支持:categoryInfo(类目信息),imageInfo(图片信息),baseBigFieldInfo(基础大字段信息),bookBigFieldInfo(图书大字段信息),videoBigFieldInfo(影音大字段信息),detailImages(商详图)
}

type GoodsGigfieldResult added in v1.0.0

type GoodsGigfieldResult struct {
	BaseResult
	JdUnionOpenGoodsBigfieldQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_goods_bigfield_query_response"`
}

type GoodsJingfenQueryRequest

type GoodsJingfenQueryRequest struct {
	EliteId uint64 `json:"eliteId"` // 频道ID:1-好券商品,2-精选卖场,10-9.9包邮,15-京东配送,22-实时热销榜,23-为你推荐,24-数码家电,25-超市,26-母婴玩具,27-家具日用,28-美妆穿搭,30-图书文具,

	PageIndex   uint64 `json:"pageIndex,omitempty"`   // 页码,默认1
	PageSize    uint64 `json:"pageSize,omitempty"`    // 每页数量,默认20,上限50,建议20
	SortName    string `json:"sortName,omitempty"`    // 排序字段(price:单价, commissionShare:佣金比例, commission:佣金, inOrderCount30DaysSku:sku维度30天引单量,comments:评论数,goodComments:好评数)
	Sort        string `json:"sort,omitempty"`        // asc,desc升降序,默认降序
	Pid         string `json:"pid,omitempty"`         // 联盟id_应用id_推广位id,三段式
	Fields      string `json:"fields,omitempty"`      // 支持出参数据筛选,逗号','分隔,目前可用:videoInfo,documentInfo
	ForbidTypes string `json:"forbidTypes,omitempty"` // 10微信京东购物小程序禁售,11微信京喜小程序禁售
}

type GoodsJingfenQueryResult

type GoodsJingfenQueryResult struct {
	BaseResult
	JdUnionOpenGoodsJingfenQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_goods_jingfen_query_response"`
}

func (*GoodsJingfenQueryResult) GetResult

func (r *GoodsJingfenQueryResult) GetResult() []byte

type GoodsJingfenQueryResultInner deprecated added in v1.0.0

type GoodsJingfenQueryResultInner struct {
	Code int `json:"code"`
	Data []struct {
		BrandCode    string `json:"brandCode"`
		BrandName    string `json:"brandName"`
		CategoryInfo struct {
			Cid1     int    `json:"cid1"`
			Cid1Name string `json:"cid1Name"`
			Cid2     int    `json:"cid2"`
			Cid2Name string `json:"cid2Name"`
			Cid3     int    `json:"cid3"`
			Cid3Name string `json:"cid3Name"`
		} `json:"categoryInfo"`
		Comments       int `json:"comments"`
		CommissionInfo struct {
			Commission          float64 `json:"commission"`
			CommissionShare     int     `json:"commissionShare"`
			EndTime             int64   `json:"endTime"`
			IsLock              int     `json:"isLock"`
			PlusCommissionShare int     `json:"plusCommissionShare"`
			StartTime           int64   `json:"startTime"`
		} `json:"commissionInfo"`
		CouponInfo struct {
			CouponList []interface{} `json:"couponList"`
		} `json:"couponInfo"`
		DeliveryType      int   `json:"deliveryType"`
		ForbidTypes       []int `json:"forbidTypes"`
		GoodCommentsShare int   `json:"goodCommentsShare"`
		ImageInfo         struct {
			ImageList []struct {
				URL string `json:"url"`
			} `json:"imageList"`
			WhiteImage string `json:"whiteImage"`
		} `json:"imageInfo"`
		InOrderCount30Days    int    `json:"inOrderCount30Days"`
		InOrderCount30DaysSku int    `json:"inOrderCount30DaysSku"`
		IsHot                 int    `json:"isHot"`
		MaterialURL           string `json:"materialUrl"`
		Owner                 string `json:"owner"`
		PinGouInfo            struct {
		} `json:"pinGouInfo"`
		PriceInfo struct {
			LowestPrice     int `json:"lowestPrice"`
			LowestPriceType int `json:"lowestPriceType"`
			Price           int `json:"price"`
		} `json:"priceInfo"`
		ResourceInfo struct {
			EliteID   int    `json:"eliteId"`
			EliteName string `json:"eliteName"`
		} `json:"resourceInfo"`
		SeckillInfo struct {
			SeckillEndTime   int64 `json:"seckillEndTime"`
			SeckillOriPrice  int   `json:"seckillOriPrice"`
			SeckillPrice     int   `json:"seckillPrice"`
			SeckillStartTime int64 `json:"seckillStartTime"`
		} `json:"seckillInfo"`
		ShopInfo struct {
			ShopID    int     `json:"shopId"`
			ShopLevel float64 `json:"shopLevel"`
			ShopName  string  `json:"shopName"`
		} `json:"shopInfo"`
		SkuID    int    `json:"skuId"`
		SkuName  string `json:"skuName"`
		Spuid    int    `json:"spuid"`
		BookInfo struct {
			Isbn string `json:"isbn"`
		} `json:"bookInfo,omitempty"`
	} `json:"data"`
	Message    string `json:"message"`
	RequestID  string `json:"requestId"`
	TotalCount int    `json:"totalCount"`
}

Deprecated: 弃用

type GoodsPromotiongoodsinfoResult added in v1.0.0

type GoodsPromotiongoodsinfoResult struct {
	BaseResult
	JdUnionOpenGoodsPromotiongoodsinfoQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_goods_promotiongoodsinfo_query_response"`
}

type GoodsQueryRequest

type GoodsQueryRequest struct {
	Cid1                 uint64   `json:"cid1,omitempty"`                 // 一级类目id
	Cid2                 uint64   `json:"cid2,omitempty"`                 // 二级类目id
	Cid3                 uint64   `json:"cid3,omitempty"`                 // 三级类目id
	PageIndex            uint64   `json:"pageIndex,omitempty"`            // 页码
	PageSize             uint64   `json:"pageSize,omitempty"`             // 每页数量,单页数最大30,默认20
	SkuIds               []uint64 `json:"skuIds,omitempty"`               // skuid集合(一次最多支持查询100个sku),数组类型开发时记得加[]
	Keyword              string   `json:"keyword,omitempty"`              // 关键词,字数同京东商品名称一致,目前未限制
	Pricefrom            float64  `json:"pricefrom,omitempty"`            // 商品价格下限
	Priceto              float64  `json:"priceto,omitempty"`              // 商品价格上限
	CommissionShareStart uint64   `json:"commissionShareStart,omitempty"` // 佣金比例区间开始
	CommissionShareEnd   uint64   `json:"commissionShareEnd,omitempty"`   // 佣金比例区间结束
	Owner                string   `json:"owner,omitempty"`                // 商品类型:自营[g],POP[p]
	SortName             string   `json:"sortName,omitempty"`             // 排序字段(price:单价, commissionShare:佣金比例, commission:佣金, inOrderCount30Days:30天引单量, inOrderComm30Days:30天支出佣金)
	Sort                 string   `json:"sort,omitempty"`                 // asc,desc升降序,默认降序
	IsCoupon             uint64   `json:"isCoupon,omitempty"`             // 是否是优惠券商品,1:有优惠券,0:无优惠券
	IsPG                 string   `json:"isPG,omitempty"`                 // 是否是拼购商品,1:拼购商品,0:非拼购商品
	PingouPriceStart     float64  `json:"pingouPriceStart,omitempty"`     // 拼购价格区间开始
	PingouPriceEnd       float64  `json:"pingouPriceEnd,omitempty"`       // 拼购价格区间结束
	IsHot                uint64   `json:"-"`                              // Deprecated: 已废弃,请勿使用
	BrandCode            string   `json:"brandCode,omitempty"`            // 品牌code
	ShopId               uint64   `json:"shopId,omitempty"`               // 店铺Id
	HasContent           uint64   `json:"hasContent,omitempty"`           // 1:查询内容商品;其他值过滤掉此入参条件。
	HasBestCoupon        uint64   `json:"hasBestCoupon,omitempty"`        // 1:查询有最优惠券商品;其他值过滤掉此入参条件。
	Pid                  string   `json:"pid,omitempty"`                  // 联盟id_应用iD_推广位id
	Fields               string   `json:"fields,omitempty"`               // 支持出参数据筛选,逗号','分隔,目前可用:videoInfo(视频信息),hotWords(热词),similar(相似推荐商品),documentInfo(段子信息),bookInfo(图书信息),specInfo(扩展信息)
	ForbidTypes          string   `json:"forbidTypes,omitempty"`          // 10微信京东购物小程序禁售,11微信京喜小程序禁售
	JxFlags              []uint64 `json:"jxFlags,omitempty"`              // 京喜商品类型,1京喜、2京喜工厂直供、3京喜优选(包含3时可在京东APP购买),入参多个值表示或条件查询
	ShopLevelFrom        float64  `json:"shopLevelFrom,omitempty"`        // 支持传入0.0、2.5、3.0、3.5、4.0、4.5、4.9,默认为空表示不筛选评分
	DeliveryType         uint64   `json:"deliveryType,omitempty"`         // 京东配送 1:是,0:不是
	Isbn                 string   `json:"isbn,omitempty"`                 // 图书编号
}

关键词商品查询接口

type GoodsQueryResult

type GoodsQueryResult struct {
	BaseResult
	JdUnionOpenGoodsQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_goods_query_response"`
}

type GoodsService

type GoodsService interface {
	// 京粉精选商品查询接口
	GoodsJingfenQuery(*GoodsJingfenQueryRequest) (*GoodsJingfenQueryResult, error)
	// 关键词商品查询接口【申请】
	GoodsQuery(*GoodsQueryRequest) (*GoodsQueryResult, error)
	/* 根据skuid查询商品信息接口
	   skuIds: 京东skuID串,逗号分割,最多100个,开发示例如param_json={'skuIds':'5225346,7275691'}
	  (非常重要 请大家关注:如果输入的sk串中某个skuID的商品不在推广中[就是没有佣金],返回结果中不会包含这个商品的信息) */
	GoodsPromotiongoodsinfoQuery(skuIds string) (*GoodsPromotiongoodsinfoResult, error)
	// 商品类目查询接口
	CategoryGoodsGetQuery(*CategoryGoodsGetRequest) (*CategoryGoodsGetResult, error)
	// 商品详情查询接口【申请】
	GoodsGigfieldQuery(*GoodsGigfieldRequest) (*GoodsGigfieldResult, error)
}

type GoodsServiceImpl

type GoodsServiceImpl struct {
	// contains filtered or unexported fields
}

func (*GoodsServiceImpl) CategoryGoodsGetQuery

func (g *GoodsServiceImpl) CategoryGoodsGetQuery(request *CategoryGoodsGetRequest) (*CategoryGoodsGetResult, error)

func (*GoodsServiceImpl) GoodsGigfieldQuery

func (g *GoodsServiceImpl) GoodsGigfieldQuery(request *GoodsGigfieldRequest) (*GoodsGigfieldResult, error)

func (*GoodsServiceImpl) GoodsJingfenQuery

func (g *GoodsServiceImpl) GoodsJingfenQuery(request *GoodsJingfenQueryRequest) (*GoodsJingfenQueryResult, error)

func (*GoodsServiceImpl) GoodsPromotiongoodsinfoQuery

func (g *GoodsServiceImpl) GoodsPromotiongoodsinfoQuery(skuIds string) (*GoodsPromotiongoodsinfoResult, error)

func (*GoodsServiceImpl) GoodsQuery

func (g *GoodsServiceImpl) GoodsQuery(request *GoodsQueryRequest) (*GoodsQueryResult, error)

type Method

type Method string

请求的方法(接口)

const (
	GoodsJingfenQuery            Method = "jd.union.open.goods.jingfen.query"            // 精选商品查询
	GoodsQuery                   Method = "jd.union.open.goods.query"                    // 关键词商品查询接口【申请】
	GoodsPromotiongoodsinfoQuery Method = "jd.union.open.goods.promotiongoodsinfo.query" // 根据skuid查询商品信息接口
	CategoryGoodsGetQuery        Method = "jd.union.open.category.goods.get"             // 商品类目查询接口
	GoodsGigfieldQuery           Method = "jd.union.open.goods.bigfield.query"           // 商品详情查询接口【申请】
)
const (
	PromotionCommonGet         Method = "jd.union.open.promotion.common.get"       // 网站/APP获取推广链接接口
	PromotionBysubunionidQuery Method = "jd.union.open.promotion.bysubunionid.get" // 社交媒体获取推广链接接口【申请】
	PromotionByunionidQuery    Method = "jd.union.open.promotion.byunionid.get"    // 工具商获取推广链接接口【申请】
)
const (
	OrderQuery      Method = "jd.union.open.order.query"       // 订单查询接口
	OrderBonusQuery Method = "jd.union.open.order.bonus.query" // 奖励订单查询接口【申请】
	OrderRowQuery   Method = "jd.union.open.order.row.query"   // 订单行查询接口
)
const (
	PositionQuery  Method = "jd.union.open.position.query"  // 查询推广位【申请】
	PositionCreate Method = "jd.union.open.position.create" // 创建推广位【申请】
	UserPidGet     Method = "jd.union.open.user.pid.get"    // 获取PID【申请】
)
const (
	GiftStop      Method = "jd.union.open.coupon.gift.stop"            // 礼金停止
	GiftGet       Method = "jd.union.open.coupon.gift.get"             // 礼金创建
	GiftStatistic Method = "jd.union.open.statistics.giftcoupon.query" // 礼金效果数据
)
const (
	ActivityQuery            Method = "jd.union.open.activity.query"             // 活动查询接口
	StatisticsRedpacketQuery Method = "jd.union.open.statistics.redpacket.query" // 京享红包效果数据
)
const (
	CouponQuery Method = "jd.union.open.coupon.query" // 优惠券领取情况查询接口【申请】
)

type OrderBonusRequest added in v1.0.0

type OrderBonusRequest struct {
	OptType   uint64 `json:"optType"`   // 时间类型(1.下单时间拉取、2.更新时间拉取)
	StartTime uint64 `json:"startTime"` // 订单开始时间,时间戳(毫秒),与endTime间隔不超过10分钟
	EndTime   uint64 `json:"endTime"`   // 订单结束时间,时间戳(毫秒),与startTime间隔不超过10分钟
	PageSize  uint64 `json:"pageSize"`  // 每页数量,上限100

	PageNo    uint64 `json:"pageNo,omitempty"`    // 页码,默认值为1
	SortValue string `json:"sortValue,omitempty"` // 时间类型按'下单'查询时,和pageSize组合使用。获取最后一条记录的sortValue,指定拉取条数(pageSize),以此方式查询数据。
}

type OrderBonusResult added in v1.0.0

type OrderBonusResult struct {
	BaseResult
	JdUnionOpenOrderBonusResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_order_bonus_response"`
}

type OrderQueryRequest

type OrderQueryRequest struct {
	PageNo   uint64 `json:"pageNo"`   // 页码,返回第几页结果
	PageSize uint64 `json:"pageSize"` // 每页包含条数,上限为500
	TypeNum  uint64 `json:"type"`     // 订单时间查询类型(1:下单时间,2:完成时间(购买用户确认收货时间),3:更新时间
	Time     string `json:"time"`     // 查询时间,建议使用分钟级查询,格式:yyyyMMddHH、yyyyMMddHHmm或yyyyMMddHHmmss,如201811031212 的查询范围从12:12:00--12:12:59

	ChildUnionId uint64 `json:"childUnionId,omitempty"` // 子推客unionID,传入该值可查询子推客的订单,注意不可和key同时传入。(需联系运营开通PID权限才能拿到数据)
	Key          string `json:"key,omitempty"`          // 工具商传入推客的授权key,可帮助该推客查询订单,注意不可和childUnionid同时传入。(需联系运营开通工具商权限才能拿到数据)
}

type OrderQueryResult

type OrderQueryResult struct {
	BaseResult
	JdUnionOpenOrderQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_order_query_response"`
}

type OrderRowRequest added in v1.0.0

type OrderRowRequest struct {
	PageIndex uint64 `json:"pageIndex"` // 页码
	PageSize  uint64 `json:"pageSize"`  // 每页包含条数,上限为500
	TypeNum   uint64 `json:"type"`      // 订单时间查询类型(1:下单时间,2:完成时间(购买用户确认收货时间),3:更新时间
	StartTime string `json:"startTime"` // 开始时间 格式yyyy-MM-dd HH:mm:ss,与endTime间隔不超过1小时
	EndTime   string `json:"endTime"`   // 结束时间 格式yyyy-MM-dd HH:mm:ss,与startTime间隔不超过1小时

	ChildUnionId uint64 `json:"childUnionId,omitempty"` // 子推客unionID,传入该值可查询子推客的订单,注意不可和key同时传入。(需联系运营开通PID权限才能拿到数据)
	Key          string `json:"key,omitempty"`          // 工具商传入推客的授权key,可帮助该推客查询订单,注意不可和childUnionid同时传入。(需联系运营开通工具商权限才能拿到数据)
	Fields       string `json:"fields,omitempty"`       // 支持出参数据筛选,逗号','分隔,目前可用:goodsInfo(商品信息),categoryInfo(类目信息)
}

type OrderRowResult added in v1.0.0

type OrderRowResult struct {
	BaseResult
	JdUnionOpenOrderRowResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_order_row_response"`
}

type OrderService

type OrderService interface {
	// 订单查询接口
	OrderQuery(*OrderQueryRequest) (*OrderQueryResult, error)
	// 奖励订单查询接口【申请】
	OrderBonusQuery(*OrderBonusRequest) (*OrderBonusResult, error)
	// 订单行查询接口
	OrderRowQuery(*OrderRowRequest) (*OrderRowResult, error)
}

type OrderServiceImpl

type OrderServiceImpl struct {
	// contains filtered or unexported fields
}

func (*OrderServiceImpl) OrderBonusQuery

func (p *OrderServiceImpl) OrderBonusQuery(request *OrderBonusRequest) (*OrderBonusResult, error)

func (*OrderServiceImpl) OrderQuery

func (p *OrderServiceImpl) OrderQuery(request *OrderQueryRequest) (*OrderQueryResult, error)

func (*OrderServiceImpl) OrderRowQuery

func (p *OrderServiceImpl) OrderRowQuery(request *OrderRowRequest) (*OrderRowResult, error)

type OtherService

type OtherService interface {
	// 查询推广位【申请】
	PositionQuery(*PositionQueryRequest) (*PositionQueryResult, error)
	// 创建推广位【申请】
	PositionCreate(*PositionCreateRequest) (*PositionCreateResult, error)
	// 获取PID【申请】
	UserPidGet(*UserPidGetRequest) (*UserPidGetResult, error)
	// 活动查询接口
	ActivityQuery(*ActivityQueryRequest) (*ActivityQueryResult, error)
	// 京享红包效果数据
	StatisticsRedpacketQuery(*StatisticsRedpacketQueryRequest) (*StatisticsRedpacketQueryResult, error)
}

type OtherServiceImpl

type OtherServiceImpl struct {
	// contains filtered or unexported fields
}

func (*OtherServiceImpl) ActivityQuery

func (o *OtherServiceImpl) ActivityQuery(request *ActivityQueryRequest) (*ActivityQueryResult, error)

func (*OtherServiceImpl) PositionCreate

func (o *OtherServiceImpl) PositionCreate(request *PositionCreateRequest) (*PositionCreateResult, error)

func (*OtherServiceImpl) PositionQuery

func (o *OtherServiceImpl) PositionQuery(request *PositionQueryRequest) (*PositionQueryResult, error)

func (*OtherServiceImpl) StatisticsRedpacketQuery

func (*OtherServiceImpl) UserPidGet

func (o *OtherServiceImpl) UserPidGet(request *UserPidGetRequest) (*UserPidGetResult, error)

type Param

type Param struct {
	Config
	ParamJson string `json:"param_json,omitempty" url:"param_json"`
}

参数封装

type PositionCreateRequest

type PositionCreateRequest struct {
	UnionId       uint64   `json:"unionId"`       // 需要查询的目标联盟id
	Key           string   `json:"key"`           // 推客unionid对应的“授权Key”,在联盟官网-我的工具-我的API中查询,授权Key具有唯一性,有效期365天,删除或创建新的授权Key后原有的授权Key自动失效
	UnionType     uint64   `json:"unionType"`     // 3:私域推广位,上限5000个,不在联盟后台展示,无对应 PID;4:联盟后台推广位,上限500个,会在推客联盟后台展示,可用于内容平台推广
	TypeNum       uint64   `json:"type"`          // 站点类型 1.网站推广位2.APP推广位3.导购媒体推广位4.聊天工具推广位
	SpaceNameList []string `json:"spaceNameList"` // 推广位名称集合,英文,分割;上限50

	SiteId uint64 `json:"siteId,omitempty"` // 站点ID:网站的ID/app ID/snsID 。当type非4(聊天工具)时,siteId必填
}

type PositionCreateResult

type PositionCreateResult struct {
	BaseResult
	JdUnionOpenPositionCreateResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_position_create_response"`
}

type PositionQueryRequest

type PositionQueryRequest struct {
	UnionId   uint64 `json:"unionId"`   // 需要查询的目标联盟id
	Key       string `json:"key"`       // 推客unionid对应的“授权Key”,在联盟官网-我的工具-我的API中查询,授权Key具有唯一性,有效期365天,删除或创建新的授权Key后原有的授权Key自动失效
	UnionType uint64 `json:"unionType"` // 3:私域推广位,上限5000个,不在联盟后台展示,无对应 PID;4:联盟后台推广位,上限500个,会在推客联盟后台展示,可用于内容平台推广
	PageIndex uint64 `json:"pageIndex"` // 页码,上限100
	PageSize  uint64 `json:"pageSize"`  // 每页条数,上限100
}

type PositionQueryResult

type PositionQueryResult struct {
	BaseResult
	JdUnionOpenPositionQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_position_query_response"`
}

type PromoteCommonGetRequest

type PromoteCommonGetRequest struct {
	MaterialId string `json:"materialId"` //	推广物料url,例如活动链接、商品链接等;不支持仅传入skuid
	SiteId     string `json:"siteId"`     // 网站ID/APP ID,入口:京东联盟-推广管理-网站管理/APP管理-查看网站ID/APP ID(1、接口禁止使用导购媒体id入参;2、投放链接的网址或应用必须与传入的网站ID/AppID备案一致,否则订单会判“无效-来源与备案网址不符”)

	PositionId    uint64 `json:"positionId,omitempty"`    // 推广位id
	SubUnionId    string `json:"subUnionId,omitempty"`    // 子渠道标识,您可自定义传入字母、数字或下划线,最多支持80个字符,该参数会在订单行查询接口中展示(需申请权限,申请方法请见https://union.jd.com/helpcenter/13246-13247-46301
	Ext1          string `json:"ext1,omitempty"`          // 系统扩展参数(需申请权限,申请方法请见https://union.jd.com/helpcenter/13246-13247-46301),最多支持40字符,参数会在订单行查询接口中展示
	Protocol      uint64 `json:"-"`                       // Deprecated:【已废弃】请勿再使用
	Pid           string `json:"pid,omitempty"`           // 联盟子推客身份标识(不能传入接口调用者自己的pid)
	CouponUrl     string `json:"couponUrl,omitempty"`     // 优惠券领取链接,在使用优惠券、商品二合一功能时入参,且materialId须为商品详情页链接
	GiftCouponKey string `json:"giftCouponKey,omitempty"` // 礼金批次号
}

type PromoteCommonGetResult

type PromoteCommonGetResult struct {
	BaseResult
	JdUnionOpenPromotionCommonGetResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_promotion_common_get_response"`
}

type PromotionBysubunionidQueryRequest added in v1.0.0

type PromotionBysubunionidQueryRequest struct {
	MaterialId string `json:"materialId"` // 推广物料url,例如活动链接、商品链接等;不支持仅传入skuid

	SubUnionId    string `json:"subUnionId,omitempty"`    // 子渠道标识,您可自定义传入字母、数字或下划线,最多支持80个字符,该参数会在订单行查询接口中展示(需申请权限,申请方法请见https://union.jd.com/helpcenter/13246-13247-46301
	PositionId    uint64 `json:"positionId,omitempty"`    // 推广位ID
	Pid           string `json:"pid,omitempty"`           // 联盟子推客身份标识(不能传入接口调用者自己的pid)
	CouponUrl     string `json:"couponUrl,omitempty"`     // 优惠券领取链接,在使用优惠券、商品二合一功能时入参,且materialId须为商品详情页链接
	ChainType     uint64 `json:"chainType,omitempty"`     // 转链类型,1:长链, 2 :短链 ,3: 长链+短链,默认短链,短链有效期60天
	GiftCouponKey string `json:"giftCouponKey,omitempty"` // 礼金批次号
}

type PromotionBysubunionidQueryResult added in v1.0.0

type PromotionBysubunionidQueryResult struct {
	BaseResult
	JdUnionOpenPromotionBysubunionidQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_promotion_bysubunionid_query_response"`
}

type PromotionByunionidQueryRequest added in v1.0.0

type PromotionByunionidQueryRequest struct {
	MaterialId string `json:"materialId"` // 推广物料url,例如活动链接、商品链接等;不支持仅传入skuid
	UnionId    uint64 `json:"unionId"`    // 目标推客的联盟ID

	PositionId uint64 `json:"positionId,omitempty"` // 新增推广位id (不填的话,为其默认生成一个唯一此接口推广位-名称:微信手Q短链接)
	Pid        string `json:"pid,omitempty"`        // 联盟子推客身份标识(不能传入接口调用者自己的pid)
	CouponUrl  string `json:"couponUrl,omitempty"`  // 优惠券领取链接,在使用优惠券、商品二合一功能时入参,且materialId须为商品详情页链接
	SubUnionId string `json:"subUnionId,omitempty"` // 子渠道标识,您可自定义传入字母、数字或下划线,最多支持80个字符,该参数会在订单行查询接口中展示(需申请权限,申请方法请见https://union.jd.com/helpcenter/13246-13247-46301
	ChainType  uint64 `json:"chainType,omitempty"`  // 转链类型,1:长链, 2 :短链 ,3: 长链+短链,默认短链,短链有效期60天
}

type PromotionByunionidQueryResult added in v1.0.0

type PromotionByunionidQueryResult struct {
	BaseResult
	JdUnionOpenPromotionBysubunionidQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	}
}

type PromotionService

type PromotionService interface {
	// 网站/APP获取推广链接接口
	PromotionCommonGet(*PromoteCommonGetRequest) (*PromoteCommonGetResult, error)
	// 社交媒体获取推广链接接口【申请】
	PromotionBysubunionidQuery(*PromotionBysubunionidQueryRequest) (*PromotionBysubunionidQueryResult, error)
	// 工具商获取推广链接接口【申请】
	PromotionByunionidQuery(*PromotionByunionidQueryRequest) (*PromotionByunionidQueryResult, error)
}

type PromotionServiceImpl

type PromotionServiceImpl struct {
	// contains filtered or unexported fields
}

func (*PromotionServiceImpl) PromotionBysubunionidQuery added in v1.0.0

func (*PromotionServiceImpl) PromotionByunionidQuery added in v1.0.0

func (*PromotionServiceImpl) PromotionCommonGet

func (p *PromotionServiceImpl) PromotionCommonGet(request *PromoteCommonGetRequest) (*PromoteCommonGetResult, error)

type Service

type Service interface {
	common.Service

	// 获取商品相关接口
	GetGoodsService() GoodsService
	// 获取优惠卷相关接口
	GetCouponService() CouponService
	// 获取推广相关接口
	GetPromoteService() PromotionService
	// 获取礼金相关接口
	GetGiftService() GiftService
	// 获取订单相关接口
	GetOrderService() OrderService
	// 获取其他相关接口
	GetOtherService() OtherService

	// 设置商品(自定义)相关接口
	SetGoodsService(GoodsService)
	// 设置优惠卷(自定义)相关接口
	SetCouponService(CouponService)
	// 设置推广(自定义)相关接口
	SetPromoteService(PromotionService)
	// 设置礼金(自定义)相关接口
	SetGiftService(GiftService)
	// 设置其他(自定义)相关接口
	SetOtherService(OtherService)
	// 设置订单(自定义)相关接口
	SetOrderService(OrderService)

	// 获取配置
	GetConfig() *Config
	// 设置配置
	SetConfig(config *Config)
	// 设置http请求
	SetHttpService(service common.Service)

	// 执行Get操作
	Do(v interface{}, method Method, param map[string]interface{}) error
}

func NewJdService

func NewJdService(appKet, secretKey string) Service

type ServiceImpl

type ServiceImpl struct {
	// contains filtered or unexported fields
}

func (*ServiceImpl) Do

func (s *ServiceImpl) Do(v interface{}, method Method, param map[string]interface{}) error

func (*ServiceImpl) Get

func (s *ServiceImpl) Get(url string, args interface{}) ([]byte, error)

func (*ServiceImpl) GetConfig

func (s *ServiceImpl) GetConfig() *Config

func (*ServiceImpl) GetCouponService

func (s *ServiceImpl) GetCouponService() CouponService

func (*ServiceImpl) GetFor

func (s *ServiceImpl) GetFor(v interface{}, url string, args *Param) error

func (*ServiceImpl) GetGiftService

func (s *ServiceImpl) GetGiftService() GiftService

func (*ServiceImpl) GetGoodsService

func (s *ServiceImpl) GetGoodsService() GoodsService

func (*ServiceImpl) GetOrderService

func (s *ServiceImpl) GetOrderService() OrderService

func (*ServiceImpl) GetOtherService

func (s *ServiceImpl) GetOtherService() OtherService

func (*ServiceImpl) GetPromoteService

func (s *ServiceImpl) GetPromoteService() PromotionService

func (*ServiceImpl) SetConfig

func (s *ServiceImpl) SetConfig(config *Config)

func (*ServiceImpl) SetCouponService

func (s *ServiceImpl) SetCouponService(service CouponService)

func (*ServiceImpl) SetGiftService

func (s *ServiceImpl) SetGiftService(service GiftService)

func (*ServiceImpl) SetGoodsService

func (s *ServiceImpl) SetGoodsService(service GoodsService)

func (*ServiceImpl) SetHttpService

func (s *ServiceImpl) SetHttpService(service common.Service)

func (*ServiceImpl) SetOrderService

func (s *ServiceImpl) SetOrderService(service OrderService)

func (*ServiceImpl) SetOtherService

func (s *ServiceImpl) SetOtherService(service OtherService)

func (*ServiceImpl) SetPromoteService

func (s *ServiceImpl) SetPromoteService(service PromotionService)

func (*ServiceImpl) Sign

func (s *ServiceImpl) Sign(method Method, param map[string]interface{}) *Param

type StatisticsRedpacketQueryRequest

type StatisticsRedpacketQueryRequest struct {
	StartDate string `json:"startDate"` // 开始日期yyyy-MM-dd,不可超出最近90天开始日期yyyy-MM-dd,不可超出最近90天
	EndDate   string `json:"endDate"`   // 结束时间yyyy-MM-dd,不可超出最近90天
	PageIndex uint64 `json:"pageIndex"` // 页码,起始1
	PageSize  uint64 `json:"pageSize"`  // 每页数,大于等于10且小于等于100的正整数

	ActId      uint64 `json:"actId,omitempty"`      // 京享红包活动Id,如不传则查询全部京享红包活动
	PositionId uint64 `json:"positionId,omitempty"` // 推广位ID,支持联盟后台推广位和API创建的私域推广位
}

type StatisticsRedpacketQueryResult

type StatisticsRedpacketQueryResult struct {
	BaseResult
	JdUnionOpenStatisticsRedpacketQueryResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_statistics_redpacket_query_response"`
}

type UserPidGetRequest

type UserPidGetRequest struct {
	UnionId       uint64 `json:"unionId"`       // 联盟ID
	ChildUnionId  uint64 `json:"childUnionId"`  // 子站长ID
	PromotionType uint64 `json:"promotionType"` // 推广类型,1APP推广 2聊天工具推广
	MediaName     string `json:"mediaName"`     // 媒体名称,即子站长的app应用名称,推广方式为app推广时必填,且app名称必须为已存在的app名称

	PositionName string `json:"positionName,omitempty"` // 子站长的推广位名称,如不存在则创建,不填则由联盟根据母账号信息创建
}

type UserPidGetResult

type UserPidGetResult struct {
	BaseResult
	JdUnionOpenUserPidGetResponse struct {
		Result string `json:"result"`
		Code   string `json:"code"`
	} `json:"jd_union_open_user_pid_get_response"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL