This commit is contained in:
苏尹岚
2021-04-06 08:51:10 +08:00
parent e066132005
commit 73653d654a

View File

@@ -84,7 +84,7 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
case 0:
priceReferSnapshot, err := dao.GetStatisticsReportForStoreSkusPrice(db, cityCodes, skuIDs)
if len(priceReferSnapshot) > 0 {
txDB , _ := dao.Begin(db)
txDB, _ := dao.Begin(db)
defer func() {
if r := recover(); r != nil || err != nil {
dao.Rollback(db, txDB)
@@ -214,7 +214,7 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
}
resultMap[k1] = skuNameMap
}
txDB , _ := dao.Begin(db)
txDB, _ := dao.Begin(db)
defer func() {
if r := recover(); r != nil || err != nil {
dao.Rollback(db, txDB)
@@ -246,7 +246,7 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
}
dao.Commit(db, txDB)
case 2:
txDB , _ := dao.Begin(db)
txDB, _ := dao.Begin(db)
defer func() {
if r := recover(); r != nil || err != nil {
dao.Rollback(db, txDB)
@@ -461,6 +461,9 @@ func RefreshStoreManageState(ctx *jxcontext.Context) {
}
storeDetail, _ := dao.GetStoreDetail(db, storeMap.StoreID, vendorID, storeMap.VendorOrgCode)
storeManage := buildStoreManageState(ctx, db, storeMap, storeDetail, messageFlag)
if storeManage == nil {
return retVal, err
}
if storeManageStates, err := dao.GetStoreManageStateSimple(db, []int{storeDetail.ID}, nil, vendorID); err == nil && len(storeManageStates) > 0 {
storeManage.ID = storeManageStates[0].ID
dao.UpdateEntity(db, storeManage)
@@ -485,7 +488,10 @@ func buildStoreManageState(ctx *jxcontext.Context, db *dao.DaoDB, storeMap *mode
}
dao.WrapAddIDCULEntity(storeManage, ctx.GetUserName())
handler := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID)
store, _ := handler.ReadStore(ctx, storeDetail.VendorOrgCode, storeDetail.VendorStoreID)
store, err := handler.ReadStore(ctx, storeDetail.VendorOrgCode, storeDetail.VendorStoreID)
if err != nil || store == nil {
return nil
}
// if coverAreaFlag {
if storeMap.VendorID == model.VendorIDJD && store.DeliveryRangeType != model.DeliveryRangeTypePolygon {
storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", math.Pi*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)))