157 lines
3.8 KiB
Go
157 lines
3.8 KiB
Go
package jdapi
|
||
|
||
import (
|
||
"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("21103071")
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
t.Log(utils.Format4Output(result, false))
|
||
|
||
}
|
||
|
||
func TestUpdateStoreInfo4Open(t *testing.T) {
|
||
params := &OpStoreParams{
|
||
StationNo: "11890095",
|
||
OutSystemID: "100654",
|
||
Mobile: "18123353875",
|
||
Phone: "18123353875",
|
||
Lat: 30.745945,
|
||
Lng: 103.987782,
|
||
City: 1930,
|
||
County: 49322,
|
||
StationAddress: "郫都区成都市郫都区犀浦镇华都大道东一段330号1层连心菜市场34号",
|
||
Operator: "jxadmin-18981810340",
|
||
ServiceTimeEnd1: 38,
|
||
ServiceTimeStart1: 16,
|
||
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))
|
||
}
|