aa
This commit is contained in:
@@ -183,33 +183,33 @@ var (
|
||||
"payeeBankCode": "开户行代码",
|
||||
"payPercentage": "支付比例",
|
||||
}
|
||||
roleMoblieMap = map[string]string{
|
||||
"17380734342": "17380734342", //漆云的手机 ,用于判断updatestore的权限
|
||||
"18328080405": "18328080405", //肖娜娜的手机
|
||||
"13350726500": "13350726500", //谭翔心
|
||||
"15928865396": "15928865396", //何佳梦
|
||||
"18048531223": "18048531223", //石老板
|
||||
"18982250714": "18982250714", //赵敏夫
|
||||
"13708196093": "13708196093", //顾子航
|
||||
"15680070110": "15680070110", //李荣维
|
||||
"15208271238": "15208271238",
|
||||
}
|
||||
// roleMoblieMap = map[string]string{
|
||||
// "17380734342": "17380734342", //漆云的手机 ,用于判断updatestore的权限
|
||||
// "18328080405": "18328080405", //肖娜娜的手机
|
||||
// "13350726500": "13350726500", //谭翔心
|
||||
// "15928865396": "15928865396", //何佳梦
|
||||
// "18048531223": "18048531223", //石老板
|
||||
// "18982250714": "18982250714", //赵敏夫
|
||||
// "13708196093": "13708196093", //顾子航
|
||||
// "15680070110": "15680070110", //李荣维
|
||||
// "15208271238": "15208271238",
|
||||
// }
|
||||
|
||||
marketManPhoneRoleMap = map[string]string{
|
||||
"marketManPhone": "市场负责人电话",
|
||||
}
|
||||
|
||||
marketManPhoneRoleMoblieMap = map[string]string{
|
||||
"13684045763": "13684045763",
|
||||
"18160030913": "18160030913",
|
||||
"18048531223": "18048531223",
|
||||
"18328080405": "18328080405",
|
||||
"17380734342": "17380734342",
|
||||
"15208271238": "15208271238",
|
||||
"18583684218": "18583684218",
|
||||
"18982250714": "18982250714",
|
||||
"13708196093": "13708196093",
|
||||
}
|
||||
// marketManPhoneRoleMoblieMap = map[string]string{
|
||||
// "13684045763": "13684045763",
|
||||
// "18160030913": "18160030913",
|
||||
// "18048531223": "18048531223",
|
||||
// "18328080405": "18328080405",
|
||||
// "17380734342": "17380734342",
|
||||
// "15208271238": "15208271238",
|
||||
// "18583684218": "18583684218",
|
||||
// "18982250714": "18982250714",
|
||||
// "13708196093": "13708196093",
|
||||
// }
|
||||
)
|
||||
|
||||
func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]interface{}, orderTimeFrom, orderTimeTo time.Time) (sql string, sqlParams []interface{}, sqlFrom string, sqlFromParams []interface{}, err error) {
|
||||
@@ -921,20 +921,26 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
}
|
||||
|
||||
for k, _ := range valid {
|
||||
if roleMap[k] != "" {
|
||||
if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
|
||||
if roleMoblieMap[authInfo.Mobile] == "" {
|
||||
return 0, errors.New(fmt.Sprintf("当前用户 [%v] 无权限修改 [%v] 字段!", authInfo.Name, roleMap[k]))
|
||||
}
|
||||
}
|
||||
}
|
||||
if marketManPhoneRoleMap[k] != "" {
|
||||
if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
|
||||
if marketManPhoneRoleMoblieMap[authInfo.Mobile] == "" {
|
||||
return 0, errors.New(fmt.Sprintf("当前用户 [%v] 无权限修改 [%v] 字段!", authInfo.Name, roleMap[k]))
|
||||
}
|
||||
if roleMap[k] != "" || marketManPhoneRoleMap[k] != "" {
|
||||
menus, _ := dao.GetMenu(db, "结算权限", 0, 1, ctx.GetUserID())
|
||||
if len(menus) == 0 {
|
||||
return 0, errors.New(fmt.Sprintf("当前用户 [%v] 无权限修改此字段!", ctx.GetUserName()))
|
||||
}
|
||||
}
|
||||
// if roleMap[k] != "" {
|
||||
// if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
|
||||
// if roleMoblieMap[authInfo.Mobile] == "" {
|
||||
// return 0, errors.New(fmt.Sprintf("当前用户 [%v] 无权限修改 [%v] 字段!", authInfo.Name, roleMap[k]))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if marketManPhoneRoleMap[k] != "" {
|
||||
// if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
|
||||
// if marketManPhoneRoleMoblieMap[authInfo.Mobile] == "" {
|
||||
// return 0, errors.New(fmt.Sprintf("当前用户 [%v] 无权限修改 [%v] 字段!", authInfo.Name, roleMap[k]))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// districtCode := 0
|
||||
|
||||
@@ -16,17 +16,17 @@ import (
|
||||
|
||||
func GetMenu(ctx *jxcontext.Context, userID string) (menus []*model.Menu, err error) {
|
||||
if userID == "" {
|
||||
return dao.GetMenu(dao.GetDB(), "", 0, userID)
|
||||
return dao.GetMenu(dao.GetDB(), "", 0, 0, userID)
|
||||
} else {
|
||||
if user, err := dao.GetUserByID(dao.GetDB(), "user_id", userID); err == nil {
|
||||
if user.Type&model.UserTypeRole != 0 {
|
||||
return dao.GetMenuWithUser(dao.GetDB(), "", 0, userID)
|
||||
} else {
|
||||
return dao.GetMenu(dao.GetDB(), "", 0, "")
|
||||
return dao.GetMenu(dao.GetDB(), "", 0, 0, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
return dao.GetMenu(dao.GetDB(), "", 0, userID)
|
||||
return dao.GetMenu(dao.GetDB(), "", 0, 0, userID)
|
||||
}
|
||||
|
||||
func AddMenu(ctx *jxcontext.Context, menu *model.Menu) (err error) {
|
||||
@@ -39,7 +39,7 @@ func AddMenu(ctx *jxcontext.Context, menu *model.Menu) (err error) {
|
||||
if menu.Name == "" || menu.Level == 0 {
|
||||
return fmt.Errorf("添加失败!menu 名称和等级必须有值!")
|
||||
}
|
||||
menus, err := dao.GetMenu(db, menu.Name, menu.Level, "")
|
||||
menus, err := dao.GetMenu(db, menu.Name, menu.Level, 0, "")
|
||||
if len(menus) > 0 {
|
||||
return fmt.Errorf("添加失败!已存在相同名称的 menu name : %v", menu.Name)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
func GetMenu(db *DaoDB, name string, level int, userID string) (menus []*model.Menu, err error) {
|
||||
func GetMenu(db *DaoDB, name string, level, menuType int, userID string) (menus []*model.Menu, err error) {
|
||||
sqlParams := []interface{}{}
|
||||
sql := `
|
||||
SELECT DISTINCT a.*
|
||||
@@ -29,6 +29,10 @@ func GetMenu(db *DaoDB, name string, level int, userID string) (menus []*model.M
|
||||
sql += " AND a.level = ?"
|
||||
sqlParams = append(sqlParams, level)
|
||||
}
|
||||
if menuType != 0 {
|
||||
sql += " AND a.type = ?"
|
||||
sqlParams = append(sqlParams, menuType)
|
||||
}
|
||||
sql += " ORDER BY a.id"
|
||||
err = GetRows(db, &menus, sql, sqlParams)
|
||||
return menus, err
|
||||
|
||||
Reference in New Issue
Block a user