挪下位置,方便编译

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 { if err == nil {
BuildDate = tm.Format("2006-01-02 15:04:05") BuildDate = tm.Format("2006-01-02 15:04:05")
} }
//BuildDate = "2025-05-31 09:56:06"
ksync.RunSafe(func() { ksync.RunSafe(func() {
cmd.Run(GitBranch, GitCommit, BuildDate) cmd.Run(GitBranch, GitCommit, BuildDate)
}, func() { log.ErrorF("reset run") }) }, func() { log.ErrorF("reset run") })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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