From 79f6aa10e1c54980ee3dc9caeb091ed4ebf9f87c Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 20 Dec 2022 14:06:22 +0800 Subject: [PATCH] test --- macao_logistics/macao_logistics.go | 37 ++++++++++++++++++------- macao_logistics/macao_logistics_test.go | 12 +++----- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/macao_logistics/macao_logistics.go b/macao_logistics/macao_logistics.go index 2ace57b..df11f3c 100644 --- a/macao_logistics/macao_logistics.go +++ b/macao_logistics/macao_logistics.go @@ -1,12 +1,16 @@ package macao_logistics -import "github.com/tidwall/gjson" +import ( + zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" + "fmt" + "github.com/tidwall/gjson" +) -func GetToken() string { - params := map[string]interface{}{ - "phone": "15217160421", - "password": "123456789@", - } +func GetToken(params map[string]interface{}) string { + //params := map[string]interface{}{ + // "phone": "15217160421", + // "password": "123456789@", + //} //7c2f6cbd480a96f1aa69509f9dd65462 send, err := Send("/jyb/admin/login/password", params, "") if err != nil { @@ -15,17 +19,30 @@ func GetToken() string { return gjson.Get(send, "data.token").String() } -func GetGoods(params map[string]interface{}) string { - send, err := SendGet("/admin/goods/detailed/list", params, "7c2f6cbd480a96f1aa69509f9dd65462") +func GetGoods(params map[string]interface{}, acctoken string) string { + send, err := SendGet("/admin/goods/detailed/list", params, acctoken) if err != nil { return "" } return gjson.Get(send, "data.data").String() } -func GetStore(params map[string]interface{}) string { - send, err := SendGet("/jyb/order/delivery/store", params, "7c2f6cbd480a96f1aa69509f9dd65462") +func GetStore(params map[string]interface{}, acctoken string) string { + send, err := SendGet("/jyb/order/delivery/store", params, acctoken) if err != nil { return "" } return gjson.Get(send, "data.data").String() } +func GetOrder(params map[string]interface{}, acctoken string) string { + send, err := SendGet("/jyb/order/delivery/list", params, acctoken) + if err != nil { + return "" + } + return gjson.Get(send, "data.data").String() +} +func RegUser(params map[string]interface{}) string { + header := make(map[string]string, 0) + data, _ := zhios_third_party_utils.CurlPost("https://mx.aoyunltd.com/wxnewshibaouser.php", params, header) + fmt.Println(string(data)) + return string(data) +} diff --git a/macao_logistics/macao_logistics_test.go b/macao_logistics/macao_logistics_test.go index 252e3e0..ba24394 100644 --- a/macao_logistics/macao_logistics_test.go +++ b/macao_logistics/macao_logistics_test.go @@ -4,14 +4,10 @@ import "testing" func TestLogin(t *testing.T) { params := map[string]interface{}{ - "order_number": "test12311", //單號,長度不可以超過30 - "phone": "15217160421", // 电话号码長度為8 or 11 - "arrive": "60", // 門店個點ID,可以用ID 也可以用AYG001的參數 - "type": "1", // 是指的是快件是否預付,1代表是用戶支付2是商家餘額支付,3是商家月結 - "weight": "20", // 重量,必須是int,沒有小數點 - "order_type": "1", - "city": "珠海", + "phoneno": "15217160421", // + "nickname": "黄", // + "cainiao_match": "AYD001", } //7c2f6cbd480a96f1aa69509f9dd65462 - Send("/jyb/order/delivery/add", params, "7c2f6cbd480a96f1aa69509f9dd65462") + RegUser(params) }