You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
3.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package BaseRoleService
import (
"context"
"dsBaseWeb/Business/BaseRole/BaseRoleProto"
"dsBaseWeb/Utils/GRpcUtil"
"dsBaseWeb/Utils/LogUtil"
"errors"
"time"
)
/**
功能根据系统ID或身份ID获取角色信息
作者:吴缤
时间2021-01-04
*/
func PageBaseRole(arg BaseRoleProto.QueryArg) (*BaseRoleProto.Reply, error) {
//1、准备动作连接服务器
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := GRpcUtil.GetConnection()
if conn == nil {
return nil, errors.New("RPC服务未启动")
}
//2、业务传参
c := BaseRoleProto.NewBaseRoleManageClient(conn)
Reply, err := c.PageBaseRole(ctx, &arg)
if err != nil {
LogUtil.Error("根据系统ID或身份ID获取角色信息错误: ", err.Error())
}
return Reply, err
}
/**
功能根据角色ID获取该菜单信息
作者:吴缤
时间2021-01-04
*/
func GetBaseRole(arg BaseRoleProto.ModelArg) (*BaseRoleProto.Reply, error) {
//1、准备动作连接服务器
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := GRpcUtil.GetConnection()
if conn == nil {
return nil, errors.New("RPC服务未启动")
}
//2、业务传参
c := BaseRoleProto.NewBaseRoleManageClient(conn)
Reply, err := c.GetBaseRole(ctx, &arg)
if err != nil {
LogUtil.Error("根据角色ID获取该菜单信息错误: ", err.Error())
}
return Reply, err
}
/**
功能:增加角色信息
作者:吴缤
时间2021-01-04
*/
func AddBaseRole(arg BaseRoleProto.ModelArg) (*BaseRoleProto.Reply, error) {
//1、准备动作连接服务器
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := GRpcUtil.GetConnection()
if conn == nil {
return nil, errors.New("RPC服务未启动")
}
//2、业务传参
c := BaseRoleProto.NewBaseRoleManageClient(conn)
Reply, err := c.AddBaseRole(ctx, &arg)
if err != nil {
LogUtil.Error("增加角色信息错误: ", err.Error())
}
return Reply, err
}
/**
功能:删除角色信息
作者:吴缤
时间2021-01-04
*/
func DeleteBaseRole(arg BaseRoleProto.DeleteIdsArg) (*BaseRoleProto.Reply, error) {
//1、准备动作连接服务器
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := GRpcUtil.GetConnection()
if conn == nil {
return nil, errors.New("RPC服务未启动")
}
//2、业务传参
c := BaseRoleProto.NewBaseRoleManageClient(conn)
Reply, err := c.DeleteBaseRole(ctx, &arg)
if err != nil {
LogUtil.Error("删除角色信息错误: ", err.Error())
}
return Reply, err
}
/**
功能:修改角色信息
作者:吴缤
时间2021-01-04
*/
func UpdateBaseRole(arg BaseRoleProto.ModelArg) (*BaseRoleProto.Reply, error) {
//1、准备动作连接服务器
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := GRpcUtil.GetConnection()
if conn == nil {
return nil, errors.New("RPC服务未启动")
}
//2、业务传参
c := BaseRoleProto.NewBaseRoleManageClient(conn)
Reply, err := c.UpdateBaseRole(ctx, &arg)
if err != nil {
LogUtil.Error("修改角色信息错误: ", err.Error())
}
return Reply, err
}