- retrieve errmsg from data in funcs createPromotionSku
This commit is contained in:
@@ -215,7 +215,7 @@ func genNoPageResultParser(codeKey, msgKey, resultKey, okCode string) func(data
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if msg, ok := data[msgKey]; ok {
|
if msg, ok := data[msgKey]; ok {
|
||||||
errMsg := msg.(string)
|
errMsg := utils.Format4Output(msg, true)
|
||||||
if innerCode == ResponseInnerCodePartialFailed {
|
if innerCode == ResponseInnerCodePartialFailed {
|
||||||
errMsg += ", " + utils.Format4Output(data[resultKey], true)
|
errMsg += ", " + utils.Format4Output(data[resultKey], true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func (a *API) CreatePromotionRules(infoId int64, outInfoId string, limitDevice,
|
|||||||
} else {
|
} else {
|
||||||
jdParams[KeyOutInfoId] = outInfoId
|
jdParams[KeyOutInfoId] = outInfoId
|
||||||
}
|
}
|
||||||
_, err = a.AccessAPINoPage("limitTime/createPromotionRules", jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "data", "0"))
|
_, err = a.AccessAPINoPage("limitTime/createPromotionRules", jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "", "0"))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +119,7 @@ func (a *API) createPromotionInfos(promotionType int, name string, beginDate, en
|
|||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo skusResult 返回值没有意义,为了兼容暂时保留
|
||||||
func (a *API) createPromotionSku(promotionType int, infoId int64, outInfoId string, skus []map[string]interface{}) (skusResult []map[string]interface{}, err error) {
|
func (a *API) createPromotionSku(promotionType int, infoId int64, outInfoId string, skus []map[string]interface{}) (skusResult []map[string]interface{}, err error) {
|
||||||
jdParams := map[string]interface{}{
|
jdParams := map[string]interface{}{
|
||||||
"skus": skus,
|
"skus": skus,
|
||||||
@@ -137,13 +138,7 @@ func (a *API) createPromotionSku(promotionType int, infoId int64, outInfoId stri
|
|||||||
} else {
|
} else {
|
||||||
panic("unknow promotionType!")
|
panic("unknow promotionType!")
|
||||||
}
|
}
|
||||||
result, err := a.AccessAPINoPage(cmd, jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "data", "0"))
|
_, err = a.AccessAPINoPage(cmd, jdParams, nil, nil, genNoPageResultParser("errorCode", "data", "", "0"))
|
||||||
if err == nil {
|
|
||||||
if result != nil {
|
|
||||||
return utils.Slice2MapSlice(result.([]interface{})), nil
|
|
||||||
}
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +159,7 @@ func (a *API) confirmPromotion(promotionType int, infoId int64, outInfoId string
|
|||||||
} else {
|
} else {
|
||||||
panic("unknow promotionType!")
|
panic("unknow promotionType!")
|
||||||
}
|
}
|
||||||
_, err = a.AccessAPINoPage(cmd, jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "data", "0"))
|
_, err = a.AccessAPINoPage(cmd, jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "", "0"))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,6 +180,6 @@ func (a *API) cancelPromotion(promotionType int, infoId int64, outInfoId string)
|
|||||||
} else {
|
} else {
|
||||||
panic("unknow promotionType!")
|
panic("unknow promotionType!")
|
||||||
}
|
}
|
||||||
_, err = a.AccessAPINoPage(cmd, jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "data", "0"))
|
_, err = a.AccessAPINoPage(cmd, jdParams, nil, nil, genNoPageResultParser("errorCode", "errorInfos", "", "0"))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user