refactor(login): 重构登录模块代码

- 移除未使用的 in.go 和 out.go 文件
- 优化 login.go 中的代码结构
- 添加新的 go.mod 依赖
This commit is contained in:
2025-07-02 22:02:56 +08:00
parent c4e80f80e4
commit 738a897c4d
6 changed files with 46 additions and 6 deletions

View File

@@ -0,0 +1,36 @@
package fight
import (
"context"
"fmt"
"testing"
"github.com/looplab/fsm"
)
func Test_main(t *testing.T) {
fsm := fsm.NewFSM(
"closed",
fsm.Events{
{Name: "open", Src: []string{"closed"}, Dst: "open"},
{Name: "close", Src: []string{"open"}, Dst: "closed"},
},
fsm.Callbacks{},
)
fmt.Println(fsm.Current())
err := fsm.Event(context.Background(), "open")
if err != nil {
fmt.Println(err)
}
fmt.Println(fsm.Current())
err = fsm.Event(context.Background(), "close")
if err != nil {
fmt.Println(err)
}
fmt.Println(fsm.Current())
}