|
@@ -84,7 +84,9 @@ func (b *base_ent_empower) Empower(appid, function_code string, ent_id int64, en
|
|
|
nowFormat := NowFormat(Date_Full_Layout)
|
|
|
values := []interface{}{}
|
|
|
for _, v := range ent_user_id {
|
|
|
- values = append(values, appid, ent_id, Int64All(v), function_code, nowFormat)
|
|
|
+ for _, vv := range strings.Split(function_code, ",") {
|
|
|
+ values = append(values, appid, ent_id, Int64All(v), vv, nowFormat)
|
|
|
+ }
|
|
|
}
|
|
|
r1, _ := Mysql_BaseService.InsertBatch("base_ent_empower", fields, values)
|
|
|
return r1 == int64(len(ent_user_id))
|
|
@@ -92,12 +94,17 @@ func (b *base_ent_empower) Empower(appid, function_code string, ent_id int64, en
|
|
|
|
|
|
//取消授权
|
|
|
func (b *base_ent_empower) CancelEmpower(appid, function_code string, ent_id int64, ent_user_id []int64) bool {
|
|
|
- args := []interface{}{appid, function_code, ent_id}
|
|
|
- wh := []string{}
|
|
|
+ args := []interface{}{appid, ent_id}
|
|
|
+ wh1 := []string{}
|
|
|
+ for _, v := range strings.Split(function_code, ",") {
|
|
|
+ wh1 = append(wh1, "?")
|
|
|
+ args = append(args, v)
|
|
|
+ }
|
|
|
+ wh2 := []string{}
|
|
|
for _, v := range ent_user_id {
|
|
|
- wh = append(wh, "?")
|
|
|
+ wh2 = append(wh2, "?")
|
|
|
args = append(args, v)
|
|
|
}
|
|
|
- r1 := Mysql_BaseService.UpdateOrDeleteBySql(`delete from base_ent_empower where appid=? and function_code=? and ent_id=? and ent_user_id in (`+strings.Join(wh, ",")+`)`, args...)
|
|
|
+ r1 := Mysql_BaseService.UpdateOrDeleteBySql(`delete from base_ent_empower where appid=? and ent_id=? and function_code in (`+strings.Join(wh1, ",")+`) and ent_user_id in (`+strings.Join(wh2, ",")+`)`, args...)
|
|
|
return r1 == int64(len(ent_user_id))
|
|
|
}
|