Files
bl/login/main.go
昔念 db3a21dd91 feat(login): 引入基于 IP 的限流中间件
新增 github.com/xiaoqidun/limit 依赖,替换原有的全局速率限制器,
实现针对客户端 IP 的细粒度限流控制。在服务启动时初始化限流器,
并在程序退出前确保后台任务正确停止。同时更新 go.work 和 login/go.sum
文件以包含新的依赖项。此外,在 logic/main.go 中添加了主玩家数据
保存逻辑以确保服务关闭时数据持久化。
2025-10-24 23:14:36 +08:00

69 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"fmt"
"reflect"
"strings"
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
_ "blazing/contrib/drivers/pgsql"
_ "blazing/contrib/files/local"
// Minio按需启用
// _ "blazing/contrib/files/minio"
// 阿里云OSS按需启用
// _ "blazing/contrib/files/oss"
// _ "blazing/contrib/drivers/sqlite"
//_ "blazing/contrib/drivers/mysql"
_ "blazing/modules"
"blazing/login/internal/cmd"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/util/gconv"
)
func main() {
cmd.Main.Run(gctx.New())
}
func kick(id int) {
// // go Start(cool.Config.Port)
// //go rpc()
// go func() {
// t := rpc.StartClient(0, &struct{}{})
// err := t.Kick(1)
// fmt.Println(err)
// //err := t.Kick(1)
// err = t.Kick(10001)
// fmt.Println(err)
// }()
}
type ssss struct {
ttt int `cmd:"111|222"`
}
func Test_kick() {
value := reflect.ValueOf(ssss{})
// 获取类型
typ := value.Type()
// 遍历结构体字段
// fmt.Printf("结构体 %s 的字段信息:\n", t.Name())
for i := 0; i < typ.NumField(); i++ {
field := typ.Field(i)
t := field.Tag.Get("cmd")
//t1 := strings.Split(t, "|")
t2 := gconv.SliceUint32(strings.Split(t, "|"))
fmt.Println(t2)
}
}