- 重构authz结构
- 角色管理初版完成
This commit is contained in:
@@ -532,6 +532,10 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
}
|
||||
|
||||
valid := dao.StrictMakeMapByStructObject(payload, store, userName)
|
||||
if err = dao.ValidateRoles(db, utils.Interface2String(valid["marketManRole"]), utils.Interface2String(valid["OperatorRole"])); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if payload["lng"] != nil || payload["lat"] != nil {
|
||||
intLng := jxutils.StandardCoordinate2Int(utils.Interface2Float64WithDefault(payload["lng"], 0.0))
|
||||
intLat := jxutils.StandardCoordinate2Int(utils.Interface2Float64WithDefault(payload["lat"], 0.0))
|
||||
@@ -708,7 +712,10 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
if store.ID != 0 && !jxutils.IsLegalStoreID(store.ID) {
|
||||
return 0, fmt.Errorf("ID:%d不是合法的京西门店编号", store.ID)
|
||||
}
|
||||
|
||||
db := dao.GetDB()
|
||||
if err = dao.ValidateRoles(db, store.MarketManRole, store.OperatorRole); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
existingID := store.ID
|
||||
store.Lng = jxutils.StandardCoordinate2Int(storeExt.FloatLng)
|
||||
store.Lat = jxutils.StandardCoordinate2Int(storeExt.FloatLat)
|
||||
@@ -736,7 +743,7 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(store, userName)
|
||||
store.ID = existingID
|
||||
if err = dao.CreateEntity(nil, store); err == nil {
|
||||
if err = dao.CreateEntity(db, store); err == nil {
|
||||
UpdateOrCreateCourierStores(ctx, store.ID, false, false, false)
|
||||
BindMobile2Store(ctx, storeExt.Tel1, storeExt.ID)
|
||||
return store.ID, err
|
||||
|
||||
Reference in New Issue
Block a user