- jd cancel promotion
This commit is contained in:
@@ -41,6 +41,12 @@ func (a *API) ConfirmPromotionSingle(infoId int64, outInfoId string) (err error)
|
|||||||
return a.confirmPromotion(PromotionTypeDirectDown, infoId, outInfoId)
|
return a.confirmPromotion(PromotionTypeDirectDown, infoId, outInfoId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 单品直降整个活动取消接口
|
||||||
|
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=178&apiid=3d02c2acad714bea86d20d498a1aa074
|
||||||
|
func (a *API) CancelPromotionSingle(infoId int64, outInfoId string) (err error) {
|
||||||
|
return a.cancelPromotion(PromotionTypeDirectDown, infoId, outInfoId)
|
||||||
|
}
|
||||||
|
|
||||||
// 限时抢添加活动主信息接口
|
// 限时抢添加活动主信息接口
|
||||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=184&apiid=7d8b7ff86c9e457bb8a46963cb575769
|
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=184&apiid=7d8b7ff86c9e457bb8a46963cb575769
|
||||||
func (a *API) CreatePromotionInfosLimitTime(name string, beginDate, endDate time.Time, outInfoId, advertising string) (infoId int64, err error) {
|
func (a *API) CreatePromotionInfosLimitTime(name string, beginDate, endDate time.Time, outInfoId, advertising string) (infoId int64, err error) {
|
||||||
@@ -79,6 +85,12 @@ func (a *API) ConfirmPromotionLimitTime(infoId int64, outInfoId string) (err err
|
|||||||
return a.confirmPromotion(PromotionTypeLimitedTime, infoId, outInfoId)
|
return a.confirmPromotion(PromotionTypeLimitedTime, infoId, outInfoId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 限时抢整个活动取消接口
|
||||||
|
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=184&apiid=97b6678d30624f73bc13cb68987e6a6d
|
||||||
|
func (a *API) CancelPromotionLimitTime(infoId int64, outInfoId string) (err error) {
|
||||||
|
return a.cancelPromotion(PromotionTypeLimitedTime, infoId, outInfoId)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *API) createPromotionInfos(promotionType int, name string, beginDate, endDate time.Time, outInfoId, advertising string) (infoId int64, err error) {
|
func (a *API) createPromotionInfos(promotionType int, name string, beginDate, endDate time.Time, outInfoId, advertising string) (infoId int64, err error) {
|
||||||
if outInfoId == "" {
|
if outInfoId == "" {
|
||||||
outInfoId = fmt.Sprintf("%X", md5.Sum([]byte(name)))
|
outInfoId = fmt.Sprintf("%X", md5.Sum([]byte(name)))
|
||||||
@@ -155,3 +167,24 @@ func (a *API) confirmPromotion(promotionType int, infoId int64, outInfoId string
|
|||||||
_, err = a.AccessAPINoPage(cmd, jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "data", "0"))
|
_, err = a.AccessAPINoPage(cmd, jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "data", "0"))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *API) cancelPromotion(promotionType int, infoId int64, outInfoId string) (err error) {
|
||||||
|
jdParams := map[string]interface{}{
|
||||||
|
"timeStamp": utils.GetCurTimeStr(),
|
||||||
|
}
|
||||||
|
if infoId != 0 {
|
||||||
|
jdParams[KeyInfoId] = infoId
|
||||||
|
} else {
|
||||||
|
jdParams[KeyOutInfoId] = outInfoId
|
||||||
|
}
|
||||||
|
cmd := ""
|
||||||
|
if promotionType == PromotionTypeDirectDown {
|
||||||
|
cmd = "singlePromote/cancelPromotion"
|
||||||
|
} else if promotionType == PromotionTypeLimitedTime {
|
||||||
|
cmd = "limitTime/cancelPromotion"
|
||||||
|
} else {
|
||||||
|
panic("unknow promotionType!")
|
||||||
|
}
|
||||||
|
_, err = a.AccessAPINoPage(cmd, jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "data", "0"))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user