This commit is contained in:
邹宗楠
2024-10-09 16:14:31 +08:00
parent 8311d3996e
commit 1f6dc7185e
4 changed files with 8 additions and 11 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}