83 lines
2.2 KiB
Go
83 lines
2.2 KiB
Go
package ebaiapi
|
|
|
|
import (
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"testing"
|
|
)
|
|
|
|
func TestSkuCategoryList(t *testing.T) {
|
|
result, err := api.SkuCategoryList("巧福娃 香辣味麻酱大宽粉 30克/袋", 1, 0)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
} else {
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
}
|
|
|
|
func TestSkuBrandList(t *testing.T) {
|
|
result, err := api.SkuBrandList("中", 1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
} else {
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
}
|
|
|
|
func TestPictureUpload(t *testing.T) {
|
|
result, err := api.PictureUpload("http://image.jxc4.com/image/bd3d57f1be97f55693f44c6f5167efd7.jpg", nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
} else {
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
}
|
|
|
|
//
|
|
//func TestEbaiSend(t *testing.T) {
|
|
// obj := map[string]interface{}{
|
|
// "ticket": "32F4FD45-3981-4092-98B7-94AEC67AC458",
|
|
// "encrypt": "",
|
|
// "sign": "417580BA8AED5C891F7629F5B37899E2",
|
|
// "cmd": "order.create",
|
|
// "source": "34665",
|
|
// "body": map[string]interface{}{
|
|
// "order_id": "4061626013391868494",
|
|
// "platform_shop_id": "1257061574",
|
|
// },
|
|
// "version": "3",
|
|
// "timestamp": 1739110519,
|
|
// }
|
|
// msgBody, _ := json.Marshal(obj["body"])
|
|
// obj["body"] = string(msgBody)
|
|
//
|
|
// EBaiMsgPush2FruitsOrPet("jxpet", obj)
|
|
//}
|
|
//
|
|
//func EBaiMsgPush2FruitsOrPet(serverType string, msg map[string]interface{}) *CallbackResponse {
|
|
// cl := http.Client{}
|
|
// var request *http.Request
|
|
// var err error
|
|
// switch serverType {
|
|
// case "":
|
|
// request, err = http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/ebai/msg", strings.NewReader(utils.Map2URLValues(msg).Encode()))
|
|
// case "jxpet":
|
|
// request, err = http.NewRequest(http.MethodPost, "http://localhost:8080/ebai/msg", strings.NewReader(utils.Map2URLValues(msg).Encode()))
|
|
// }
|
|
// if err != nil {
|
|
// return api.Err2CallbackResponse("status.push", err, nil)
|
|
// }
|
|
//
|
|
// request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
|
// request.Header.Set("accept", "application/json, text/plain, */*")
|
|
// resp, err := cl.Do(request)
|
|
// if err != nil {
|
|
// return api.Err2CallbackResponse("status.push", err, nil)
|
|
// }
|
|
// defer resp.Body.Close()
|
|
// byteData, _ := ioutil.ReadAll(resp.Body)
|
|
// result := CallbackResponse{}
|
|
// json.Unmarshal(byteData, &result)
|
|
//
|
|
// return &result
|
|
//}
|