---jd shop
This commit is contained in:
@@ -4753,7 +4753,7 @@ func QueryPageStores2(db *dao.DaoDB, pageSize, offset int, keyword, vendorStoreI
|
|||||||
if vendorID == -1 {
|
if vendorID == -1 {
|
||||||
sql += sqlJD + ` UNION`
|
sql += sqlJD + ` UNION`
|
||||||
sql += sqlMT + ` UNION`
|
sql += sqlMT + ` UNION`
|
||||||
sql += sqlEbai
|
sql += sqlEbai + ` UNION`
|
||||||
sql += sqlGD
|
sql += sqlGD
|
||||||
} else {
|
} else {
|
||||||
switch vendorID {
|
switch vendorID {
|
||||||
|
|||||||
@@ -5282,7 +5282,7 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto
|
|||||||
globals.SugarLogger.Debugf("doStoreSkuAudit cover storeID : %v nameID: %v", storeID, skuBindInfo.NameID)
|
globals.SugarLogger.Debugf("doStoreSkuAudit cover storeID : %v nameID: %v", storeID, skuBindInfo.NameID)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false, fmt.Errorf("未查询到该门店商品价,storeID: %v, nameID: %V", storeID, skuBindInfo.NameID)
|
return false, fmt.Errorf("未查询到该门店商品价,storeID: %v, nameID: %v", storeID, skuBindInfo.NameID)
|
||||||
}
|
}
|
||||||
storeSkuAudit.Type = model.StoreSkuAuditTypePrice
|
storeSkuAudit.Type = model.StoreSkuAuditTypePrice
|
||||||
storeSkuAudit.OriginUnitPrice = int(storeSkus[0].UnitPrice)
|
storeSkuAudit.OriginUnitPrice = int(storeSkus[0].UnitPrice)
|
||||||
@@ -5350,7 +5350,7 @@ func doStoreSkuAuditForGy(ctx *jxcontext.Context, storeIDs []int, skuBindInfos [
|
|||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("doStoreSkuAudit cover storeID : %v nameID: %v", storeID, skuBindInfo.NameID)
|
globals.SugarLogger.Debugf("doStoreSkuAudit cover storeID : %v nameID: %v", storeID, skuBindInfo.NameID)
|
||||||
} else {
|
} else {
|
||||||
return false, fmt.Errorf("未查询到该门店商品价,storeID: %v, nameID: %V", storeID, skuBindInfo.NameID)
|
return false, fmt.Errorf("未查询到该门店商品价,storeID: %v, nameID: %v", storeID, skuBindInfo.NameID)
|
||||||
}
|
}
|
||||||
storeSkuAudit.Type = model.StoreSkuAuditTypePrice
|
storeSkuAudit.Type = model.StoreSkuAuditTypePrice
|
||||||
storeSkuAudit.OriginUnitPrice = int(storeSkus[0].UnitPrice)
|
storeSkuAudit.OriginUnitPrice = int(storeSkus[0].UnitPrice)
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package cms
|
package cms
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
func TestGetStoresVendorSnapshot(t *testing.T) {
|
func TestGetStoresVendorSnapshot(t *testing.T) {
|
||||||
result, err := GetStoresVendorSnapshot(jxcontext.AdminCtx, nil, []int{model.VendorIDEBAI}, nil)
|
result, err := GetStoresVendorSnapshot(jxcontext.AdminCtx, nil, []int{model.VendorIDEBAI}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -33,3 +33,121 @@ func TestUpdateVendorStoreStatusBySnapshot(t *testing.T) {
|
|||||||
curSnapshotList, _ := dao.GetVendorStoreSnapshot(db, utils.Str2Time("2019-07-30 08:00:00"))
|
curSnapshotList, _ := dao.GetVendorStoreSnapshot(db, utils.Str2Time("2019-07-30 08:00:00"))
|
||||||
updateVendorStoreStatusBySnapshot(db, curSnapshotList)
|
updateVendorStoreStatusBySnapshot(db, curSnapshotList)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
func TestGetBrands(t *testing.T) {
|
||||||
|
var test bool = false
|
||||||
|
if test {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
func TestAbs(t *testing.T) {
|
||||||
|
got := 1
|
||||||
|
if got != 1 {
|
||||||
|
t.Errorf("Abs(-1) = %d; want 1", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetBrands1(t *testing.T) {
|
||||||
|
type args struct {
|
||||||
|
ctx *jxcontext.Context
|
||||||
|
name string
|
||||||
|
brandID int
|
||||||
|
isManage bool
|
||||||
|
}
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
wantGetBrandsResult []*GetBrandsResult
|
||||||
|
wantErr bool
|
||||||
|
}{
|
||||||
|
// TODO: Add test cases.
|
||||||
|
|
||||||
|
}
|
||||||
|
var test bool = false
|
||||||
|
if test {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
gotGetBrandsResult, err := GetBrands(tt.args.ctx, tt.args.name, tt.args.brandID, tt.args.isManage)
|
||||||
|
if (err != nil) != tt.wantErr {
|
||||||
|
t.Errorf("GetBrands() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(gotGetBrandsResult, tt.wantGetBrandsResult) {
|
||||||
|
t.Errorf("GetBrands() gotGetBrandsResult = %v, want %v", gotGetBrandsResult, tt.wantGetBrandsResult)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestQueryPageStores2(t *testing.T) {
|
||||||
|
type args struct {
|
||||||
|
db *dao.DaoDB
|
||||||
|
pageSize int
|
||||||
|
offset int
|
||||||
|
keyword string
|
||||||
|
vendorStoreID string
|
||||||
|
brandName string
|
||||||
|
vendorID int
|
||||||
|
cityCode int
|
||||||
|
districtCode int
|
||||||
|
tel string
|
||||||
|
minShopScore float32
|
||||||
|
minRecentOrderNum int
|
||||||
|
minSkuCount int
|
||||||
|
lng1 float64
|
||||||
|
lat1 float64
|
||||||
|
lng2 float64
|
||||||
|
lat2 float64
|
||||||
|
cat string
|
||||||
|
}
|
||||||
|
dbt := dao.GetDB()
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
wantPagedInfo *model.PagedInfo
|
||||||
|
wantErr bool
|
||||||
|
}{
|
||||||
|
// TODO: Add test cases.
|
||||||
|
{
|
||||||
|
"测试1",
|
||||||
|
args{
|
||||||
|
dbt,
|
||||||
|
15,
|
||||||
|
0,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"", //缺
|
||||||
|
-1,
|
||||||
|
510000,
|
||||||
|
0, //缺
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
104.066301,
|
||||||
|
30.572961,
|
||||||
|
104.066301,
|
||||||
|
30.572961,
|
||||||
|
"",
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
gotPagedInfo, err := QueryPageStores2(tt.args.db, tt.args.pageSize, tt.args.offset, tt.args.keyword, tt.args.vendorStoreID, tt.args.brandName, tt.args.vendorID, tt.args.cityCode, tt.args.districtCode, tt.args.tel, tt.args.minShopScore, tt.args.minRecentOrderNum, tt.args.minSkuCount, tt.args.lng1, tt.args.lat1, tt.args.lng2, tt.args.lat2, tt.args.cat)
|
||||||
|
if (err != nil) != tt.wantErr {
|
||||||
|
t.Errorf("QueryPageStores2() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(gotPagedInfo, tt.wantPagedInfo) {
|
||||||
|
t.Errorf("QueryPageStores2() gotPagedInfo = %v, want %v", gotPagedInfo, tt.wantPagedInfo)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ func TestEarthDistance(t *testing.T) {
|
|||||||
lng2, lat2 := 116.407395, 39.904211
|
lng2, lat2 := 116.407395, 39.904211
|
||||||
distance := EarthDistance(lng1, lat1, lng2, lat2)
|
distance := EarthDistance(lng1, lat1, lng2, lat2)
|
||||||
fmt.Print(distance)
|
fmt.Print(distance)
|
||||||
|
fmt.Print("测试中....")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMapValue2Scope(t *testing.T) {
|
func TestMapValue2Scope(t *testing.T) {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ func QueryConfigs(db *DaoDB, key, configType, keyword string) (configList []*mod
|
|||||||
|
|
||||||
err = GetRows(db, &configList, sql, sqlParams...)
|
err = GetRows(db, &configList, sql, sqlParams...)
|
||||||
if err == nil && len(configList) == 0 && key != "" {
|
if err == nil && len(configList) == 0 && key != "" {
|
||||||
|
fmt.Println("条件:key:,type:,keyword:不能找到配置", key, configType, keyword)
|
||||||
err = fmt.Errorf("条件:key:%s,type:%s,keyword:%s不能找到配置", key, configType, keyword)
|
err = fmt.Errorf("条件:key:%s,type:%s,keyword:%s不能找到配置", key, configType, keyword)
|
||||||
}
|
}
|
||||||
return configList, err
|
return configList, err
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestGetStoreDetail(t *testing.T) {
|
func TestGetStoreDetail(t *testing.T) {
|
||||||
storeDetail, err := GetStoreDetailByVendorStoreID(GetDB(), "11733077", 0)
|
storeDetail, err := GetStoreDetailByVendorStoreID(GetDB(), "11733077", 0, "全部")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ func TestFormalizeStoreStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetStoreList4Role(t *testing.T) {
|
func TestGetStoreList4Role(t *testing.T) {
|
||||||
storeList, err := GetStoreList(GetDB(), nil, nil, nil, nil, "NiuBi")
|
storeList, err := GetStoreList(GetDB(), nil, nil, nil, nil, []string{"18048531223"}, "全部")
|
||||||
t.Log(utils.Format4Output(storeList, false))
|
t.Log(utils.Format4Output(storeList, false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -40,7 +40,7 @@ func TestGetStoreList4Role(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetStoresMapList(t *testing.T) {
|
func TestGetStoresMapList(t *testing.T) {
|
||||||
storeList, err := GetStoresMapList(GetDB(), nil, nil, nil, model.StoreStatusClosed, model.StoreIsSyncYes, "")
|
storeList, err := GetStoresMapList(GetDB(), nil, nil, nil, model.StoreStatusClosed, model.StoreIsSyncYes, "", "", "全部")
|
||||||
t.Log(utils.Format4Output(storeList, false))
|
t.Log(utils.Format4Output(storeList, false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package jdshop
|
package jdshop
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/jdshopapi"
|
"git.rosy.net.cn/baseapi/platformapi/jdshopapi"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@@ -16,6 +17,7 @@ func TestSaveJdsOrders(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
// TODO: Add test cases.
|
// TODO: Add test cases.
|
||||||
}
|
}
|
||||||
|
fmt.Println("测试1")
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
if err := SaveJdsOrders(tt.args.msg); (err != nil) != tt.wantErr {
|
if err := SaveJdsOrders(tt.args.msg); (err != nil) != tt.wantErr {
|
||||||
@@ -23,4 +25,5 @@ func TestSaveJdsOrders(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
fmt.Println("测试2")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -19,6 +20,8 @@ func init() {
|
|||||||
|
|
||||||
// TestGet is a sample to run an endpoint test
|
// TestGet is a sample to run an endpoint test
|
||||||
func TestGet(t *testing.T) {
|
func TestGet(t *testing.T) {
|
||||||
|
fmt.Print("测试中\n")
|
||||||
|
fmt.Print("测试中1")
|
||||||
//r, _ := http.NewRequest("GET", "/v1/object", nil)
|
//r, _ := http.NewRequest("GET", "/v1/object", nil)
|
||||||
//w := httptest.NewRecorder()
|
//w := httptest.NewRecorder()
|
||||||
//beego.BeeApp.Handlers.ServeHTTP(w, r)
|
//beego.BeeApp.Handlers.ServeHTTP(w, r)
|
||||||
|
|||||||
Reference in New Issue
Block a user