网络游戏初步接入

This commit is contained in:
2024-10-18 15:11:40 +08:00
parent 263a57f636
commit b27d2b80f7
12 changed files with 306 additions and 67 deletions
+5 -2
View File
@@ -1,6 +1,9 @@
package models
type GameMessage struct {
UserID string `json:"user_id"`
Pos int `json:"pos"`
Router string `json:"router"`
User *Users `json:"user_id"`
Pos int `json:"pos"`
GameType int
GameUuid string
}
+3
View File
@@ -18,6 +18,9 @@ type Online struct {
}
func (o *Online) Url(router string) string {
if o.Port == "" {
o.Port = cfg.T.ServerAddr
}
return fmt.Sprintf("http://%s%s%s", o.Ip, o.Port, router)
}
+12 -8
View File
@@ -1,12 +1,16 @@
package models
import "time"
type Users struct {
ID string `gorm:"primarykey" json:"id"`
Ip string `json:"ip"`
Name string `json:"name"` // 昵称
Avatar string `json:"avatar"` // 头像
Cover string `json:"cover"` // 封面
Email string `json:"email"`
Phone string `json:"phone"`
Address string `json:"address"` // 工位
ID string `gorm:"primarykey" json:"id"`
Ip string `json:"ip"`
UpdateTx time.Time `json:"update_tx"`
Port string `json:"port"`
Name string `json:"name"` // 昵称
Avatar string `json:"avatar"` // 头像
Cover string `json:"cover"` // 封面
Email string `json:"email"`
Phone string `json:"phone"`
Address string `json:"address"` // 工位
}