Files
bl/modules/blazing/controller/app/login.go
昔念 3e55b0f481 ```
feat(vscode): 添加调试参数配置

为launch.json添加-debug=1参数,便于调试模式启动

docs(README): 补充zellij终端复用工具使用说明

添加x-cmd安装和zellij会话管理相关命令示例

refactor(config): 注释掉GamePort配置项

暂时注释GamePort配置项以解决配置冲突问题

refactor(xmlres): 移除未使用的gf框架依赖
2026-01-01 22:19:00 +08:00

74 lines
1.5 KiB
Go

package app
import (
"blazing/cool"
baseservice "blazing/modules/base/service"
"blazing/modules/blazing/service"
"context"
"fmt"
"github.com/gogf/gf/v2/frame/g"
)
type SessionReq struct {
g.Meta `path:"/getSessionByAuth" method:"GET"`
Email string `json:"email" v:"required|email"`
Password string `json:"password" v:"required"`
}
type SessionRes struct {
Msg string `json:"msg"`
Code int `json:"code"`
Session string `json:"session"`
}
type BlazingController struct {
*cool.Controller
}
var biazing_service = service.NewLoginServiceService()
func init() {
var blazing_controller = &BlazingController{
&cool.Controller{
Prefix: "/seer/game",
Api: []string{},
Service: biazing_service,
},
}
// 注册路由
cool.RegisterController(blazing_controller)
}
func (c *BlazingController) GetSession(ctx context.Context, req *SessionReq) (res *SessionRes, err error) {
res = &SessionRes{
Msg: "success",
Code: 200,
Session: ""}
if err := g.Validator().Data(req).Run(ctx); err != nil {
fmt.Println(err)
res.Code = 400
res.Msg = err.Error()
}
res1, err := baseservice.NewBaseSysUserService().GetSession(req.Email, req.Password)
if err != nil || res1 == nil {
res.Code = 400
res.Msg = err.Error()
return
}
accountID := res1.ID
res.Session = biazing_service.GetSessionId(accountID)
return
}
type MockReq struct {
g.Meta `path:"/mock" method:"GET"`
Email string `json:"email" v:"required|email"`
Password string `json:"password" v:"required"`
}