Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop

This commit is contained in:
邹宗楠
2022-01-27 15:16:37 +08:00
7 changed files with 131 additions and 7 deletions

View File

@@ -1,13 +1,14 @@
package cms
import (
"git.rosy.net.cn/baseapi/utils"
"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/dao"
"reflect"
"testing"
)
/*
func TestGetStoresVendorSnapshot(t *testing.T) {
result, err := GetStoresVendorSnapshot(jxcontext.AdminCtx, nil, []int{model.VendorIDEBAI}, nil)
if err != nil {
@@ -32,3 +33,121 @@ func TestUpdateVendorStoreStatusBySnapshot(t *testing.T) {
curSnapshotList, _ := dao.GetVendorStoreSnapshot(db, utils.Str2Time("2019-07-30 08:00:00"))
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)
}
})
}
}

View File

@@ -18,6 +18,7 @@ func TestEarthDistance(t *testing.T) {
lng2, lat2 := 116.407395, 39.904211
distance := EarthDistance(lng1, lat1, lng2, lat2)
fmt.Print(distance)
fmt.Print("测试中....")
}
func TestMapValue2Scope(t *testing.T) {

View File

@@ -34,6 +34,7 @@ func QueryConfigs(db *DaoDB, key, configType, keyword string) (configList []*mod
err = GetRows(db, &configList, sql, sqlParams...)
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)
}
return configList, err

View File

@@ -9,7 +9,7 @@ import (
)
func TestGetStoreDetail(t *testing.T) {
storeDetail, err := GetStoreDetailByVendorStoreID(GetDB(), "11733077", 0)
storeDetail, err := GetStoreDetailByVendorStoreID(GetDB(), "11733077", 0, "全部")
if err != nil {
t.Fatal(err)
}
@@ -32,7 +32,7 @@ func TestFormalizeStoreStatus(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))
if err != nil {
t.Fatal(err)
@@ -40,7 +40,7 @@ func TestGetStoreList4Role(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))
if err != nil {
t.Fatal(err)

View File

@@ -1,6 +1,7 @@
package jdshop
import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/jdshopapi"
"testing"
)
@@ -16,6 +17,7 @@ func TestSaveJdsOrders(t *testing.T) {
}{
// TODO: Add test cases.
}
fmt.Println("测试1")
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := SaveJdsOrders(tt.args.msg); (err != nil) != tt.wantErr {
@@ -23,4 +25,5 @@ func TestSaveJdsOrders(t *testing.T) {
}
})
}
fmt.Println("测试2")
}

View File

@@ -587,7 +587,7 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) {
if storeOrder.StoreID == 668357 {
storeOrder.StoreID = 131
}
partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, 131, storeOrder.ActualPayPrice, 1, 1, orderPay.VendorOrderID)
partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, 131, storeOrder.ActualPayPrice, 1, 1, "")
}
}
case model.PayTypeTL_BrandBillCharge:

View File

@@ -20,8 +20,8 @@ func init() {
// TestGet is a sample to run an endpoint test
func TestGet(t *testing.T) {
fmt.Println("123")
fmt.Print("测试中\n")
fmt.Print("测试中1")
//r, _ := http.NewRequest("GET", "/v1/object", nil)
//w := httptest.NewRecorder()
//beego.BeeApp.Handlers.ServeHTTP(w, r)