112 lines
2.4 KiB
Go
112 lines
2.4 KiB
Go
package jdshopapi
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
)
|
|
|
|
func TestCreateEntityStore(t *testing.T) {
|
|
data, _, err := DownloadFileByURL("http://image.jxc4.com/image/b90ae8585e8cf2f3871f6e8318bde1dc.tem.png")
|
|
result, err := api.CreateEntityStore(&CreateEntityStoreParam{
|
|
Name: "京西菜市门店1",
|
|
AddCode: 50946,
|
|
AddCodeName: "金牛区",
|
|
AddName: "成都金牛区@!加州湾v派",
|
|
Coordinate: "29.707870,115.980868",
|
|
Phone: "18160030913",
|
|
ExtendJSON: `{"businessBeginTime":"9:00","businessEndTime":"22:00"}`,
|
|
ImageFile: base64.StdEncoding.EncodeToString(data),
|
|
CategoryName: "pop-mendian-Selfdelivery",
|
|
CustomerID: "666934",
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestUpdateEntityStore(t *testing.T) {
|
|
err := api.UpdateEntityStore(&UpdateEntityStoreParam{
|
|
StoreID: 24339354,
|
|
Status: 6,
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestGetProvince(t *testing.T) {
|
|
result, err := api.GetProvince()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestGetCity(t *testing.T) {
|
|
result, err := api.GetCity(2)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestGetCounty(t *testing.T) {
|
|
result, err := api.GetCounty(2834)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestFindSkuSiteStock(t *testing.T) {
|
|
result, err := api.FindSkuSiteStock(24339597, 69665406179)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestUpdateSkuSiteStock(t *testing.T) {
|
|
err := api.UpdateSkuSiteStock(69353633443, 0, 24340329)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestQueryEntityStore(t *testing.T) {
|
|
result, err := api.QueryEntityStore(24339354)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestFindStoreInfoByExtStoreId(t *testing.T) {
|
|
result, err := api.FindStoreInfoByExtStoreId(666854)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestWIREHL(t *testing.T) {
|
|
list := []int{1, 2, 3, 4, 5}
|
|
index := 0
|
|
for k, v := range list {
|
|
if v == 3 {
|
|
index = k
|
|
}
|
|
}
|
|
wsList := list
|
|
list = list[0:0]
|
|
list = append(list, wsList[0:index]...)
|
|
list = append(list, wsList[index+1:len(wsList)]...)
|
|
fmt.Println(list)
|
|
}
|