This commit is contained in:
邹宗楠
2024-10-10 14:09:33 +08:00
parent 12918649cb
commit f6c53db233
5 changed files with 67 additions and 74 deletions

View File

@@ -6002,7 +6002,7 @@ func FilterByB2B(locationList []*common.Store4User) (retVal []*common.Store4User
}
//首页信息展示
func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDistance bool) (interface{}, string, error) {
func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDistance bool, brandId int) (interface{}, string, error) {
//获取门店信息
var (
storeID []int
@@ -6014,7 +6014,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis
StoreSkuInfos []StoreSkuInfo
homePages []HomePageInfos
)
locationList, err := common.GetStoreListByLocation(ctx, lng, lat, 20000, needWalkDistance, false, 0)
locationList, err := common.GetStoreListByLocation(ctx, lng, lat, 50000, needWalkDistance, false, brandId)
if err != nil {
return nil, "经纬度获取推荐门店失败", err
}

View File

@@ -1937,6 +1937,9 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
scaleFactor = 100 / float64(jxutils.ConstrainPayPercentage(storeDetail.PayPercentage))
}
for _, skuBindInfo := range skuBindInfos {
if skuBindInfo.StoreID == 668470 {
globals.SugarLogger.Debugf("---------skuBindInfo := %s", utils.Format4Output(skuBindInfo, false))
}
// 关注且没有给价时需要尝试从store_sku_bind中得到已有的单价
needGetExistingUnitPrice := skuBindInfo.UnitPrice == 0 && skuBindInfo.IsFocus == 1
inSkuBinds := skuBindInfo.Skus
@@ -2018,6 +2021,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
}
}
unitPrice = int(math.Floor(float64(unitPrice)*scaleFactor/10+0.5)) * 10 //四舍五入 价格为100倍 角分为十位个位 除以10 + 0.5对分位向下取整(完成四舍五入的方法)
globals.SugarLogger.Debugf("-----------allBinds := %s", utils.Format4Output(allBinds, false))
for _, v := range allBinds {
if v.Stock == 0 {
v.Stock = model.MaxStoreSkuStockQty
@@ -3728,19 +3732,20 @@ func ReCalculateJxPriceLight(db *dao.DaoDB, ctx *jxcontext.Context, storeID int)
func GetTopSkusByStoreIDs(ctx *jxcontext.Context, storeIDs []int) (storeSkuNameExt2 []*dao.StoreSkuNameExt, err error) {
var (
db = dao.GetDB()
skuMap = make(map[int]*dao.StoreSkuNameExt)
db = dao.GetDB()
skuMap = make(map[int]*dao.StoreSkuNameExt)
storeSkuNameExt = make([]*dao.StoreSkuNameExt, 0, 0)
)
if len(storeIDs) == 0 {
return storeSkuNameExt2, err
}
globals.SugarLogger.Debugf("---storeIds := %s", utils.Format4Output(storeIDs, false))
storeSkuNameExt, err := dao.GetTopSkusByStoreIDs(db, storeIDs)
if err != nil {
return nil, err
}
for _, v := range storeSkuNameExt {
globals.SugarLogger.Debugf("----------------storeSkuNameExtv := %d,%d", v.StoreID, v.SkuID)
for _, storeId := range storeIDs {
storeSkuName, err := dao.GetTopSkusByStoreIDs(db, []int{storeId})
if err != nil {
return nil, err
}
storeSkuNameExt = append(storeSkuNameExt, storeSkuName...)
}
for _, v := range storeSkuNameExt {
@@ -3762,9 +3767,6 @@ func GetTopSkusByStoreIDs(ctx *jxcontext.Context, storeIDs []int) (storeSkuNameE
}
}
}
for _, v := range storeSkuNameExt2 {
globals.SugarLogger.Debugf("---------------- storeSkuNameExt 2 v := %d,%d", v.StoreID, v.SkuID)
}
return storeSkuNameExt2, err
}