163 lines
3.9 KiB
Go
163 lines
3.9 KiB
Go
package jdapi
|
||
|
||
import (
|
||
"fmt"
|
||
"git.rosy.net.cn/baseapi"
|
||
"git.rosy.net.cn/baseapi/utils"
|
||
"testing"
|
||
)
|
||
|
||
//
|
||
//import (
|
||
// "testing"
|
||
// "time"
|
||
//
|
||
// "git.rosy.net.cn/baseapi"
|
||
// "git.rosy.net.cn/baseapi/utils"
|
||
//)
|
||
//
|
||
//const (
|
||
// mustExistStoreID = "11053496"
|
||
// mustExistStoreJXID = "2"
|
||
//
|
||
// // mustExistStoreID = "11734851"
|
||
// // mustExistStoreJXID = "100118"
|
||
//)
|
||
//
|
||
//func TestGetAllCities(t *testing.T) {
|
||
// result, err := api.GetAllCities()
|
||
// if err != nil {
|
||
// t.Fatal(err)
|
||
// }
|
||
// t.Log(utils.Format4Output(result, false))
|
||
//}
|
||
//
|
||
func TestGetStationsByVenderId(t *testing.T) {
|
||
result, err := api.GetStationsByVenderId()
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
t.Log(utils.Format4Output(result, false))
|
||
}
|
||
|
||
func TestGetStoreInfoByStationNo(t *testing.T) {
|
||
result, err := api.GetStoreInfoByStationNo2("11918839")
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
t.Log(utils.Format4Output(result, false))
|
||
|
||
}
|
||
|
||
func TestUpdateStoreInfo4Open(t *testing.T) {
|
||
params := &OpStoreParams{
|
||
StationNo: "12664100",
|
||
StationName: "旺佳超市",
|
||
OutSystemID: "668836",
|
||
Mobile: "17751816719",
|
||
Phone: "17751816719",
|
||
Lat: 43.622098,
|
||
Lng: 122.275918,
|
||
City: 902,
|
||
County: 32769,
|
||
StationAddress: "内蒙古自治区通辽市科尔沁区百花新城",
|
||
Operator: "18981810340",
|
||
ServiceTimeEnd1: 44,
|
||
ServiceTimeStart1: 14,
|
||
CoordinateType: 3,
|
||
CloseStatus: 0,
|
||
}
|
||
err := api.UpdateStoreInfo4Open2(params, false)
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
|
||
}
|
||
|
||
func TestGetNextLevelByType(t *testing.T) {
|
||
api.GetNextLevelByType(902, "18981810")
|
||
}
|
||
|
||
//func TestGetCommentByOrderId(t *testing.T) {
|
||
// testOrderID := int64(922520919000622)
|
||
// result, err := api.GetCommentByOrderId2(testOrderID)
|
||
// if err != nil {
|
||
// t.Fatal(err.Error())
|
||
// }
|
||
// t.Log(utils.Format4Output(result, false))
|
||
//}
|
||
//
|
||
//func TestUpdateStoreConfig4Open(t *testing.T) {
|
||
// testStationNo := "11785740"
|
||
// desiredValue := true
|
||
// // 马上修改了后,通过GetStoreInfoByStationNo得到的数据不及时,测试不能过的。。。
|
||
// result, err := api.UpdateStoreConfig4Open(testStationNo, desiredValue)
|
||
// if err != nil || !result {
|
||
// if err != nil {
|
||
// t.Fatal(err.Error())
|
||
// }
|
||
// t.Fatal(result)
|
||
// }
|
||
// time.Sleep(2 * time.Second)
|
||
// result2, err := api.GetStoreInfoByStationNo2(testStationNo)
|
||
// if err != nil {
|
||
// t.Fatal(err.Error())
|
||
// }
|
||
// isAutoOrder := result2.IsAutoOrder
|
||
// if isAutoOrder != 0 && desiredValue || isAutoOrder == 0 && !desiredValue {
|
||
// t.Fatalf("UpdateStoreConfig4Open failed, isAutoOrder:%d", isAutoOrder)
|
||
// }
|
||
//}
|
||
//
|
||
//func TestDisableAutoOrder4AllStores(t *testing.T) {
|
||
// storeIDs, err := api.GetStationsByVenderId()
|
||
// if err != nil {
|
||
// t.Fatal(err)
|
||
// }
|
||
// for _, storeID := range storeIDs {
|
||
// if storeInfo, err := api.GetStoreInfoByStationNo2(storeID); err == nil {
|
||
// if storeInfo.Yn == 0 && storeInfo.IsAutoOrder == 0 {
|
||
// t.Log(storeID)
|
||
// api.UpdateStoreConfig4Open(storeID, false)
|
||
// }
|
||
// t.Log(utils.Format4Output(storeInfo, false))
|
||
// }
|
||
// break
|
||
// }
|
||
//}
|
||
//
|
||
//func TestUpdateStoreFreightConfigNew(t *testing.T) {
|
||
// err := api.UpdateStoreFreightConfigNew(&UpdateStoreFreightParam{
|
||
// UserPin: "test",
|
||
// MerchantStationNo: "2",
|
||
// OpenDistanceFreight: true,
|
||
// IsFullFree: true,
|
||
//
|
||
// StartCharge: 1890,
|
||
// })
|
||
// if err != nil {
|
||
// t.Fatal(err)
|
||
// }
|
||
//}
|
||
|
||
func TestGetDeliveryRangeByStationNo(t *testing.T) {
|
||
const testStoreID = "12511770"
|
||
result, err := api.GetDeliveryRangeByStationNo2(testStoreID)
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
||
}
|
||
|
||
func TestQueryMerchantMemberInfo(t *testing.T) {
|
||
result, err := api.GetCommonMemberRegisteredInfo("562012843072000442")
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
||
}
|
||
|
||
func Test1111(t *testing.T) {
|
||
fmt.Println(len("我爱你 ml1"))
|
||
}
|