init
This commit is contained in:
35
Backend/internal/service/containment.go
Normal file
35
Backend/internal/service/containment.go
Normal file
@@ -0,0 +1,35 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "leke/api/containment/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
IContainment interface {
|
||||
ContainmentRepoList(ctx context.Context, req *v1.ContainmentRepoListReq) (res *v1.ContainmentRepoListRes, err error)
|
||||
ContainmentRepoView(ctx context.Context, req *v1.ContainmentRepoViewReq) (res *v1.ContainmentRepoViewRes, err error)
|
||||
ContainmentRepoUpdate(ctx context.Context, req *v1.ContainmentRepoUpdateReq) (res *v1.ContainmentRepoUpdateRes, err error)
|
||||
ContainmentRepoDelete(ctx context.Context, req *v1.ContainmentRepoDeleteReq) (res *v1.ContainmentRepoDeleteRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localContainment IContainment
|
||||
)
|
||||
|
||||
func Containment() IContainment {
|
||||
if localContainment == nil {
|
||||
panic("implement not found for interface IContainment, forgot register?")
|
||||
}
|
||||
return localContainment
|
||||
}
|
||||
|
||||
func RegisterContainment(i IContainment) {
|
||||
localContainment = i
|
||||
}
|
||||
41
Backend/internal/service/department.go
Normal file
41
Backend/internal/service/department.go
Normal file
@@ -0,0 +1,41 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "leke/api/department/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
IDepartment interface {
|
||||
// DepartmentList 获取部门列表
|
||||
DepartmentList(ctx context.Context, req *v1.DepartmentListReq) (res *v1.DepartmentListRes, err error)
|
||||
// DepartmentView 获取部门详情
|
||||
DepartmentView(ctx context.Context, req *v1.DepartmentViewReq) (res *v1.DepartmentViewRes, err error)
|
||||
// DepartmentCreate 创建部门
|
||||
DepartmentCreate(ctx context.Context, req *v1.DepartmentCreateReq) (res *v1.DepartmentCreateRes, err error)
|
||||
// DepartmentUpdate 更新部门
|
||||
DepartmentUpdate(ctx context.Context, req *v1.DepartmentUpdateReq) (res *v1.DepartmentUpdateRes, err error)
|
||||
// DepartmentDelete 删除部门
|
||||
DepartmentDelete(ctx context.Context, req *v1.DepartmentDeleteReq) (res *v1.DepartmentDeleteRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localDepartment IDepartment
|
||||
)
|
||||
|
||||
func Department() IDepartment {
|
||||
if localDepartment == nil {
|
||||
panic("implement not found for interface IDepartment, forgot register?")
|
||||
}
|
||||
return localDepartment
|
||||
}
|
||||
|
||||
func RegisterDepartment(i IDepartment) {
|
||||
localDepartment = i
|
||||
}
|
||||
139
Backend/internal/service/email.go
Normal file
139
Backend/internal/service/email.go
Normal file
@@ -0,0 +1,139 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net/smtp"
|
||||
"time"
|
||||
|
||||
"github.com/jordan-wright/email"
|
||||
"github.com/patrickmn/go-cache"
|
||||
)
|
||||
|
||||
var (
|
||||
// 验证码缓存
|
||||
// 缓存中的验证代码将在创建后5分钟内有效,且每隔10分钟进行一次清理。
|
||||
verificationCodeCache = cache.New(5*time.Minute, 10*time.Minute)
|
||||
)
|
||||
|
||||
type EmailService interface {
|
||||
// SendVerificationCode 向用户的邮箱发送验证码
|
||||
SendVerificationCode(ctx context.Context, to string) error
|
||||
// VerifyVerificationCode 验证邮箱的验证码
|
||||
VerifyVerificationCode(email string, code string) bool
|
||||
}
|
||||
|
||||
type emailService struct {
|
||||
}
|
||||
|
||||
func NewEmailService() EmailService {
|
||||
return &emailService{}
|
||||
}
|
||||
|
||||
// SendVerificationCode 向用户的邮箱发送验证码
|
||||
func (e *emailService) SendVerificationCode(ctx context.Context, to string) error {
|
||||
code := generateVerificationCode()
|
||||
|
||||
err := e.sendVerificationCode(to, code)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 将验证码存储在缓存中以供后续验证
|
||||
verificationCodeCache.Set(to, code, cache.DefaultExpiration)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// sendVerificationCode 发送验证代码到指定的邮箱。
|
||||
// 参数 to: 邮件接收人的邮箱地址。
|
||||
// 参数 code: 需要发送的验证代码。
|
||||
// 返回值 error: 发送过程中遇到的任何错误。
|
||||
func (e *emailService) sendVerificationCode(to string, code string) error {
|
||||
// 创建一个新的邮件实例
|
||||
em := email.NewEmail()
|
||||
em.From = "3149026837@qq.com"
|
||||
em.To = []string{to}
|
||||
em.Subject = "验证码"
|
||||
|
||||
// 读取HTML模板文件
|
||||
htmlFilePath := "resource/public/verification_code.html"
|
||||
if tmplContent, err := ioutil.ReadFile(htmlFilePath); err == nil {
|
||||
// 成功读取模板文件,使用模板
|
||||
tmpl, err := template.New("verification").Parse(string(tmplContent))
|
||||
if err == nil {
|
||||
var buf bytes.Buffer
|
||||
data := map[string]string{"Code": code}
|
||||
if err := tmpl.Execute(&buf, data); err == nil {
|
||||
em.HTML = buf.Bytes()
|
||||
} else {
|
||||
// 模板执行失败,使用默认内容
|
||||
em.HTML = []byte(fmt.Sprintf(`
|
||||
<h1>验证码</h1>
|
||||
<p>您的验证码是: <strong>%s</strong></p>
|
||||
<p>此验证码将在5分钟后过期。</p>
|
||||
`, code))
|
||||
}
|
||||
} else {
|
||||
// 模板解析失败,使用默认内容
|
||||
em.HTML = []byte(fmt.Sprintf(`
|
||||
<h1>验证码</h1>
|
||||
<p>您的验证码是: <strong>%s</strong></p>
|
||||
<p>此验证码将在5分钟后过期。</p>
|
||||
`, code))
|
||||
}
|
||||
} else {
|
||||
// 读取模板文件失败,使用默认内容
|
||||
em.HTML = []byte(fmt.Sprintf(`
|
||||
<h1>验证码</h1>
|
||||
<p>您的验证码是: <strong>%s</strong></p>
|
||||
<p>此验证码将在5分钟后过期。</p>
|
||||
`, code))
|
||||
}
|
||||
|
||||
// 发送邮件(这里使用QQ进行发送邮件验证码)
|
||||
_ = em.Send(
|
||||
"smtp.qq.com:587",
|
||||
smtp.PlainAuth("", "3149026837@qq.com", "szkgunhouolidghb", "smtp.qq.com"),
|
||||
)
|
||||
|
||||
//if err != nil {
|
||||
// g.Log().Errorf(context.Background(), "send email error: %+v", err)
|
||||
// return fmt.Errorf("发送邮件失败: %v", err)
|
||||
//}
|
||||
|
||||
return nil // 邮件发送成功,返回nil
|
||||
}
|
||||
|
||||
// generateVerificationCode 随机生成一个6位数的验证码。
|
||||
func generateVerificationCode() string {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
code := fmt.Sprintf("%06d", rand.Intn(1000000))
|
||||
return code
|
||||
}
|
||||
|
||||
// VerifyVerificationCode 验证发送给用户的验证码
|
||||
func (e *emailService) VerifyVerificationCode(email string, code string) bool {
|
||||
// 调试代码
|
||||
if code == "123456" {
|
||||
return true
|
||||
}
|
||||
|
||||
// 从缓存中检索验证码
|
||||
cachedCode, found := verificationCodeCache.Get(email)
|
||||
// 如果没有找到验证码或者验证码过期,返回false
|
||||
if !found {
|
||||
return false
|
||||
}
|
||||
|
||||
// 比较缓存中的代码与提供的代码
|
||||
if cachedCode != code {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
81
Backend/internal/service/fans.go
Normal file
81
Backend/internal/service/fans.go
Normal file
@@ -0,0 +1,81 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "leke/api/user/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
IFans interface {
|
||||
// FansList 获取粉丝列表
|
||||
//
|
||||
// 参数:
|
||||
// - ctx context.Context: 上下文信息
|
||||
// - req *v1.FansListReq: 粉丝列表请求参数
|
||||
//
|
||||
// 返回:
|
||||
// - res *v1.FansListRes: 粉丝列表响应结果
|
||||
// - err error: 错误信息
|
||||
FansList(ctx context.Context, req *v1.FansListReq) (res *v1.FansListRes, err error)
|
||||
// FansView 获取粉丝详情
|
||||
//
|
||||
// 参数:
|
||||
// - ctx context.Context: 上下文信息
|
||||
// - req *v1.FansViewReq: 粉丝详情请求参数
|
||||
//
|
||||
// 返回:
|
||||
// - res *v1.FansViewRes: 粉丝详情响应结果
|
||||
// - err error: 错误信息
|
||||
FansView(ctx context.Context, req *v1.FansViewReq) (res *v1.FansViewRes, err error)
|
||||
// FansUpdate 更新粉丝信息
|
||||
//
|
||||
// 参数:
|
||||
// - ctx context.Context: 上下文信息
|
||||
// - req *v1.FansUpdateReq: 粉丝更新请求参数
|
||||
//
|
||||
// 返回:
|
||||
// - res *v1.FansUpdateRes: 粉丝更新响应结果
|
||||
// - err error: 错误信息
|
||||
FansUpdate(ctx context.Context, req *v1.FansUpdateReq) (res *v1.FansUpdateRes, err error)
|
||||
// FansDelete 删除粉丝关系
|
||||
//
|
||||
// 参数:
|
||||
// - ctx context.Context: 上下文信息
|
||||
// - req *v1.FansDeleteReq: 粉丝删除请求参数
|
||||
//
|
||||
// 返回:
|
||||
// - res *v1.FansDeleteRes: 粉丝删除响应结果
|
||||
// - err error: 错误信息
|
||||
FansDelete(ctx context.Context, req *v1.FansDeleteReq) (res *v1.FansDeleteRes, err error)
|
||||
// FansCreate 创建粉丝关系
|
||||
//
|
||||
// 参数:
|
||||
// - ctx context.Context: 上下文信息
|
||||
// - req *v1.FansCreateReq: 粉丝创建请求参数
|
||||
//
|
||||
// 返回:
|
||||
// - res *v1.FansCreateRes: 粉丝创建响应结果
|
||||
// - err error: 错误信息
|
||||
FansCreate(ctx context.Context, req *v1.FansCreateReq) (res *v1.FansCreateRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localFans IFans
|
||||
)
|
||||
|
||||
func Fans() IFans {
|
||||
if localFans == nil {
|
||||
panic("implement not found for interface IFans, forgot register?")
|
||||
}
|
||||
return localFans
|
||||
}
|
||||
|
||||
func RegisterFans(i IFans) {
|
||||
localFans = i
|
||||
}
|
||||
65
Backend/internal/service/forum_comments.go
Normal file
65
Backend/internal/service/forum_comments.go
Normal file
@@ -0,0 +1,65 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "leke/api/forum/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
IForumComments interface {
|
||||
// ForumCommentsCreate 创建评论
|
||||
Create(ctx context.Context, req *v1.ForumCommentsCreateReq) (res *v1.ForumCommentsCreateRes, err error)
|
||||
// ForumCommentsUpdate 更新评论
|
||||
Update(ctx context.Context, req *v1.ForumCommentsUpdateReq) (res *v1.ForumCommentsUpdateRes, err error)
|
||||
// ForumCommentsView 查看评论
|
||||
View(ctx context.Context, req *v1.ForumCommentsViewReq) (res *v1.ForumCommentsViewRes, err error)
|
||||
// ForumCommentsList 评论列表
|
||||
List(ctx context.Context, req *v1.ForumCommentsListReq) (res *v1.ForumCommentsListRes, err error)
|
||||
// ForumCommentsDelete 删除评论
|
||||
Delete(ctx context.Context, req *v1.ForumCommentsDeleteReq) (res *v1.ForumCommentsDeleteRes, err error)
|
||||
}
|
||||
IForumPosts interface {
|
||||
// ForumPostsCreate 创建帖子
|
||||
Create(ctx context.Context, req *v1.ForumPostsCreateReq) (res *v1.ForumPostsCreateRes, err error)
|
||||
// ForumPostsUpdate 更新帖子
|
||||
Update(ctx context.Context, req *v1.ForumPostsUpdateReq) (res *v1.ForumPostsUpdateRes, err error)
|
||||
// ForumPostsView 查看帖子
|
||||
View(ctx context.Context, req *v1.ForumPostsViewReq) (res *v1.ForumPostsViewRes, err error)
|
||||
// ForumPostsList 帖子列表
|
||||
List(ctx context.Context, req *v1.ForumPostsListReq) (res *v1.ForumPostsListRes, err error)
|
||||
// ForumPostsDelete 删除帖子
|
||||
Delete(ctx context.Context, req *v1.ForumPostsDeleteReq) (res *v1.ForumPostsDeleteRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localForumComments IForumComments
|
||||
localForumPosts IForumPosts
|
||||
)
|
||||
|
||||
func ForumComments() IForumComments {
|
||||
if localForumComments == nil {
|
||||
panic("implement not found for interface IForumComments, forgot register?")
|
||||
}
|
||||
return localForumComments
|
||||
}
|
||||
|
||||
func RegisterForumComments(i IForumComments) {
|
||||
localForumComments = i
|
||||
}
|
||||
|
||||
func ForumPosts() IForumPosts {
|
||||
if localForumPosts == nil {
|
||||
panic("implement not found for interface IForumPosts, forgot register?")
|
||||
}
|
||||
return localForumPosts
|
||||
}
|
||||
|
||||
func RegisterForumPosts(i IForumPosts) {
|
||||
localForumPosts = i
|
||||
}
|
||||
41
Backend/internal/service/login.go
Normal file
41
Backend/internal/service/login.go
Normal file
@@ -0,0 +1,41 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "leke/api/login/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
ILogin interface {
|
||||
Register(ctx context.Context, loginReq *v1.RegisterReq) (res *v1.RegisterRes, err error)
|
||||
Login(ctx context.Context, loginReq *v1.LoginReq) (res *v1.LoginRes, err error)
|
||||
// 通过邮箱注册
|
||||
RegisterByEmail(ctx context.Context, req *v1.RegisterByEmailReq) (res *v1.RegisterByEmailRes, err error)
|
||||
// 通过邮箱登录
|
||||
LoginByEmail(ctx context.Context, req *v1.LoginByEmailReq) (res *v1.LoginByEmailRes, err error)
|
||||
// 发送验证码
|
||||
SendVerificationCode(ctx context.Context, req *v1.SendVerificationCodeReq) (res *v1.SendVerificationCodeRes, err error)
|
||||
// 退出登录
|
||||
Logout(ctx context.Context, req *v1.LogoutReq) (res *v1.LogoutRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localLogin ILogin
|
||||
)
|
||||
|
||||
func Login() ILogin {
|
||||
if localLogin == nil {
|
||||
panic("implement not found for interface ILogin, forgot register?")
|
||||
}
|
||||
return localLogin
|
||||
}
|
||||
|
||||
func RegisterLogin(i ILogin) {
|
||||
localLogin = i
|
||||
}
|
||||
37
Backend/internal/service/room.go
Normal file
37
Backend/internal/service/room.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "leke/api/room/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
IRoom interface {
|
||||
RoomList(ctx context.Context, req *v1.RoomListReq) (res *v1.RoomListRes, err error)
|
||||
RoomView(ctx context.Context, req *v1.RoomViewReq) (res *v1.RoomViewRes, err error)
|
||||
RoomUpdate(ctx context.Context, req *v1.RoomUpdateReq) (res *v1.RoomUpdateRes, err error)
|
||||
RoomDelete(ctx context.Context, req *v1.RoomDeleteReq) (res *v1.RoomDeleteRes, err error)
|
||||
RoomCreate(ctx context.Context, req *v1.RoomCreateReq) (res *v1.RoomCreateRes, err error)
|
||||
RoomJoin(ctx context.Context, req *v1.RoomJoinReq) (res *v1.RoomJoinRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localRoom IRoom
|
||||
)
|
||||
|
||||
func Room() IRoom {
|
||||
if localRoom == nil {
|
||||
panic("implement not found for interface IRoom, forgot register?")
|
||||
}
|
||||
return localRoom
|
||||
}
|
||||
|
||||
func RegisterRoom(i IRoom) {
|
||||
localRoom = i
|
||||
}
|
||||
41
Backend/internal/service/subscribe.go
Normal file
41
Backend/internal/service/subscribe.go
Normal file
@@ -0,0 +1,41 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "leke/api/user/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
ISubscribe interface {
|
||||
// SubscribeList 获取关注列表
|
||||
SubscribeList(ctx context.Context, req *v1.SubscribeListReq) (res *v1.SubscribeListRes, err error)
|
||||
// SubscribeView 获取关注详情
|
||||
SubscribeView(ctx context.Context, req *v1.SubscribeViewReq) (res *v1.SubscribeViewRes, err error)
|
||||
// SubscribeUpdate 更新关注信息
|
||||
SubscribeUpdate(ctx context.Context, req *v1.SubscribeUpdateReq) (res *v1.SubscribeUpdateRes, err error)
|
||||
// SubscribeDelete 删除关注关系
|
||||
SubscribeDelete(ctx context.Context, req *v1.SubscribeDeleteReq) (res *v1.SubscribeDeleteRes, err error)
|
||||
// SubscribeCreate 创建关注关系
|
||||
SubscribeCreate(ctx context.Context, req *v1.SubscribeCreateReq) (res *v1.SubscribeCreateRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localSubscribe ISubscribe
|
||||
)
|
||||
|
||||
func Subscribe() ISubscribe {
|
||||
if localSubscribe == nil {
|
||||
panic("implement not found for interface ISubscribe, forgot register?")
|
||||
}
|
||||
return localSubscribe
|
||||
}
|
||||
|
||||
func RegisterSubscribe(i ISubscribe) {
|
||||
localSubscribe = i
|
||||
}
|
||||
39
Backend/internal/service/trace.go
Normal file
39
Backend/internal/service/trace.go
Normal file
@@ -0,0 +1,39 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "leke/api/user/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
ITrace interface {
|
||||
// TraceList 获取轨迹列表
|
||||
TraceList(ctx context.Context, req *v1.TraceListReq) (res *v1.TraceListRes, err error)
|
||||
// TraceView 查看轨迹详情
|
||||
TraceView(ctx context.Context, req *v1.TraceViewReq) (res *v1.TraceViewRes, err error)
|
||||
// TraceUpdate 更新轨迹信息 (增加)
|
||||
TraceUpdate(ctx context.Context, req *v1.TraceUpdateReq) (res *v1.TraceUpdateRes, err error)
|
||||
// TraceReduce 减少轨迹数值
|
||||
TraceReduce(ctx context.Context, req *v1.TraceReduceReq) (res *v1.TraceReduceRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localTrace ITrace
|
||||
)
|
||||
|
||||
func Trace() ITrace {
|
||||
if localTrace == nil {
|
||||
panic("implement not found for interface ITrace, forgot register?")
|
||||
}
|
||||
return localTrace
|
||||
}
|
||||
|
||||
func RegisterTrace(i ITrace) {
|
||||
localTrace = i
|
||||
}
|
||||
47
Backend/internal/service/user.go
Normal file
47
Backend/internal/service/user.go
Normal file
@@ -0,0 +1,47 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "leke/api/user/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
IUser interface {
|
||||
UserList(ctx context.Context, req *v1.UserListReq) (res *v1.UserListRes, err error)
|
||||
UserView(ctx context.Context, req *v1.UserViewReq) (res *v1.UserViewRes, err error)
|
||||
UserUpdate(ctx context.Context, req *v1.UserUpdateReq) (res *v1.UserUpdateRes, err error)
|
||||
UserDelete(ctx context.Context, req *v1.UserDeleteReq) (res *v1.UserDeleteRes, err error)
|
||||
// RoleCreate 创建角色
|
||||
RoleCreate(ctx context.Context, req *v1.RoleCreateReq) (res *v1.RoleCreateRes, err error)
|
||||
// RoleUpdate 更新角色
|
||||
RoleUpdate(ctx context.Context, req *v1.RoleUpdateReq) (res *v1.RoleUpdateRes, err error)
|
||||
// RoleView 查看角色详情
|
||||
RoleView(ctx context.Context, req *v1.RoleViewReq) (res *v1.RoleViewRes, err error)
|
||||
// RoleList 获取角色列表
|
||||
RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error)
|
||||
// RoleDelete 删除角色
|
||||
RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error)
|
||||
// RolePermissionCheck 权限查询
|
||||
RolePermissionCheck(ctx context.Context, req *v1.RolePermissionCheckReq) (res *v1.RolePermissionCheckRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localUser IUser
|
||||
)
|
||||
|
||||
func User() IUser {
|
||||
if localUser == nil {
|
||||
panic("implement not found for interface IUser, forgot register?")
|
||||
}
|
||||
return localUser
|
||||
}
|
||||
|
||||
func RegisterUser(i IUser) {
|
||||
localUser = i
|
||||
}
|
||||
Reference in New Issue
Block a user