From 385d571c3ab03dde67d7967d93e71a1092802055 Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Thu, 5 Mar 2026 17:51:03 +0800 Subject: [PATCH] =?UTF-8?q?thrift=20GM=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/server/backend.thrift | 52 - .../gen-go/backend/GoUnusedProtection__.go | 6 - src/server/gen-go/backend/backend-consts.go | 34 - src/server/gen-go/backend/backend.go | 2456 ----------------- .../game_admin_service-remote.go | 164 -- 6 files changed, 1 insertion(+), 2712 deletions(-) delete mode 100644 src/server/backend.thrift delete mode 100644 src/server/gen-go/backend/GoUnusedProtection__.go delete mode 100644 src/server/gen-go/backend/backend-consts.go delete mode 100644 src/server/gen-go/backend/backend.go delete mode 100644 src/server/gen-go/backend/game_admin_service-remote/game_admin_service-remote.go diff --git a/.gitignore b/.gitignore index 490788af..fdc27c87 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ src/server/test/logs/* src/server/test/teLog/* src/server/*.exe* src/server/msg/Gameapi.pb.go +src/server/gen-go diff --git a/src/server/backend.thrift b/src/server/backend.thrift deleted file mode 100644 index 37e24d4c..00000000 --- a/src/server/backend.thrift +++ /dev/null @@ -1,52 +0,0 @@ -namespace go backend -struct ResAdminInfo{ - 1: string Name, - 2: i64 Uid, - 3: i32 AreaId, - 4: i32 Face; - 5: double Charge; - 6: double MaxCharge; - 7: i32 Level; - 8: i32 Diamond; - 9: i32 Star; - 10: i32 Energy; - 11: string UserName; - 12: i64 LoginTime; - 13: i32 Cumulative; - 14: i32 RegisterTime; - 15: i8 Ban; - 16: i32 TodayCumulative; - 17: i32 Bouns; - 18: string Code; - 19: map ChessMap; - 20: list ActLog; - 21: list FriendList; - 22: map OrderList; -} - -struct Actlog{ - 1: i8 Type; - 2: i64 Time; - 3: string Param; -} - -struct OrderInfo{ - 1: i32 Id; - 2: i32 Type; - 3: i64 Time; - 4: string ChessId; - 5: i8 Diff; -} - -struct FriendInfo{ - 1: i64 Uid; - 2: string NickName; - 3: i32 Level; - 4: i64 LogoutTime; - 5: i64 LoginTime; - 6: i32 Face; -} - -service GameAdminService{ - ResAdminInfo GetAdminInfo(1:i32 Uid); -} \ No newline at end of file diff --git a/src/server/gen-go/backend/GoUnusedProtection__.go b/src/server/gen-go/backend/GoUnusedProtection__.go deleted file mode 100644 index 48bcbc67..00000000 --- a/src/server/gen-go/backend/GoUnusedProtection__.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by Thrift Compiler (0.22.0). DO NOT EDIT. - -package backend - -var GoUnusedProtection__ int; - diff --git a/src/server/gen-go/backend/backend-consts.go b/src/server/gen-go/backend/backend-consts.go deleted file mode 100644 index b54005b2..00000000 --- a/src/server/gen-go/backend/backend-consts.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by Thrift Compiler (0.22.0). DO NOT EDIT. - -package backend - -import ( - "bytes" - "context" - "errors" - "fmt" - "iter" - "log/slog" - "time" - thrift "github.com/apache/thrift/lib/go/thrift" - "strings" - "regexp" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = bytes.Equal -var _ = context.Background -var _ = errors.New -var _ = fmt.Printf -var _ = iter.Pull[int] -var _ = slog.Log -var _ = time.Now -var _ = thrift.ZERO -// (needed by validator.) -var _ = strings.Contains -var _ = regexp.MatchString - - -func init() { -} - diff --git a/src/server/gen-go/backend/backend.go b/src/server/gen-go/backend/backend.go deleted file mode 100644 index aff7a282..00000000 --- a/src/server/gen-go/backend/backend.go +++ /dev/null @@ -1,2456 +0,0 @@ -// Code generated by Thrift Compiler (0.22.0). DO NOT EDIT. - -package backend - -import ( - "bytes" - "context" - "errors" - "fmt" - "iter" - "log/slog" - "time" - thrift "github.com/apache/thrift/lib/go/thrift" - "strings" - "regexp" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = bytes.Equal -var _ = context.Background -var _ = errors.New -var _ = fmt.Printf -var _ = iter.Pull[int] -var _ = slog.Log -var _ = time.Now -var _ = thrift.ZERO -// (needed by validator.) -var _ = strings.Contains -var _ = regexp.MatchString - -// Attributes: -// - Name -// - UID -// - AreaId -// - Face -// - Charge -// - MaxCharge -// - Level -// - Diamond -// - Star -// - Energy -// - UserName -// - LoginTime -// - Cumulative -// - RegisterTime -// - Ban -// - TodayCumulative -// - Bouns -// - Code -// - ChessMap -// - ActLog -// - FriendList -// - OrderList -// -type ResAdminInfo struct { - Name string `thrift:"Name,1" db:"Name" json:"Name"` - UID int64 `thrift:"Uid,2" db:"Uid" json:"Uid"` - AreaId int32 `thrift:"AreaId,3" db:"AreaId" json:"AreaId"` - Face int32 `thrift:"Face,4" db:"Face" json:"Face"` - Charge float64 `thrift:"Charge,5" db:"Charge" json:"Charge"` - MaxCharge float64 `thrift:"MaxCharge,6" db:"MaxCharge" json:"MaxCharge"` - Level int32 `thrift:"Level,7" db:"Level" json:"Level"` - Diamond int32 `thrift:"Diamond,8" db:"Diamond" json:"Diamond"` - Star int32 `thrift:"Star,9" db:"Star" json:"Star"` - Energy int32 `thrift:"Energy,10" db:"Energy" json:"Energy"` - UserName string `thrift:"UserName,11" db:"UserName" json:"UserName"` - LoginTime int64 `thrift:"LoginTime,12" db:"LoginTime" json:"LoginTime"` - Cumulative int32 `thrift:"Cumulative,13" db:"Cumulative" json:"Cumulative"` - RegisterTime int32 `thrift:"RegisterTime,14" db:"RegisterTime" json:"RegisterTime"` - Ban int8 `thrift:"Ban,15" db:"Ban" json:"Ban"` - TodayCumulative int32 `thrift:"TodayCumulative,16" db:"TodayCumulative" json:"TodayCumulative"` - Bouns int32 `thrift:"Bouns,17" db:"Bouns" json:"Bouns"` - Code string `thrift:"Code,18" db:"Code" json:"Code"` - ChessMap map[string]int32 `thrift:"ChessMap,19" db:"ChessMap" json:"ChessMap"` - ActLog []*Actlog `thrift:"ActLog,20" db:"ActLog" json:"ActLog"` - FriendList []*FriendInfo `thrift:"FriendList,21" db:"FriendList" json:"FriendList"` - OrderList map[int32]*OrderInfo `thrift:"OrderList,22" db:"OrderList" json:"OrderList"` -} - -func NewResAdminInfo() *ResAdminInfo { - return &ResAdminInfo{} -} - - - -func (p *ResAdminInfo) GetName() string { - return p.Name -} - - - -func (p *ResAdminInfo) GetUID() int64 { - return p.UID -} - - - -func (p *ResAdminInfo) GetAreaId() int32 { - return p.AreaId -} - - - -func (p *ResAdminInfo) GetFace() int32 { - return p.Face -} - - - -func (p *ResAdminInfo) GetCharge() float64 { - return p.Charge -} - - - -func (p *ResAdminInfo) GetMaxCharge() float64 { - return p.MaxCharge -} - - - -func (p *ResAdminInfo) GetLevel() int32 { - return p.Level -} - - - -func (p *ResAdminInfo) GetDiamond() int32 { - return p.Diamond -} - - - -func (p *ResAdminInfo) GetStar() int32 { - return p.Star -} - - - -func (p *ResAdminInfo) GetEnergy() int32 { - return p.Energy -} - - - -func (p *ResAdminInfo) GetUserName() string { - return p.UserName -} - - - -func (p *ResAdminInfo) GetLoginTime() int64 { - return p.LoginTime -} - - - -func (p *ResAdminInfo) GetCumulative() int32 { - return p.Cumulative -} - - - -func (p *ResAdminInfo) GetRegisterTime() int32 { - return p.RegisterTime -} - - - -func (p *ResAdminInfo) GetBan() int8 { - return p.Ban -} - - - -func (p *ResAdminInfo) GetTodayCumulative() int32 { - return p.TodayCumulative -} - - - -func (p *ResAdminInfo) GetBouns() int32 { - return p.Bouns -} - - - -func (p *ResAdminInfo) GetCode() string { - return p.Code -} - - - -func (p *ResAdminInfo) GetChessMap() map[string]int32 { - return p.ChessMap -} - - - -func (p *ResAdminInfo) GetActLog() []*Actlog { - return p.ActLog -} - - - -func (p *ResAdminInfo) GetFriendList() []*FriendInfo { - return p.FriendList -} - - - -func (p *ResAdminInfo) GetOrderList() map[int32]*OrderInfo { - return p.OrderList -} - -func (p *ResAdminInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.I64 { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I32 { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.I32 { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 7: - if fieldTypeId == thrift.I32 { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 8: - if fieldTypeId == thrift.I32 { - if err := p.ReadField8(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 9: - if fieldTypeId == thrift.I32 { - if err := p.ReadField9(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 10: - if fieldTypeId == thrift.I32 { - if err := p.ReadField10(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 11: - if fieldTypeId == thrift.STRING { - if err := p.ReadField11(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 12: - if fieldTypeId == thrift.I64 { - if err := p.ReadField12(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 13: - if fieldTypeId == thrift.I32 { - if err := p.ReadField13(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 14: - if fieldTypeId == thrift.I32 { - if err := p.ReadField14(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 15: - if fieldTypeId == thrift.BYTE { - if err := p.ReadField15(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 16: - if fieldTypeId == thrift.I32 { - if err := p.ReadField16(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 17: - if fieldTypeId == thrift.I32 { - if err := p.ReadField17(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 18: - if fieldTypeId == thrift.STRING { - if err := p.ReadField18(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 19: - if fieldTypeId == thrift.MAP { - if err := p.ReadField19(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 20: - if fieldTypeId == thrift.LIST { - if err := p.ReadField20(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 21: - if fieldTypeId == thrift.LIST { - if err := p.ReadField21(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 22: - if fieldTypeId == thrift.MAP { - if err := p.ReadField22(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ResAdminInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.Name = v - } - return nil -} - -func (p *ResAdminInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.UID = v - } - return nil -} - -func (p *ResAdminInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.AreaId = v - } - return nil -} - -func (p *ResAdminInfo) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) - } else { - p.Face = v - } - return nil -} - -func (p *ResAdminInfo) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) - } else { - p.Charge = v - } - return nil -} - -func (p *ResAdminInfo) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) - } else { - p.MaxCharge = v - } - return nil -} - -func (p *ResAdminInfo) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) - } else { - p.Level = v - } - return nil -} - -func (p *ResAdminInfo) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 8: ", err) - } else { - p.Diamond = v - } - return nil -} - -func (p *ResAdminInfo) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 9: ", err) - } else { - p.Star = v - } - return nil -} - -func (p *ResAdminInfo) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 10: ", err) - } else { - p.Energy = v - } - return nil -} - -func (p *ResAdminInfo) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 11: ", err) - } else { - p.UserName = v - } - return nil -} - -func (p *ResAdminInfo) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 12: ", err) - } else { - p.LoginTime = v - } - return nil -} - -func (p *ResAdminInfo) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 13: ", err) - } else { - p.Cumulative = v - } - return nil -} - -func (p *ResAdminInfo) ReadField14(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 14: ", err) - } else { - p.RegisterTime = v - } - return nil -} - -func (p *ResAdminInfo) ReadField15(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadByte(ctx); err != nil { - return thrift.PrependError("error reading field 15: ", err) - } else { - temp := int8(v) - p.Ban = temp - } - return nil -} - -func (p *ResAdminInfo) ReadField16(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 16: ", err) - } else { - p.TodayCumulative = v - } - return nil -} - -func (p *ResAdminInfo) ReadField17(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 17: ", err) - } else { - p.Bouns = v - } - return nil -} - -func (p *ResAdminInfo) ReadField18(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 18: ", err) - } else { - p.Code = v - } - return nil -} - -func (p *ResAdminInfo) ReadField19(ctx context.Context, iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin(ctx) - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(map[string]int32, size) - p.ChessMap = tMap - for i := 0; i < size; i++ { - var _key0 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) - } else { - _key0 = v - } - var _val1 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) - } else { - _val1 = v - } - p.ChessMap[_key0] = _val1 - } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - return nil -} - -func (p *ResAdminInfo) ReadField20(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Actlog, 0, size) - p.ActLog = tSlice - for i := 0; i < size; i++ { - _elem2 := &Actlog{} - if err := _elem2.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) - } - p.ActLog = append(p.ActLog, _elem2) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *ResAdminInfo) ReadField21(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*FriendInfo, 0, size) - p.FriendList = tSlice - for i := 0; i < size; i++ { - _elem3 := &FriendInfo{} - if err := _elem3.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) - } - p.FriendList = append(p.FriendList, _elem3) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *ResAdminInfo) ReadField22(ctx context.Context, iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin(ctx) - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(map[int32]*OrderInfo, size) - p.OrderList = tMap - for i := 0; i < size; i++ { - var _key4 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) - } else { - _key4 = v - } - _val5 := &OrderInfo{} - if err := _val5.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val5), err) - } - p.OrderList[_key4] = _val5 - } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - return nil -} - -func (p *ResAdminInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "ResAdminInfo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } - if err := p.writeField5(ctx, oprot); err != nil { return err } - if err := p.writeField6(ctx, oprot); err != nil { return err } - if err := p.writeField7(ctx, oprot); err != nil { return err } - if err := p.writeField8(ctx, oprot); err != nil { return err } - if err := p.writeField9(ctx, oprot); err != nil { return err } - if err := p.writeField10(ctx, oprot); err != nil { return err } - if err := p.writeField11(ctx, oprot); err != nil { return err } - if err := p.writeField12(ctx, oprot); err != nil { return err } - if err := p.writeField13(ctx, oprot); err != nil { return err } - if err := p.writeField14(ctx, oprot); err != nil { return err } - if err := p.writeField15(ctx, oprot); err != nil { return err } - if err := p.writeField16(ctx, oprot); err != nil { return err } - if err := p.writeField17(ctx, oprot); err != nil { return err } - if err := p.writeField18(ctx, oprot); err != nil { return err } - if err := p.writeField19(ctx, oprot); err != nil { return err } - if err := p.writeField20(ctx, oprot); err != nil { return err } - if err := p.writeField21(ctx, oprot); err != nil { return err } - if err := p.writeField22(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *ResAdminInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Name", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Name: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.Name)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Name (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Name: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Uid", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:Uid: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.UID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Uid (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:Uid: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "AreaId", thrift.I32, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:AreaId: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.AreaId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.AreaId (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:AreaId: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Face", thrift.I32, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:Face: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Face)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Face (4) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:Face: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Charge", thrift.DOUBLE, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:Charge: ", p), err) - } - if err := oprot.WriteDouble(ctx, float64(p.Charge)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Charge (5) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:Charge: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "MaxCharge", thrift.DOUBLE, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:MaxCharge: ", p), err) - } - if err := oprot.WriteDouble(ctx, float64(p.MaxCharge)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.MaxCharge (6) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:MaxCharge: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Level", thrift.I32, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:Level: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Level)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Level (7) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:Level: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Diamond", thrift.I32, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:Diamond: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Diamond)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Diamond (8) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:Diamond: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Star", thrift.I32, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:Star: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Star)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Star (9) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:Star: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Energy", thrift.I32, 10); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:Energy: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Energy)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Energy (10) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 10:Energy: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "UserName", thrift.STRING, 11); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:UserName: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.UserName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.UserName (11) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 11:UserName: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "LoginTime", thrift.I64, 12); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:LoginTime: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.LoginTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.LoginTime (12) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 12:LoginTime: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Cumulative", thrift.I32, 13); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:Cumulative: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Cumulative)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Cumulative (13) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 13:Cumulative: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField14(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "RegisterTime", thrift.I32, 14); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 14:RegisterTime: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.RegisterTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.RegisterTime (14) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 14:RegisterTime: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField15(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Ban", thrift.BYTE, 15); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 15:Ban: ", p), err) - } - if err := oprot.WriteByte(ctx, int8(p.Ban)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Ban (15) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 15:Ban: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField16(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "TodayCumulative", thrift.I32, 16); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 16:TodayCumulative: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.TodayCumulative)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.TodayCumulative (16) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 16:TodayCumulative: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField17(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Bouns", thrift.I32, 17); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 17:Bouns: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Bouns)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Bouns (17) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 17:Bouns: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField18(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Code", thrift.STRING, 18); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 18:Code: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.Code)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Code (18) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 18:Code: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField19(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "ChessMap", thrift.MAP, 19); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 19:ChessMap: ", p), err) - } - if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.I32, len(p.ChessMap)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range p.ChessMap { - if err := oprot.WriteString(ctx, string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) - } - } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 19:ChessMap: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField20(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "ActLog", thrift.LIST, 20); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 20:ActLog: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.ActLog)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.ActLog { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 20:ActLog: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField21(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "FriendList", thrift.LIST, 21); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 21:FriendList: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.FriendList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.FriendList { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 21:FriendList: ", p), err) - } - return err -} - -func (p *ResAdminInfo) writeField22(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "OrderList", thrift.MAP, 22); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 22:OrderList: ", p), err) - } - if err := oprot.WriteMapBegin(ctx, thrift.I32, thrift.STRUCT, len(p.OrderList)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range p.OrderList { - if err := oprot.WriteI32(ctx, int32(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) - } - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 22:OrderList: ", p), err) - } - return err -} - -func (p *ResAdminInfo) Equals(other *ResAdminInfo) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.Name != other.Name { return false } - if p.UID != other.UID { return false } - if p.AreaId != other.AreaId { return false } - if p.Face != other.Face { return false } - if p.Charge != other.Charge { return false } - if p.MaxCharge != other.MaxCharge { return false } - if p.Level != other.Level { return false } - if p.Diamond != other.Diamond { return false } - if p.Star != other.Star { return false } - if p.Energy != other.Energy { return false } - if p.UserName != other.UserName { return false } - if p.LoginTime != other.LoginTime { return false } - if p.Cumulative != other.Cumulative { return false } - if p.RegisterTime != other.RegisterTime { return false } - if p.Ban != other.Ban { return false } - if p.TodayCumulative != other.TodayCumulative { return false } - if p.Bouns != other.Bouns { return false } - if p.Code != other.Code { return false } - if len(p.ChessMap) != len(other.ChessMap) { return false } - for k, _tgt := range p.ChessMap { - _src6 := other.ChessMap[k] - if _tgt != _src6 { return false } - } - if len(p.ActLog) != len(other.ActLog) { return false } - for i, _tgt := range p.ActLog { - _src7 := other.ActLog[i] - if !_tgt.Equals(_src7) { return false } - } - if len(p.FriendList) != len(other.FriendList) { return false } - for i, _tgt := range p.FriendList { - _src8 := other.FriendList[i] - if !_tgt.Equals(_src8) { return false } - } - if len(p.OrderList) != len(other.OrderList) { return false } - for k, _tgt := range p.OrderList { - _src9 := other.OrderList[k] - if !_tgt.Equals(_src9) { return false } - } - return true -} - -func (p *ResAdminInfo) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ResAdminInfo(%+v)", *p) -} - -func (p *ResAdminInfo) LogValue() slog.Value { - if p == nil { - return slog.AnyValue(nil) - } - v := thrift.SlogTStructWrapper{ - Type: "*backend.ResAdminInfo", - Value: p, - } - return slog.AnyValue(v) -} - -var _ slog.LogValuer = (*ResAdminInfo)(nil) - -func (p *ResAdminInfo) Validate() error { - return nil -} - -// Attributes: -// - Type -// - Time -// - Param -// -type Actlog struct { - Type int8 `thrift:"Type,1" db:"Type" json:"Type"` - Time int64 `thrift:"Time,2" db:"Time" json:"Time"` - Param string `thrift:"Param,3" db:"Param" json:"Param"` -} - -func NewActlog() *Actlog { - return &Actlog{} -} - - - -func (p *Actlog) GetType() int8 { - return p.Type -} - - - -func (p *Actlog) GetTime() int64 { - return p.Time -} - - - -func (p *Actlog) GetParam() string { - return p.Param -} - -func (p *Actlog) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.BYTE { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.I64 { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.STRING { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *Actlog) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadByte(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - temp := int8(v) - p.Type = temp - } - return nil -} - -func (p *Actlog) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.Time = v - } - return nil -} - -func (p *Actlog) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.Param = v - } - return nil -} - -func (p *Actlog) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Actlog"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Actlog) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Type", thrift.BYTE, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Type: ", p), err) - } - if err := oprot.WriteByte(ctx, int8(p.Type)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Type (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Type: ", p), err) - } - return err -} - -func (p *Actlog) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Time", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:Time: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.Time)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Time (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:Time: ", p), err) - } - return err -} - -func (p *Actlog) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Param", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:Param: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.Param)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Param (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:Param: ", p), err) - } - return err -} - -func (p *Actlog) Equals(other *Actlog) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.Type != other.Type { return false } - if p.Time != other.Time { return false } - if p.Param != other.Param { return false } - return true -} - -func (p *Actlog) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Actlog(%+v)", *p) -} - -func (p *Actlog) LogValue() slog.Value { - if p == nil { - return slog.AnyValue(nil) - } - v := thrift.SlogTStructWrapper{ - Type: "*backend.Actlog", - Value: p, - } - return slog.AnyValue(v) -} - -var _ slog.LogValuer = (*Actlog)(nil) - -func (p *Actlog) Validate() error { - return nil -} - -// Attributes: -// - ID -// - Type -// - Time -// - ChessId -// - Diff -// -type OrderInfo struct { - ID int32 `thrift:"Id,1" db:"Id" json:"Id"` - Type int32 `thrift:"Type,2" db:"Type" json:"Type"` - Time int64 `thrift:"Time,3" db:"Time" json:"Time"` - ChessId string `thrift:"ChessId,4" db:"ChessId" json:"ChessId"` - Diff int8 `thrift:"Diff,5" db:"Diff" json:"Diff"` -} - -func NewOrderInfo() *OrderInfo { - return &OrderInfo{} -} - - - -func (p *OrderInfo) GetID() int32 { - return p.ID -} - - - -func (p *OrderInfo) GetType() int32 { - return p.Type -} - - - -func (p *OrderInfo) GetTime() int64 { - return p.Time -} - - - -func (p *OrderInfo) GetChessId() string { - return p.ChessId -} - - - -func (p *OrderInfo) GetDiff() int8 { - return p.Diff -} - -func (p *OrderInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I32 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.I32 { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I64 { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.STRING { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.BYTE { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *OrderInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.ID = v - } - return nil -} - -func (p *OrderInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.Type = v - } - return nil -} - -func (p *OrderInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.Time = v - } - return nil -} - -func (p *OrderInfo) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) - } else { - p.ChessId = v - } - return nil -} - -func (p *OrderInfo) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadByte(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) - } else { - temp := int8(v) - p.Diff = temp - } - return nil -} - -func (p *OrderInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "OrderInfo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } - if err := p.writeField5(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *OrderInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Id", thrift.I32, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Id: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.ID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Id (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Id: ", p), err) - } - return err -} - -func (p *OrderInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Type", thrift.I32, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:Type: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Type)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Type (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:Type: ", p), err) - } - return err -} - -func (p *OrderInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Time", thrift.I64, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:Time: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.Time)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Time (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:Time: ", p), err) - } - return err -} - -func (p *OrderInfo) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "ChessId", thrift.STRING, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:ChessId: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.ChessId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.ChessId (4) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:ChessId: ", p), err) - } - return err -} - -func (p *OrderInfo) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Diff", thrift.BYTE, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:Diff: ", p), err) - } - if err := oprot.WriteByte(ctx, int8(p.Diff)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Diff (5) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:Diff: ", p), err) - } - return err -} - -func (p *OrderInfo) Equals(other *OrderInfo) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.ID != other.ID { return false } - if p.Type != other.Type { return false } - if p.Time != other.Time { return false } - if p.ChessId != other.ChessId { return false } - if p.Diff != other.Diff { return false } - return true -} - -func (p *OrderInfo) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("OrderInfo(%+v)", *p) -} - -func (p *OrderInfo) LogValue() slog.Value { - if p == nil { - return slog.AnyValue(nil) - } - v := thrift.SlogTStructWrapper{ - Type: "*backend.OrderInfo", - Value: p, - } - return slog.AnyValue(v) -} - -var _ slog.LogValuer = (*OrderInfo)(nil) - -func (p *OrderInfo) Validate() error { - return nil -} - -// Attributes: -// - UID -// - NickName -// - Level -// - LogoutTime -// - LoginTime -// - Face -// -type FriendInfo struct { - UID int64 `thrift:"Uid,1" db:"Uid" json:"Uid"` - NickName string `thrift:"NickName,2" db:"NickName" json:"NickName"` - Level int32 `thrift:"Level,3" db:"Level" json:"Level"` - LogoutTime int64 `thrift:"LogoutTime,4" db:"LogoutTime" json:"LogoutTime"` - LoginTime int64 `thrift:"LoginTime,5" db:"LoginTime" json:"LoginTime"` - Face int32 `thrift:"Face,6" db:"Face" json:"Face"` -} - -func NewFriendInfo() *FriendInfo { - return &FriendInfo{} -} - - - -func (p *FriendInfo) GetUID() int64 { - return p.UID -} - - - -func (p *FriendInfo) GetNickName() string { - return p.NickName -} - - - -func (p *FriendInfo) GetLevel() int32 { - return p.Level -} - - - -func (p *FriendInfo) GetLogoutTime() int64 { - return p.LogoutTime -} - - - -func (p *FriendInfo) GetLoginTime() int64 { - return p.LoginTime -} - - - -func (p *FriendInfo) GetFace() int32 { - return p.Face -} - -func (p *FriendInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I32 { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.I64 { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.I64 { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.I32 { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *FriendInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.UID = v - } - return nil -} - -func (p *FriendInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.NickName = v - } - return nil -} - -func (p *FriendInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.Level = v - } - return nil -} - -func (p *FriendInfo) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) - } else { - p.LogoutTime = v - } - return nil -} - -func (p *FriendInfo) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) - } else { - p.LoginTime = v - } - return nil -} - -func (p *FriendInfo) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) - } else { - p.Face = v - } - return nil -} - -func (p *FriendInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "FriendInfo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } - if err := p.writeField5(ctx, oprot); err != nil { return err } - if err := p.writeField6(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *FriendInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Uid", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Uid: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.UID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Uid (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Uid: ", p), err) - } - return err -} - -func (p *FriendInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "NickName", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:NickName: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.NickName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.NickName (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:NickName: ", p), err) - } - return err -} - -func (p *FriendInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Level", thrift.I32, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:Level: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Level)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Level (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:Level: ", p), err) - } - return err -} - -func (p *FriendInfo) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "LogoutTime", thrift.I64, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:LogoutTime: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.LogoutTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.LogoutTime (4) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:LogoutTime: ", p), err) - } - return err -} - -func (p *FriendInfo) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "LoginTime", thrift.I64, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:LoginTime: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.LoginTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.LoginTime (5) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:LoginTime: ", p), err) - } - return err -} - -func (p *FriendInfo) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Face", thrift.I32, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:Face: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Face)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Face (6) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:Face: ", p), err) - } - return err -} - -func (p *FriendInfo) Equals(other *FriendInfo) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.UID != other.UID { return false } - if p.NickName != other.NickName { return false } - if p.Level != other.Level { return false } - if p.LogoutTime != other.LogoutTime { return false } - if p.LoginTime != other.LoginTime { return false } - if p.Face != other.Face { return false } - return true -} - -func (p *FriendInfo) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("FriendInfo(%+v)", *p) -} - -func (p *FriendInfo) LogValue() slog.Value { - if p == nil { - return slog.AnyValue(nil) - } - v := thrift.SlogTStructWrapper{ - Type: "*backend.FriendInfo", - Value: p, - } - return slog.AnyValue(v) -} - -var _ slog.LogValuer = (*FriendInfo)(nil) - -func (p *FriendInfo) Validate() error { - return nil -} - -type GameAdminService interface { - // Parameters: - // - UID - // - GetAdminInfo(ctx context.Context, Uid int32) (_r *ResAdminInfo, _err error) -} - -type GameAdminServiceClient struct { - c thrift.TClient - meta thrift.ResponseMeta -} - -func NewGameAdminServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *GameAdminServiceClient { - return &GameAdminServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } -} - -func NewGameAdminServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *GameAdminServiceClient { - return &GameAdminServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), - } -} - -func NewGameAdminServiceClient(c thrift.TClient) *GameAdminServiceClient { - return &GameAdminServiceClient{ - c: c, - } -} - -func (p *GameAdminServiceClient) Client_() thrift.TClient { - return p.c -} - -func (p *GameAdminServiceClient) LastResponseMeta_() thrift.ResponseMeta { - return p.meta -} - -func (p *GameAdminServiceClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { - p.meta = meta -} - -// Parameters: -// - UID -// -func (p *GameAdminServiceClient) GetAdminInfo(ctx context.Context, Uid int32) (_r *ResAdminInfo, _err error) { - var _args10 GameAdminServiceGetAdminInfoArgs - _args10.UID = Uid - var _result12 GameAdminServiceGetAdminInfoResult - var _meta11 thrift.ResponseMeta - _meta11, _err = p.Client_().Call(ctx, "GetAdminInfo", &_args10, &_result12) - p.SetLastResponseMeta_(_meta11) - if _err != nil { - return - } - if _ret13 := _result12.GetSuccess(); _ret13 != nil { - return _ret13, nil - } - return nil, thrift.NewTApplicationException(thrift.MISSING_RESULT, "GetAdminInfo failed: unknown result") -} - -type GameAdminServiceProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler GameAdminService -} - -func (p *GameAdminServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} - -func (p *GameAdminServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} - -func (p *GameAdminServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} - -func NewGameAdminServiceProcessor(handler GameAdminService) *GameAdminServiceProcessor { - - self14 := &GameAdminServiceProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} - self14.processorMap["GetAdminInfo"] = &gameAdminServiceProcessorGetAdminInfo{handler:handler} - return self14 -} - -func (p *GameAdminServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) - if err2 != nil { return false, thrift.WrapTException(err2) } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(ctx, seqId, iprot, oprot) - } - iprot.Skip(ctx, thrift.STRUCT) - iprot.ReadMessageEnd(ctx) - x15 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) - x15.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, x15 -} - -type gameAdminServiceProcessorGetAdminInfo struct { - handler GameAdminService -} - -func (p *gameAdminServiceProcessorGetAdminInfo) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - var _write_err16 thrift.TException - args := GameAdminServiceGetAdminInfoArgs{} - if err2 := args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "GetAdminInfo", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, thrift.WrapTException(err2) - } - iprot.ReadMessageEnd(ctx) - - tickerCancel := func() {} - // Start a goroutine to do server side connectivity check. - if thrift.ServerConnectivityCheckInterval > 0 { - var cancel context.CancelCauseFunc - ctx, cancel = context.WithCancelCause(ctx) - defer cancel(nil) - var tickerCtx context.Context - tickerCtx, tickerCancel = context.WithCancel(context.Background()) - defer tickerCancel() - go func(ctx context.Context, cancel context.CancelCauseFunc) { - ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) - defer ticker.Stop() - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if !iprot.Transport().IsOpen() { - cancel(thrift.ErrAbandonRequest) - return - } - } - } - }(tickerCtx, cancel) - } - - result := GameAdminServiceGetAdminInfoResult{} - if retval, err2 := p.handler.GetAdminInfo(ctx, args.UID); err2 != nil { - tickerCancel() - err = thrift.WrapTException(err2) - if errors.Is(err2, thrift.ErrAbandonRequest) { - return false, &thrift.ProcessorError{ - WriteError: thrift.WrapTException(err2), - EndpointError: err, - } - } - if errors.Is(err2, context.Canceled) { - if err3 := context.Cause(ctx); errors.Is(err3, thrift.ErrAbandonRequest) { - return false, &thrift.ProcessorError{ - WriteError: thrift.WrapTException(err3), - EndpointError: err, - } - } - } - _exc17 := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetAdminInfo: " + err2.Error()) - if err2 := oprot.WriteMessageBegin(ctx, "GetAdminInfo", thrift.EXCEPTION, seqId); err2 != nil { - _write_err16 = thrift.WrapTException(err2) - } - if err2 := _exc17.Write(ctx, oprot); _write_err16 == nil && err2 != nil { - _write_err16 = thrift.WrapTException(err2) - } - if err2 := oprot.WriteMessageEnd(ctx); _write_err16 == nil && err2 != nil { - _write_err16 = thrift.WrapTException(err2) - } - if err2 := oprot.Flush(ctx); _write_err16 == nil && err2 != nil { - _write_err16 = thrift.WrapTException(err2) - } - if _write_err16 != nil { - return false, &thrift.ProcessorError{ - WriteError: _write_err16, - EndpointError: err, - } - } - return true, err - } else { - result.Success = retval - } - tickerCancel() - if err2 := oprot.WriteMessageBegin(ctx, "GetAdminInfo", thrift.REPLY, seqId); err2 != nil { - _write_err16 = thrift.WrapTException(err2) - } - if err2 := result.Write(ctx, oprot); _write_err16 == nil && err2 != nil { - _write_err16 = thrift.WrapTException(err2) - } - if err2 := oprot.WriteMessageEnd(ctx); _write_err16 == nil && err2 != nil { - _write_err16 = thrift.WrapTException(err2) - } - if err2 := oprot.Flush(ctx); _write_err16 == nil && err2 != nil { - _write_err16 = thrift.WrapTException(err2) - } - if _write_err16 != nil { - return false, &thrift.ProcessorError{ - WriteError: _write_err16, - EndpointError: err, - } - } - return true, err -} - - -// HELPER FUNCTIONS AND STRUCTURES - -// Attributes: -// - UID -// -type GameAdminServiceGetAdminInfoArgs struct { - UID int32 `thrift:"Uid,1" db:"Uid" json:"Uid"` -} - -func NewGameAdminServiceGetAdminInfoArgs() *GameAdminServiceGetAdminInfoArgs { - return &GameAdminServiceGetAdminInfoArgs{} -} - - - -func (p *GameAdminServiceGetAdminInfoArgs) GetUID() int32 { - return p.UID -} - -func (p *GameAdminServiceGetAdminInfoArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I32 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *GameAdminServiceGetAdminInfoArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.UID = v - } - return nil -} - -func (p *GameAdminServiceGetAdminInfoArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "GetAdminInfo_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *GameAdminServiceGetAdminInfoArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "Uid", thrift.I32, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Uid: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.UID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.Uid (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Uid: ", p), err) - } - return err -} - -func (p *GameAdminServiceGetAdminInfoArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GameAdminServiceGetAdminInfoArgs(%+v)", *p) -} - -func (p *GameAdminServiceGetAdminInfoArgs) LogValue() slog.Value { - if p == nil { - return slog.AnyValue(nil) - } - v := thrift.SlogTStructWrapper{ - Type: "*backend.GameAdminServiceGetAdminInfoArgs", - Value: p, - } - return slog.AnyValue(v) -} - -var _ slog.LogValuer = (*GameAdminServiceGetAdminInfoArgs)(nil) - -// Attributes: -// - Success -// -type GameAdminServiceGetAdminInfoResult struct { - Success *ResAdminInfo `thrift:"success,0" db:"success" json:"success,omitempty"` -} - -func NewGameAdminServiceGetAdminInfoResult() *GameAdminServiceGetAdminInfoResult { - return &GameAdminServiceGetAdminInfoResult{} -} - -var GameAdminServiceGetAdminInfoResult_Success_DEFAULT *ResAdminInfo - -func (p *GameAdminServiceGetAdminInfoResult) GetSuccess() *ResAdminInfo { - if !p.IsSetSuccess() { - return GameAdminServiceGetAdminInfoResult_Success_DEFAULT - } - return p.Success -} - -func (p *GameAdminServiceGetAdminInfoResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GameAdminServiceGetAdminInfoResult) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *GameAdminServiceGetAdminInfoResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &ResAdminInfo{} - if err := p.Success.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) - } - return nil -} - -func (p *GameAdminServiceGetAdminInfoResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "GetAdminInfo_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField0(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *GameAdminServiceGetAdminInfoResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) - } - if err := p.Success.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) - } - } - return err -} - -func (p *GameAdminServiceGetAdminInfoResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GameAdminServiceGetAdminInfoResult(%+v)", *p) -} - -func (p *GameAdminServiceGetAdminInfoResult) LogValue() slog.Value { - if p == nil { - return slog.AnyValue(nil) - } - v := thrift.SlogTStructWrapper{ - Type: "*backend.GameAdminServiceGetAdminInfoResult", - Value: p, - } - return slog.AnyValue(v) -} - -var _ slog.LogValuer = (*GameAdminServiceGetAdminInfoResult)(nil) - - diff --git a/src/server/gen-go/backend/game_admin_service-remote/game_admin_service-remote.go b/src/server/gen-go/backend/game_admin_service-remote/game_admin_service-remote.go deleted file mode 100644 index e7023cd0..00000000 --- a/src/server/gen-go/backend/game_admin_service-remote/game_admin_service-remote.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by Thrift Compiler (0.22.0). DO NOT EDIT. - -package main - -import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - thrift "github.com/apache/thrift/lib/go/thrift" - "server/gen-go/backend" -) - -var _ = backend.GoUnusedProtection__ - -func Usage() { - fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") - flag.PrintDefaults() - fmt.Fprintln(os.Stderr, "\nFunctions:") - fmt.Fprintln(os.Stderr, " ResAdminInfo GetAdminInfo(i32 Uid)") - fmt.Fprintln(os.Stderr) - os.Exit(0) -} - -type httpHeaders map[string]string - -func (h httpHeaders) String() string { - var m map[string]string = h - return fmt.Sprintf("%s", m) -} - -func (h httpHeaders) Set(value string) error { - parts := strings.Split(value, ": ") - if len(parts) != 2 { - return fmt.Errorf("header should be of format 'Key: Value'") - } - h[parts[0]] = parts[1] - return nil -} - -func main() { - flag.Usage = Usage - var host string - var port int - var protocol string - var urlString string - var framed bool - var useHttp bool - headers := make(httpHeaders) - var parsedUrl *url.URL - var trans thrift.TTransport - _ = strconv.Atoi - _ = math.Abs - flag.Usage = Usage - flag.StringVar(&host, "h", "localhost", "Specify host and port") - flag.IntVar(&port, "p", 9090, "Specify port") - flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") - flag.StringVar(&urlString, "u", "", "Specify the url") - flag.BoolVar(&framed, "framed", false, "Use framed transport") - flag.BoolVar(&useHttp, "http", false, "Use http") - flag.Var(headers, "H", "Headers to set on the http(s) request (e.g. -H \"Key: Value\")") - flag.Parse() - - if len(urlString) > 0 { - var err error - parsedUrl, err = url.Parse(urlString) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - host = parsedUrl.Host - useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" || parsedUrl.Scheme == "https" - } else if useHttp { - _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - } - - cmd := flag.Arg(0) - var err error - var cfg *thrift.TConfiguration = nil - if useHttp { - trans, err = thrift.NewTHttpClient(parsedUrl.String()) - if len(headers) > 0 { - httptrans := trans.(*thrift.THttpClient) - for key, value := range headers { - httptrans.SetHeader(key, value) - } - } - } else { - portStr := fmt.Sprint(port) - if strings.Contains(host, ":") { - host, portStr, err = net.SplitHostPort(host) - if err != nil { - fmt.Fprintln(os.Stderr, "error with host:", err) - os.Exit(1) - } - } - trans = thrift.NewTSocketConf(net.JoinHostPort(host, portStr), cfg) - if err != nil { - fmt.Fprintln(os.Stderr, "error resolving address:", err) - os.Exit(1) - } - if framed { - trans = thrift.NewTFramedTransportConf(trans, cfg) - } - } - if err != nil { - fmt.Fprintln(os.Stderr, "Error creating transport", err) - os.Exit(1) - } - defer trans.Close() - var protocolFactory thrift.TProtocolFactory - switch protocol { - case "compact": - protocolFactory = thrift.NewTCompactProtocolFactoryConf(cfg) - case "simplejson": - protocolFactory = thrift.NewTSimpleJSONProtocolFactoryConf(cfg) - case "json": - protocolFactory = thrift.NewTJSONProtocolFactory() - case "binary", "": - protocolFactory = thrift.NewTBinaryProtocolFactoryConf(cfg) - default: - fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) - Usage() - os.Exit(1) - } - iprot := protocolFactory.GetProtocol(trans) - oprot := protocolFactory.GetProtocol(trans) - client := backend.NewGameAdminServiceClient(thrift.NewTStandardClient(iprot, oprot)) - if err := trans.Open(); err != nil { - fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) - os.Exit(1) - } - - switch cmd { - case "GetAdminInfo": - if flag.NArg() - 1 != 1 { - fmt.Fprintln(os.Stderr, "GetAdminInfo requires 1 args") - flag.Usage() - } - tmp0, err18 := (strconv.Atoi(flag.Arg(1))) - if err18 != nil { - Usage() - return - } - argvalue0 := int32(tmp0) - value0 := argvalue0 - fmt.Print(client.GetAdminInfo(context.Background(), value0)) - fmt.Print("\n") - break - case "": - Usage() - default: - fmt.Fprintln(os.Stderr, "Invalid function ", cmd) - } -}