123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- package impl
- import (
- "context"
- "gd_admin/apis"
- "gd_admin/impl/action"
- "gd_admin/impl/admin"
- "gd_admin/impl/auth"
- "gd_admin/impl/dbmodel"
- "gd_admin/impl/rbac"
- "gd_admin/common.in/task"
- "github.com/astaxie/beego/orm"
- )
- // 具体实现
- type Rcvr struct {
- }
- func (c *Rcvr) AdminLogin(ctx context.Context, req *apis.AdminLoginReq, reply *apis.AdminLoginReply) error {
- t1 := func() error {
- return admin.AdminLogin(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) AdminRegister(ctx context.Context, req *apis.AdminRegisterReq, reply *apis.AdminRegisterReply) error {
- t1 := func() error {
- return admin.AdminRegister(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) AdminDelete(ctx context.Context, req *apis.AdminDeleteReq, reply *apis.AdminDeleteReply) error {
- t1 := func() error {
- return admin.AdminDelete(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) AdminModify(ctx context.Context, req *apis.AdminModifyReq, reply *apis.AdminModifyReply) error {
- t1 := func() error {
- return admin.AdminModify(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) AdminGetAll(ctx context.Context, req *apis.AdminGetAllReq, reply *apis.AdminGetAllReply) error {
- t1 := func() error {
- return admin.AdminGetAll(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) GetRbacAccess(ctx context.Context, req *apis.GetAccessReq, reply *apis.GetAccessReply) error {
- t1 := func() error {
- return rbac.GetAccess(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) GetRbacGroupList(ctx context.Context, req *apis.GetRbacGroupListReq, reply *apis.GetRbacGroupListReply) error {
- t1 := func() error {
- return rbac.GetGroupList(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) UpdateRbacGroup(ctx context.Context, req *apis.UpdateRbacGroupReq, reply *apis.UpdateRbacGroupReply) error {
- t1 := func() error {
- return rbac.UpdateGroup(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) DeleteRbacGroup(ctx context.Context, req *apis.DeleteRbacGroupReq, reply *apis.DeleteRbacGroupReply) error {
- t1 := func() error {
- return rbac.DeleteGroup(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) AddRbacGroup(ctx context.Context, req *apis.AddRbacGroupReq, reply *apis.AddRbacGroupReply) error {
- t1 := func() error {
- return rbac.AddGroup(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) GetNodeList(ctx context.Context, req *apis.GetNodeListReq, reply *apis.GetNodeListReply) error {
- t1 := func() error {
- return rbac.GetList(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) UpdateAdminStatus(ctx context.Context, req *apis.UpdateStatusReq, reply *apis.UpdateStatusReply) error {
- t1 := func() error {
- return admin.UpdateStatus(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func (c *Rcvr) GetInfo(ctx context.Context, req *apis.GetInfoReq, reply *apis.GetInfoReply) error {
- t1 := func() error {
- return admin.GetInfo(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- // AddActionLog 添加用户行为日志
- func (c *Rcvr) AddActionLog(ctx context.Context, req *apis.AddActionLogReq, reply *apis.AddActionLogReply) error {
- t1 := func() error {
- return action.Add(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- // GetActionLog 获取用户行为日志
- func (c *Rcvr) GetActionLog(ctx context.Context, req *apis.GetLogReq, reply *apis.GetLogReply) error {
- t1 := func() error {
- return action.Log(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- // 获取oss sts授权
- func (r *Rcvr) AuthGetOSSInfo(ctx context.Context, req *apis.AuthGetOSSInfoReq, reply *apis.AuthGetOSSInfoReply) (err error) {
- t1 := func() error {
- return auth.AuthGetOSSInfo(ctx, req, reply)
- }
- return task.Do(ctx, t1)
- }
- func RegisterOrmModel() {
- orm.RegisterModel(new(apis.AdminInfo),
- new(admin.AdminLoginLog),
- new(dbmodel.TGdAdminRbacAccess),
- new(dbmodel.TGdAdminRbacGroup),
- new(dbmodel.TGdAdminRbacNode),
- new(dbmodel.Action))
- }
|