1
This commit is contained in:
@@ -25,7 +25,7 @@ func init() {
|
||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
|
||||
//商超
|
||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_kjEKYoGKSl0L4XqfEt9GUA")
|
||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_uVZfu5hlW_UZQiR_i1tL0Q")
|
||||
//cookieStr := `
|
||||
// acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||
//`
|
||||
|
||||
@@ -862,28 +862,12 @@ func (a *API) GetOrderAddress(orderId int64, reasonType int) (address string, er
|
||||
}
|
||||
|
||||
// UploadMediaToOrder 订单上传图片,订单在骑手取货前且未超过订单预计送达时间时可以进行图片上传
|
||||
func (a *API) UploadMediaToOrder(orderId string, images []string) error {
|
||||
imageList := make([]*UploadMedia, 0, len(images))
|
||||
for _, v := range images {
|
||||
imageList = append(imageList, &UploadMedia{
|
||||
Url: v,
|
||||
Type: 0,
|
||||
ConfigSnapshotId: 0,
|
||||
ItemId: 0,
|
||||
Seq: 0,
|
||||
InnerSeq: 0,
|
||||
RequireId: 0,
|
||||
MediaCode: "",
|
||||
})
|
||||
}
|
||||
|
||||
byteData := utils.MustMarshal(imageList)
|
||||
|
||||
data, err := a.AccessAPI("ecommerce/order/uploadMedia", false, map[string]interface{}{"order_id": orderId, "media_list": string(byteData)})
|
||||
func (a *API) UploadMediaToOrder(orderId string, images interface{}) error {
|
||||
byteData := utils.MustMarshal(images)
|
||||
_, err := a.AccessAPI("ecommerce/order/uploadMedia", false, map[string]interface{}{"order_id": orderId, "media_list": string(byteData)})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(data)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,20 @@ func getTimeFromTimestamp(timeStamp int64) time.Time {
|
||||
}
|
||||
|
||||
func TestOrderGetOrderDetail(t *testing.T) {
|
||||
result, err := api.OrderGetOrderDetail(3802140943223203896, false)
|
||||
result, err := api.OrderGetOrderDetail(3802193810228584437, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if utils.MustInterface2Int64(result["force_require_picture"]) == 1 {
|
||||
forceRequirePicture := utils.MustInterface2Int64(result["force_require_picture"]) // 是否强制返图 0不强制返图,1强制返图
|
||||
auditStatus := utils.MustInterface2Int64(result["audit_status"]) // 需要强制返图时有意义,返图状态 1编辑中、2待审核、3系统审核通过、4下单人审核通过、5下单人审核驳回 非强制返图或强制返图返图前值为0
|
||||
fmt.Println(forceRequirePicture)
|
||||
fmt.Println(auditStatus)
|
||||
dispatchCondition := utils.Interface2String(result["dispatch_condition"]) // 发货条件明细,该字段当前只在强制返图场景下返回以及使用。enable_dispatch=true则可发货,dispatch_condition_detail为不可发货的所有条件明细,如需关注不可发货原因则要查看
|
||||
orderRealMediaDetail := utils.Interface2String(result["orderRealMediaDetail"]) // 实拍规则要求及实拍后的图片与ocr识别信息,没返回(null),则三方用老的传图方式上传
|
||||
fmt.Println(dispatchCondition)
|
||||
fmt.Println(orderRealMediaDetail)
|
||||
}
|
||||
globals.SugarLogger.Debugf("%d", int(utils.MustInterface2Int64(result["day_seq"])))
|
||||
globals.SugarLogger.Debugf("====%s", utils.Format4Output(result["poi_receive_detail_yuan"], false))
|
||||
if len(result) == 0 {
|
||||
@@ -47,6 +57,14 @@ func TestOrderGetOrderDetail(t *testing.T) {
|
||||
//globals.SugarLogger.Debugf("%s", utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
type dispatchConditionList struct {
|
||||
enable_dispatch bool `json:"enable_dispatch"` // 是否可发配,true-可发配,false-不可发配
|
||||
dispatch_condition_detail []struct {
|
||||
enable_dispatch bool `json:"enable_dispatch"` // 是否可发配,true-可发配,false-不可发配
|
||||
condition_type int `json:"condition_type"` // 发货条件类型,1-返图标准化强制实拍返图
|
||||
} `json:"dispatch_condition_detail"` // 发货条件明细,记录了哪些限制条件满足,哪些未满足
|
||||
}
|
||||
|
||||
func TestJsuan(t *testing.T) {
|
||||
fmt.Println(StandardPrice2Int2(-12.39))
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ func TestRetailRecommendTag(t *testing.T) {
|
||||
|
||||
// 删除商品
|
||||
func TestRetailDelete(t *testing.T) {
|
||||
poiCode := "32219557"
|
||||
poiCode := "31690278"
|
||||
|
||||
i := 0
|
||||
count := 0
|
||||
@@ -439,19 +439,20 @@ func TestRetailDelete(t *testing.T) {
|
||||
|
||||
// 测试删除门店分类列表
|
||||
func TestDeleteCat(t *testing.T) {
|
||||
result, err := api.RetailCatList("20760911")
|
||||
result, err := api.RetailCatList("31690278")
|
||||
fmt.Println(result, err)
|
||||
for _, v := range result {
|
||||
if v.Children != nil {
|
||||
for _, v2 := range v.Children {
|
||||
err = api.RetailCatDelete("31226355", "", v2.Name, 1)
|
||||
err = api.RetailCatDelete("31690278", "", v2.Name, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = api.RetailCatDelete("31226355", "", v.Name, 1)
|
||||
err = api.RetailCatDelete("31690278", "", v.Name, 1)
|
||||
if err != nil {
|
||||
continue
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user