From 1f6dc7185e7d0400e412b02a7b416c60b6531a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 9 Oct 2024 16:14:31 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/store.go | 4 ++++ business/jxstore/cms/store_sku.go | 4 ---- business/model/dao/store_sku.go | 7 ------- controllers/cms_store.go | 4 ++++ 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 45943e120..23d665b8c 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -6014,7 +6014,9 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis StoreSkuInfos []StoreSkuInfo homePages []HomePageInfos ) + beginTime := time.Now() locationList, err := common.GetStoreListByLocation(ctx, lng, lat, 20000, needWalkDistance, false, 0) + baseapi.SugarLogger.Infof("GetTopSkusByStoreIDs usedMilliSecond------2:%d", time.Now().Sub(beginTime)/time.Millisecond) if err != nil { return nil, "经纬度获取推荐门店失败", err } @@ -6046,6 +6048,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis StoreSkuInfos = append(StoreSkuInfos, storeSkuInfo) } + baseapi.SugarLogger.Infof("GetTopSkusByStoreIDs usedMilliSecond------3:%d", time.Now().Sub(beginTime)/time.Millisecond) for _, v := range filterStore { //获取门店品牌信息 brandInfos, err := dao.GetStoreBrandInfos(v.ID) @@ -6113,6 +6116,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } homePages = append(homePages, homePage) } + baseapi.SugarLogger.Infof("GetTopSkusByStoreIDs usedMilliSecond------4:%d", time.Now().Sub(beginTime)/time.Millisecond) return homePages, "", nil } diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index dda3dc658..8f8701b68 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -3734,13 +3734,10 @@ func GetTopSkusByStoreIDs(ctx *jxcontext.Context, storeIDs []int) (storeSkuNameE if len(storeIDs) == 0 { return storeSkuNameExt2, err } - beginTime := time.Now() storeSkuNameExt, err := dao.GetTopSkusByStoreIDs(db, storeIDs) if err != nil { return nil, err } - usedMilliSecond := time.Now().Sub(beginTime) / time.Millisecond - baseapi.SugarLogger.Infof("GetTopSkusByStoreIDs usedMilliSecond------1:%d", usedMilliSecond) for _, v := range storeSkuNameExt { if skuMap[v.SkuID] == nil { @@ -3761,7 +3758,6 @@ func GetTopSkusByStoreIDs(ctx *jxcontext.Context, storeIDs []int) (storeSkuNameE } } } - baseapi.SugarLogger.Infof("GetTopSkusByStoreIDs usedMilliSecond------2:%d", time.Now().Sub(beginTime)/time.Millisecond) return storeSkuNameExt2, err } diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 0efd79de6..ed7ef245f 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -3,7 +3,6 @@ package dao import ( "errors" "fmt" - "git.rosy.net.cn/baseapi" "strings" "time" @@ -1237,10 +1236,7 @@ func GetTopSkusByStoreIDs(db *DaoDB, storeIDs []int) (storeSkuNameExt []*StoreSk sqlParams = append(sqlParams, model.StoreSkuBindStatusNormal, utils.DefaultTimeValue, model.ActSkuDirectDown, model.ActSkuSecKill, utils.DefaultTimeValue, model.SkuStatusNormal, utils.DefaultTimeValue, model.SkuStatusNormal, utils.DefaultTimeValue, model.StoreStatusDisabled, storeIDs, utils.DefaultTimeValue, model.StoreSkuBindStatusNormal, 30) - beginTime := time.Now() err = GetRows(db, &storeSkuNameExt, sql, sqlParams...) - usedMilliSecond := time.Now().Sub(beginTime) / time.Millisecond - baseapi.SugarLogger.Infof("GetTopSkusByStoreIDs usedMilliSecond------44:%d", usedMilliSecond) var skuNamesInfo = &StoreSkuNamesInfo{ SkuNames: storeSkuNameExt, } @@ -1275,10 +1271,7 @@ func GetTopSkusByStoreIDs(db *DaoDB, storeIDs []int) (storeSkuNameExt []*StoreSk skuIdList = append(skuIdList, v.SkuID) } } - baseapi.SugarLogger.Infof("GetTopSkusByStoreIDs usedMilliSecond------55:%d", time.Now().Sub(beginTime)/time.Millisecond) err = UpdateActPrice4StoreSkuNameNew(db, storeIDs, skuIdList, skuNamesInfo, model.VendorIDJX) - baseapi.SugarLogger.Infof("GetTopSkusByStoreIDs usedMilliSecond------66:%d", time.Now().Sub(beginTime)/time.Millisecond) - return storeSkuNameExt, err } diff --git a/controllers/cms_store.go b/controllers/cms_store.go index 433450492..21ba146e4 100644 --- a/controllers/cms_store.go +++ b/controllers/cms_store.go @@ -4,9 +4,11 @@ import ( "bytes" "encoding/json" "errors" + "git.rosy.net.cn/baseapi" "git.rosy.net.cn/jx-callback/business/authz/autils" "git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm" "strings" + "time" "git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/jx-callback/business/partner" @@ -651,7 +653,9 @@ func (c *StoreController) GetStoreListByLocation() { // @router /GetHomePageByLocation [get] func (c *StoreController) GetHomePageByLocation() { c.callGetHomePageByLocation(func(params *tStoreGetHomePageByLocationParams) (interface{}, string, error) { + beginTime := time.Now() details, _, err := cms.GetHomePageByLocation(params.Ctx, params.Lng, params.Lat, params.NeedWalkDistance) + baseapi.SugarLogger.Infof("GetTopSkusByStoreIDs usedMilliSecond------1:%d", time.Now().Sub(beginTime)/time.Millisecond) if err != nil { return nil, "根据经纬度获取门店详细信息失败", err }