aa
This commit is contained in:
@@ -962,7 +962,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
mapBefore := refutil.FindMapAndStructMixed(valid, beforStore)
|
||||
err = AddEventDetail(db, ctx, model.OperateUpdate, storeID, model.ThingTypeStore, storeID, BuildDiffData(mapBefore), BuildDiffData(valid))
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
dao.Rollback(db, txDB)
|
||||
}()
|
||||
@@ -1262,7 +1262,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1348,6 +1348,12 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
||||
if isSync, ok := payload["isSync"].(int); ok && isSync == 0 {
|
||||
delete(payload, "isSync")
|
||||
}
|
||||
var vendorOrgCode = ""
|
||||
if payload["vendorOrgCode"].(string) == "" {
|
||||
return 0, fmt.Errorf("平台账号不能为空")
|
||||
} else {
|
||||
vendorOrgCode = payload["vendorOrgCode"].(string)
|
||||
}
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
@@ -1408,7 +1414,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
||||
if err == nil {
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(valid, false))
|
||||
if len(valid) > 0 {
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1419,11 +1425,13 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
||||
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
|
||||
model.FieldStoreID: storeID,
|
||||
model.FieldVendorID: vendorID,
|
||||
"VendorOrgCode": vendorOrgCode,
|
||||
}, model.FieldSyncStatus, syncStatus)
|
||||
} else {
|
||||
num, err = dao.UpdateEntityLogically(db, storeMap, valid, userName, map[string]interface{}{
|
||||
model.FieldStoreID: storeID,
|
||||
model.FieldVendorID: vendorID,
|
||||
"VendorOrgCode": vendorOrgCode,
|
||||
})
|
||||
}
|
||||
if err != nil {
|
||||
@@ -1485,7 +1493,7 @@ func DeleteStore(ctx *jxcontext.Context, storeID int) (num int64, err error) {
|
||||
return 0, fmt.Errorf("删除京西门店前必须将所有门店解绑且门店处于关店状态")
|
||||
}
|
||||
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer dao.Rollback(db, txDB)
|
||||
now := time.Now()
|
||||
|
||||
@@ -1599,7 +1607,7 @@ func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, keyword string, storeI
|
||||
sql += " LIMIT ? OFFSET ?"
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
var commentList []*JxBadCommentsExt
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
dao.Rollback(db, txDB)
|
||||
}()
|
||||
@@ -2110,7 +2118,7 @@ func updateVendorStoreStatusBySnapshot(db *dao.DaoDB, curSnapshotList []*model.V
|
||||
for _, v := range curSnapshotList {
|
||||
snapshotMap[jxutils.Combine2Int(v.StoreID, v.VendorID)] = v
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil || err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -2147,7 +2155,7 @@ func updateVendorStoreStatusBySnapshot(db *dao.DaoDB, curSnapshotList []*model.V
|
||||
}
|
||||
|
||||
func SaveStoresVendorSnapshot(db *dao.DaoDB, snapshotAt time.Time, curSnapshotList []*model.VendorStoreSnapshot) (err error) {
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil || err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -2881,7 +2889,7 @@ func CreateStorePriceScore(ctx *jxcontext.Context) (err error) {
|
||||
snapshotAt = utils.Time2Date(time.Now().AddDate(0, 0, -1))
|
||||
storePriceScoreSnapshot, err := dao.GetStorePriceScoreSnapshot(db, snapshotAt)
|
||||
if len(storePriceScoreSnapshot) > 0 {
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil || err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -2911,7 +2919,7 @@ func RefreshJdLevel(ctx *jxcontext.Context) (err error) {
|
||||
db := dao.GetDB()
|
||||
storeMapList, err := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, nil, model.StoreStatusOpened, -1, "", "", "")
|
||||
if len(storeMapList) > 0 {
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil || err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -3201,7 +3209,7 @@ func AddStoreCategoryMap(ctx *jxcontext.Context, storeCategoryMap *model.StoreCa
|
||||
}
|
||||
storeCategoryMap.StoreCategoryName = strings.Trim(storeCategoryMap.StoreCategoryName, " ")
|
||||
dao.WrapAddIDCULDEntity(storeCategoryMap, ctx.GetUserName())
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -3311,7 +3319,7 @@ func UpdateStoreCategoryMap(ctx *jxcontext.Context, ID int, storeCategoryMap *mo
|
||||
} else {
|
||||
SetStoreCategorySyncStatus2(db, []int{storeCategoryMap2.StoreID}, []int{storeCategoryMap.CategoryID, storeCategoryMap2.CategoryID}, model.SyncFlagModifiedMask)
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -3340,7 +3348,7 @@ func ReorderStoreCategories(ctx *jxcontext.Context, parentID, storeID int, categ
|
||||
for _, cat := range storeCatsMap {
|
||||
catsMap[cat.CategoryID] = cat
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -3396,7 +3404,7 @@ func CopyStoreCategories(ctx *jxcontext.Context, fromStoreID int, toStoreIDs, ca
|
||||
storeID := batchItemList[0].(int)
|
||||
//证明是要全复制
|
||||
if len(categoryIDs) == 0 {
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -3433,7 +3441,7 @@ func CopyStoreCategories(ctx *jxcontext.Context, fromStoreID int, toStoreIDs, ca
|
||||
if len(list) > 0 {
|
||||
return retVal, fmt.Errorf("该门店已有重复绑定的京西分类!storeID: %v,categroyID: %v", storeID, v)
|
||||
} else {
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -3550,7 +3558,7 @@ func UpdateStorePricePack(ctx *jxcontext.Context, storeID, vendorID int, pricePa
|
||||
return fmt.Errorf("目前只允许扣点的门店修改调价包!")
|
||||
}
|
||||
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -3936,7 +3944,7 @@ func UpdateBrand(ctx *jxcontext.Context, payload map[string]interface{}, isDel b
|
||||
} else {
|
||||
valid := dao.StrictMakeMapByStructObject(payload, brand, ctx.GetUserName())
|
||||
if len(valid) > 0 {
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
|
||||
Reference in New Issue
Block a user