更改平台门店名称

This commit is contained in:
苏尹岚
2019-12-17 14:10:44 +08:00
parent 81ea19b80a
commit a02dbdeacc
6 changed files with 47 additions and 20 deletions

View File

@@ -11,6 +11,7 @@ import (
"strconv"
"strings"
"time"
"unicode/utf8"
"github.com/360EntSecGroup-Skylar/excelize"
@@ -1149,6 +1150,13 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
if valid["status"] != nil {
syncStatus |= model.SyncFlagStoreStatus
}
if valid["vendorStoreName"] != nil {
vendorStoreName := valid["vendorStoreName"].(string)
if utf8.RuneCountInString(vendorStoreName) > 13 && vendorID == model.VendorIDJD {
return 0, fmt.Errorf("门店名称不允许超过13位")
}
syncStatus |= model.SyncFlagStoreName
}
for _, v := range [][]string{
[]string{
"pricePercentagePack",
@@ -1189,7 +1197,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
panic(r)
}
}()
if valid["status"] != nil { // 对于store vendor map只有Status改变才需要同步到厂商
if valid["status"] != nil || valid["vendorStoreName"] != nil { // 对于store vendor map只有Status改变才需要同步到厂商
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
model.FieldStoreID: storeID,
model.FieldVendorID: vendorID,
@@ -1222,7 +1230,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
}
}
dao.Commit(db)
if vendorID != model.VendorIDJX && (valid["status"] != nil || valid["freightDeductionPack"] != nil) {
if vendorID != model.VendorIDJX && (valid["status"] != nil || valid["freightDeductionPack"] != nil || valid["vendorStoreName"] != nil) {
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
}
}