package logic import ( "context" "strings" . "app.yhyue.com/moapp/jybase/common" "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc" "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types" "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb" "github.com/zeromicro/go-zero/core/logx" ) type ResEmpowerLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewResEmpowerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ResEmpowerLogic { return &ResEmpowerLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *ResEmpowerLogic) ResEmpower(req *types.ResEmpowerReq) (resp *types.Resp, err error) { entUserIds := []int64{} for _, v := range strings.Split(req.EntUserId, ",") { entUserIds = append(entUserIds, Int64All(v)) } r, err := l.svcCtx.ResourceCenterRpc.Empower(context.Background(), &pb.EmpowerReq{ Appid: "10000", FunctionCode: req.FunctionCode, EntId: req.EntId, EntUserId: entUserIds, }) var status int64 if err != nil { l.Error(err) } else { status = r.Status } resp = &types.Resp{ Error_code: 0, Data: map[string]interface{}{ "status": status, }, } return }