到家商城的订单发通知消息

+Store.LinkStoreID
This commit is contained in:
gazebo
2020-02-04 16:20:09 +08:00
parent b76404d31d
commit f118cd8331
14 changed files with 249 additions and 185 deletions

View File

@@ -730,7 +730,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
store.Name = valid["name"].(string)
syncStatus |= model.SyncFlagStoreName
}
globals.SugarLogger.Debug(utils.Format4Output(valid, false))
// globals.SugarLogger.Debug(utils.Format4Output(valid, false))
printerVendorID := int(utils.Interface2Int64WithDefault(valid["printerVendorID"], 0))
if printerVendorID == 0 {
printerVendorID = store.PrinterVendorID
@@ -775,6 +775,13 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
handler.UnregisterPrinter(ctx, store.PrinterSN, store.PrinterKey)
}
}
if linkStoreID, ok := valid["linkStoreID"].(int); ok {
linkStoreID, err = getRealLinkStoreID(linkStoreID)
if err != nil {
return 0, err
}
valid["linkStoreID"] = linkStoreID
}
for _, v := range []string{
"lng",
@@ -1010,6 +1017,12 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
return 0, err
}
}
realLinkStoreID, err := getRealLinkStoreID(storeExt.LinkStoreID)
if err != nil {
return 0, err
}
storeExt.LinkStoreID = realLinkStoreID
existingID := store.ID
store.Lng = jxutils.StandardCoordinate2Int(storeExt.FloatLng)
store.Lat = jxutils.StandardCoordinate2Int(storeExt.FloatLat)
@@ -1048,6 +1061,21 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
return 0, err
}
func getRealLinkStoreID(linkStoreID int) (realLinkStoreID int, err error) {
if linkStoreID != 0 {
store := &model.Store{}
store.ID = linkStoreID
if err = dao.GetEntity(dao.GetDB(), store); err == nil {
if store.LinkStoreID != 0 {
realLinkStoreID = store.LinkStoreID
} else {
realLinkStoreID = linkStoreID
}
}
}
return realLinkStoreID, err
}
func GetStoreVendorMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, vendorID int) (storeMaps []*model.StoreMap, err error) {
cond := map[string]interface{}{
model.FieldStoreID: storeID,