挪下位置,方便编译

This commit is contained in:
liuxiaobo 2025-05-31 13:26:52 +08:00
parent f18b8e4ec3
commit b61958f0e0
9 changed files with 18 additions and 11 deletions

View File

@ -18,6 +18,7 @@ func main() {
if err == nil {
BuildDate = tm.Format("2006-01-02 15:04:05")
}
//BuildDate = "2025-05-31 09:56:06"
ksync.RunSafe(func() {
cmd.Run(GitBranch, GitCommit, BuildDate)
}, func() { log.ErrorF("reset run") })

View File

@ -2,8 +2,8 @@ package cmd
import (
"fmt"
"game/test/client/config"
"game/test/client/server"
"game/server/client/config"
"game/server/client/server"
"github.com/fox/fox/log"
"os"
"os/signal"

View File

@ -1,7 +1,7 @@
package main
import (
"game/test/client/cmd"
"game/server/client/cmd"
"github.com/fox/fox/ksync"
"github.com/fox/fox/log"
"time"

View File

@ -1,7 +1,7 @@
package model
import (
"game/test/client/config"
"game/server/client/config"
"github.com/fox/fox/db"
"github.com/fox/fox/log"
"github.com/go-redis/redis/v8"

View File

@ -6,6 +6,7 @@ import (
)
func (s *ClientService) login() {
log.DebugF("user:% ready login", s.username)
s.SendMsg(pb.ServiceTypeId_STI_Login, int32(pb.MsgId_C2SUserLoginId), &pb.C2SUserLogin{
Username: s.username,
Password: s.password,

View File

@ -3,7 +3,7 @@ package server
import (
"fmt"
"game/common/proto/pb"
"game/test/client/config"
"game/server/client/config"
"github.com/fox/fox/log"
"github.com/fox/fox/processor"
"github.com/fox/fox/ws"
@ -59,11 +59,16 @@ func newClientService(serviceId int) *ClientService {
return s
}
func (s *ClientService) loopLoginHour() {
s.login()
time.AfterFunc(time.Hour, s.loopLoginHour)
}
func (s *ClientService) OnInit() {
s.client.Start()
log.Debug("onInit")
time.Sleep(100 * time.Millisecond)
s.login()
s.loopLoginHour()
}
func (s *ClientService) CanStop() bool {

View File

@ -9,9 +9,9 @@ import (
)
const (
AccountNormal = 0 // 正常
AccountFrozen = 1 // 冻结
AccountBanned = 2 // 封禁
AccountNormal = 1 // 正常
AccountFrozen = 2 // 冻结
AccountBanned = 3 // 封禁
)
// 玩家账户表
@ -19,8 +19,8 @@ type UserAccount struct {
gorm.Model
Username string `gorm:"type:varchar(32);uniqueIndex;not null"` // 用户名
Password string `gorm:"type:varchar(255);not null"` // 密码哈希
Email string `gorm:"type:varchar(100);uniqueIndex"` // 邮箱(可选)
Phone string `gorm:"type:varchar(20);uniqueIndex"` // 手机号(可选)
Email string `gorm:"type:varchar(100)"` // 邮箱(可选)
Phone string `gorm:"type:varchar(20)"` // 手机号(可选)
DeviceID string `gorm:"type:varchar(64);index"` // 设备ID
LastLoginIP string `gorm:"type:varchar(45)"` // 最后登录IP(支持IPv6)
LastLoginTime time.Time // 最后登录时间