123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package service
- import (
- . "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/entity"
- )
- /*
- * 获取已有的权益
- * @param appid
- * @param function_code 功能代码
- * @param user_id 用户id
- * @param ent_id 企业id
- * @return 所有已开通的权益
- */
- func HasPowers(appid string, user_id, ent_id, ent_user_id int64) []string {
- result := []string{}
- m := map[string]bool{}
- bps := Base_power.FindMyPowers(appid, user_id, ent_id)
- if bps != nil {
- for _, v := range *bps {
- if v.Power_type == 1 || (v.Power_type == 2 && Base_ent_empower.HasEmpower(appid, v.Function_code, ent_id, ent_user_id)) {
- if m[v.Function_code] {
- continue
- }
- m[v.Function_code] = true
- result = append(result, v.Function_code)
- }
- }
- }
- return result
- }
- /*
- * 获取已有的权益
- * @param appid
- * @param function_code 功能代码
- * @param user_id 用户id
- * @param ent_id 企业id
- * @return 所有已开通的权益
- */
- func ReDistribution(appid string, ent_id int64, ent_user_id []int) []string {
- result := []string{}
- m := map[string]bool{}
- bps := Base_power.FindMyPowers(appid, user_id, ent_id)
- if bps != nil {
- for _, v := range *bps {
- if v.Power_type == 1 || (v.Power_type == 2 && Base_ent_empower.HasEmpower(appid, v.Function_code, ent_id, ent_user_id)) {
- if m[v.Function_code] {
- continue
- }
- m[v.Function_code] = true
- result = append(result, v.Function_code)
- }
- }
- }
- return result
- }
|