120 lines
2.9 KiB
Go
120 lines
2.9 KiB
Go
package jdshopapi
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"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: "生鲜店",
|
|
CustomerID: "666934",
|
|
// CategoryID2: 62,
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestDeleteStoresByID(t *testing.T) {
|
|
err := api.DeleteStoresByID(1000139823)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestUpdateEntityStore(t *testing.T) {
|
|
data, _, err := DownloadFileByURL("http://image.jxc4.com/image/b90ae8585e8cf2f3871f6e8318bde1dc.tem.png")
|
|
err = api.UpdateEntityStore(&UpdateEntityStoreParam{
|
|
StoreID: 24562221,
|
|
Name: "京西菜市门店1",
|
|
AddCode: 50946,
|
|
AddName: "成都金牛区@!加州湾v派",
|
|
ExtendJSON: `{"businessBeginTime":"9:00","businessEndTime":"22:00"}`,
|
|
Phone: "18160030913",
|
|
ImageFile: base64.StdEncoding.EncodeToString(data),
|
|
CategoryID2: 62,
|
|
})
|
|
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(19)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestGetCounty(t *testing.T) {
|
|
result, err := api.GetCounty(1655)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestFindSkuSiteStock(t *testing.T) {
|
|
result, err := api.FindSkuSiteStock(24339440, 70208031643)
|
|
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 TestUpdateStoreStatusAPI(t *testing.T) {
|
|
err := api.UpdateStoreStatusAPI(69353633443, 0)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// t.Log(utils.Format4Output(result, false))
|
|
}
|