feat(build): 添加 linux amd64 平台的逻辑编译脚本

在 build.bat 中新增 gox 编译命令,用于构建 linux amd64
This commit is contained in:
2025-10-10 23:00:07 +08:00
parent e2c3c5abb6
commit a1f6ce956e
4 changed files with 26 additions and 3 deletions

View File

@@ -2,3 +2,4 @@ gf pack modules/base/resource modules/base/packed/packed.go -p modules/base/reso
protoc --go_out=./ --go-grpc_out=./ manifest\proto\rpc.proto
gox -os "linux" -arch amd64 -output "logic"

Binary file not shown.

View File

@@ -13,7 +13,6 @@ import (
)
type Conn struct {
MainConn gnet.Conn `struc:"[0]pad"` //TODO 不序列化,,序列化下面的作为blob存数据库
Mu sync.Mutex
}
@@ -40,6 +39,25 @@ type readWrite struct {
io.Writer
}
func CompareLeftBytes(array1, array2 []byte, leftBytesCount int) bool {
// 检查切片长度是否足够比较左边的字节
if len(array1) < leftBytesCount || len(array2) < leftBytesCount {
return false
}
// 提取左边的字节切片
left1 := array1[:leftBytesCount]
left2 := array2[:leftBytesCount]
// 比较左边的字节切片
for i := 0; i < leftBytesCount; i++ {
if left1[i] != left2[i] {
return false
}
}
return true
}
func (w *WsCodec) Upgrade(c gnet.Conn) (ok bool, action gnet.Action) {
if w.Upgraded {
ok = true
@@ -51,6 +69,10 @@ func (w *WsCodec) Upgrade(c gnet.Conn) (ok bool, action gnet.Action) {
return
}
buf := &w.Buf
if CompareLeftBytes(buf.Bytes(), []byte{0, 0}, 2) {
w.Tcp = true
return
}
tmpReader := bytes.NewReader(buf.Bytes())
oldLen := tmpReader.Len()
logging.Infof("do Upgrade")
@@ -65,7 +87,7 @@ func (w *WsCodec) Upgrade(c gnet.Conn) (ok bool, action gnet.Action) {
logging.Errorf("conn[%v] [err=%v]", c.RemoteAddr().String(), err.Error())
action = gnet.Close
//ok = true
w.Tcp = true
//w.Tcp = true
return
}
buf.Next(skipN)

View File

@@ -30,7 +30,7 @@ func (s *BaseSysUserService) Person(userId uint) (res gdb.Record, err error) {
func (s *BaseSysUserService) GetSession(email string, password string) (res *model.BaseSysUser, err error) {
m := cool.DBM(s.Model)
m.Where("email", email).Where("password=?", password).Where("status=?", 1).Scan(&res)
m.Where("email", email).Where("password", password).Where("status", 1).Scan(&res)
if res == nil {
err = gerror.New("账户或密码不正确~")
return