饿百取活动的api没了

This commit is contained in:
苏尹岚
2020-08-19 12:05:30 +08:00
parent 208084151e
commit 56f5337680
2 changed files with 49 additions and 47 deletions

View File

@@ -9,34 +9,36 @@ import (
) )
func TestAddOrderAfterQuery(t *testing.T) { func TestAddOrderAfterQuery(t *testing.T) {
orderID := utils.GetUUID() // orderID := utils.GetUUID()
result, err := dadaapi.QueryDeliverFee(&OperateOrderParams{ result, err := dadaapi.QueryDeliverFee(&OperateOrderParams{
ShopNo: testShopNo, ShopNo: "102908",
OriginID: orderID, OriginID: "130652775117000002",
CityCode: "028", CityCode: "021",
CargoPrice: 0.01, CargoPrice: 0.01,
IsPrepay: 0, IsPrepay: 0,
ReceiverName: "某人", ReceiverName: "某人",
ReceiverAddress: "西南交通大学科技大厦", ReceiverAddress: "西南交通大学科技大厦",
ReceiverLng: 104.056822, ReceiverLng: 121.258651,
ReceiverLat: 30.696041, ReceiverLat: 31.034611,
ReceiverPhone: "18180948107", ReceiverPhone: "18180948107",
CargoType: 19,
CargoWeight: 3,
}) })
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
baseapi.SugarLogger.Debug(utils.Format4Output(result, false)) baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
err = dadaapi.AddOrderAfterQuery(result.DeliveryNo) // err = dadaapi.AddOrderAfterQuery(result.DeliveryNo)
if err != nil { // if err != nil {
t.Fatal(err) // t.Fatal(err)
} // }
cancelResponse, err := dadaapi.CancelOrder(orderID, ReasonIDOther, "test") // cancelResponse, err := dadaapi.CancelOrder(orderID, ReasonIDOther, "test")
if err != nil { // if err != nil {
t.Fatal(err) // t.Fatal(err)
} // }
baseapi.SugarLogger.Debug(utils.Format4Output(cancelResponse, false)) // baseapi.SugarLogger.Debug(utils.Format4Output(cancelResponse, false))
} }
func TestCancel(t *testing.T) { func TestCancel(t *testing.T) {

View File

@@ -86,38 +86,38 @@ type PageActivityInfo struct {
} }
func (a *API) BegetActivityList(showStatus, activityType int, baiduShopID, supplierID int64) (actList []*PageActItem, err error) { func (a *API) BegetActivityList(showStatus, activityType int, baiduShopID, supplierID int64) (actList []*PageActItem, err error) {
pageSize := 20 // pageSize := 20
pageNo := 1 // pageNo := 1
params := map[string]interface{}{ // params := map[string]interface{}{
"perpage": pageSize, // "perpage": pageSize,
"show_status": showStatus, // "show_status": showStatus,
"activity_type": activityType, //不设置这个值缺省为PageActivityTypeSkuDirectDown // "activity_type": activityType, //不设置这个值缺省为PageActivityTypeSkuDirectDown
} // }
if baiduShopID > 0 { // if baiduShopID > 0 {
params["wid"] = baiduShopID // params["wid"] = baiduShopID
} // }
if supplierID > 0 { // if supplierID > 0 {
params[KeySupplierID] = supplierID // params[KeySupplierID] = supplierID
} // }
for { // for {
params["curpage"] = pageNo // params["curpage"] = pageNo
retVal, err2 := a.AccessStorePage("commodity/activity/begetactivitylist", "", params, false) // retVal, err2 := a.AccessStorePage("commodity/activity/begetactivitylist", "", params, false)
if err = err2; err == nil { // if err = err2; err == nil {
var listInfo *PageActListInfo // var listInfo *PageActListInfo
if err = utils.Map2StructByJson(retVal, &listInfo, true); err != nil { // if err = utils.Map2StructByJson(retVal, &listInfo, true); err != nil {
return nil, err // return nil, err
} // }
if listInfo != nil { // if listInfo != nil {
actList = append(actList, listInfo.ActivityList...) // actList = append(actList, listInfo.ActivityList...)
} // }
if listInfo == nil || len(actList) >= listInfo.Total { // if listInfo == nil || len(actList) >= listInfo.Total {
return actList, nil // return actList, nil
} // }
pageNo++ // pageNo++
} else { // } else {
return nil, err // return nil, err
} // }
} // }
return nil, err return nil, err
} }