mirror of
https://github.com/PengZhangs2017582/novel.git
synced 2025-06-23 18:51:31 +08:00
redis token
This commit is contained in:
@ -25,7 +25,7 @@ func New() *cLogin {
|
||||
return &cLogin{}
|
||||
}
|
||||
|
||||
func (c *cLogin) CreateOrLogin(ctx context.Context, req *backend.CreateOrLoginReq) (res *backend.CreateOrLoginRes, err error) {
|
||||
func (c *cLogin) CreateOrLogin(ctx context.Context, req *backend.CreateOrLoginReq) (res *backend.CreateLoginRes, err error) {
|
||||
input := model.WriterCreateOrLoginInput{}
|
||||
err = gconv.Scan(req, &input)
|
||||
if err != nil {
|
||||
@ -40,8 +40,8 @@ func (c *cLogin) CreateOrLogin(ctx context.Context, req *backend.CreateOrLoginRe
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &backend.CreateOrLoginRes{Id: writer.Id}, nil
|
||||
return &backend.CreateLoginRes{Id: writer.Id, PenName: writer.PenName}, nil
|
||||
// return &backend.CreateOrLoginRes{Id: writer.Id}, nil
|
||||
}
|
||||
|
||||
func (c *cLogin) GetPhoneCode(ctx context.Context, req *backend.GetCodeReq) (res *backend.GetCodeRes, err error) {
|
||||
|
31
internal/controller/backend/writer.go
Normal file
31
internal/controller/backend/writer.go
Normal file
@ -0,0 +1,31 @@
|
||||
// Package backend -----------------------------
|
||||
// @file : writer.go
|
||||
// @author : Allen zhang
|
||||
// @contact : 364438619@qq.com
|
||||
// @time : 2024/1/15 15:15
|
||||
// -------------------------------------------
|
||||
package backend
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
|
||||
"novel/api/backend"
|
||||
"novel/internal/consts"
|
||||
)
|
||||
|
||||
// Writer 内容管理
|
||||
var Writer = cWriter{}
|
||||
|
||||
type cWriter struct{}
|
||||
|
||||
// gtoken 版本返回结果
|
||||
func (c *cWriter) Info(ctx context.Context, req *backend.WriterGetInfoReq) (res *backend.WriterGetInfoRes, err error) {
|
||||
return &backend.WriterGetInfoRes{
|
||||
Id: gconv.Int(ctx.Value(consts.CtxWriterId)),
|
||||
PenName: gconv.String(ctx.Value(consts.CtxWriterName)),
|
||||
IsAdmin: gconv.Int(ctx.Value(consts.CtxWriterIsAdmin)),
|
||||
RoleIds: gconv.String(ctx.Value(consts.CtxWriterRoleIds)),
|
||||
}, err
|
||||
}
|
Reference in New Issue
Block a user