Refactor: Remove deprecated gRPC service files and implement new API structure

- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`.
- Added new API server implementations for objectstory, player, and shop services.
- Introduced configuration files for new APIs in `etc/*.yaml`.
- Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`.
- Removed unused user update handler and user API files.
- Added utility functions for context management and HTTP header parsing.
- Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
This commit is contained in:
wwweww
2026-02-28 18:35:56 +08:00
parent d2f33b4b96
commit 19cc7a778c
349 changed files with 42548 additions and 1453 deletions
+467
View File
@@ -0,0 +1,467 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v5.29.6
// source: wallet.proto
package pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
WalletService_AddWalletTransactions_FullMethodName = "/pb.walletService/AddWalletTransactions"
WalletService_UpdateWalletTransactions_FullMethodName = "/pb.walletService/UpdateWalletTransactions"
WalletService_DelWalletTransactions_FullMethodName = "/pb.walletService/DelWalletTransactions"
WalletService_GetWalletTransactionsById_FullMethodName = "/pb.walletService/GetWalletTransactionsById"
WalletService_SearchWalletTransactions_FullMethodName = "/pb.walletService/SearchWalletTransactions"
WalletService_AddWallets_FullMethodName = "/pb.walletService/AddWallets"
WalletService_UpdateWallets_FullMethodName = "/pb.walletService/UpdateWallets"
WalletService_DelWallets_FullMethodName = "/pb.walletService/DelWallets"
WalletService_GetWalletsById_FullMethodName = "/pb.walletService/GetWalletsById"
WalletService_SearchWallets_FullMethodName = "/pb.walletService/SearchWallets"
)
// WalletServiceClient is the client API for WalletService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type WalletServiceClient interface {
// -----------------------walletTransactions-----------------------
AddWalletTransactions(ctx context.Context, in *AddWalletTransactionsReq, opts ...grpc.CallOption) (*AddWalletTransactionsResp, error)
UpdateWalletTransactions(ctx context.Context, in *UpdateWalletTransactionsReq, opts ...grpc.CallOption) (*UpdateWalletTransactionsResp, error)
DelWalletTransactions(ctx context.Context, in *DelWalletTransactionsReq, opts ...grpc.CallOption) (*DelWalletTransactionsResp, error)
GetWalletTransactionsById(ctx context.Context, in *GetWalletTransactionsByIdReq, opts ...grpc.CallOption) (*GetWalletTransactionsByIdResp, error)
SearchWalletTransactions(ctx context.Context, in *SearchWalletTransactionsReq, opts ...grpc.CallOption) (*SearchWalletTransactionsResp, error)
// -----------------------wallets-----------------------
AddWallets(ctx context.Context, in *AddWalletsReq, opts ...grpc.CallOption) (*AddWalletsResp, error)
UpdateWallets(ctx context.Context, in *UpdateWalletsReq, opts ...grpc.CallOption) (*UpdateWalletsResp, error)
DelWallets(ctx context.Context, in *DelWalletsReq, opts ...grpc.CallOption) (*DelWalletsResp, error)
GetWalletsById(ctx context.Context, in *GetWalletsByIdReq, opts ...grpc.CallOption) (*GetWalletsByIdResp, error)
SearchWallets(ctx context.Context, in *SearchWalletsReq, opts ...grpc.CallOption) (*SearchWalletsResp, error)
}
type walletServiceClient struct {
cc grpc.ClientConnInterface
}
func NewWalletServiceClient(cc grpc.ClientConnInterface) WalletServiceClient {
return &walletServiceClient{cc}
}
func (c *walletServiceClient) AddWalletTransactions(ctx context.Context, in *AddWalletTransactionsReq, opts ...grpc.CallOption) (*AddWalletTransactionsResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddWalletTransactionsResp)
err := c.cc.Invoke(ctx, WalletService_AddWalletTransactions_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) UpdateWalletTransactions(ctx context.Context, in *UpdateWalletTransactionsReq, opts ...grpc.CallOption) (*UpdateWalletTransactionsResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateWalletTransactionsResp)
err := c.cc.Invoke(ctx, WalletService_UpdateWalletTransactions_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) DelWalletTransactions(ctx context.Context, in *DelWalletTransactionsReq, opts ...grpc.CallOption) (*DelWalletTransactionsResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DelWalletTransactionsResp)
err := c.cc.Invoke(ctx, WalletService_DelWalletTransactions_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) GetWalletTransactionsById(ctx context.Context, in *GetWalletTransactionsByIdReq, opts ...grpc.CallOption) (*GetWalletTransactionsByIdResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetWalletTransactionsByIdResp)
err := c.cc.Invoke(ctx, WalletService_GetWalletTransactionsById_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) SearchWalletTransactions(ctx context.Context, in *SearchWalletTransactionsReq, opts ...grpc.CallOption) (*SearchWalletTransactionsResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SearchWalletTransactionsResp)
err := c.cc.Invoke(ctx, WalletService_SearchWalletTransactions_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) AddWallets(ctx context.Context, in *AddWalletsReq, opts ...grpc.CallOption) (*AddWalletsResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddWalletsResp)
err := c.cc.Invoke(ctx, WalletService_AddWallets_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) UpdateWallets(ctx context.Context, in *UpdateWalletsReq, opts ...grpc.CallOption) (*UpdateWalletsResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateWalletsResp)
err := c.cc.Invoke(ctx, WalletService_UpdateWallets_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) DelWallets(ctx context.Context, in *DelWalletsReq, opts ...grpc.CallOption) (*DelWalletsResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DelWalletsResp)
err := c.cc.Invoke(ctx, WalletService_DelWallets_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) GetWalletsById(ctx context.Context, in *GetWalletsByIdReq, opts ...grpc.CallOption) (*GetWalletsByIdResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetWalletsByIdResp)
err := c.cc.Invoke(ctx, WalletService_GetWalletsById_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) SearchWallets(ctx context.Context, in *SearchWalletsReq, opts ...grpc.CallOption) (*SearchWalletsResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SearchWalletsResp)
err := c.cc.Invoke(ctx, WalletService_SearchWallets_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// WalletServiceServer is the server API for WalletService service.
// All implementations must embed UnimplementedWalletServiceServer
// for forward compatibility.
type WalletServiceServer interface {
// -----------------------walletTransactions-----------------------
AddWalletTransactions(context.Context, *AddWalletTransactionsReq) (*AddWalletTransactionsResp, error)
UpdateWalletTransactions(context.Context, *UpdateWalletTransactionsReq) (*UpdateWalletTransactionsResp, error)
DelWalletTransactions(context.Context, *DelWalletTransactionsReq) (*DelWalletTransactionsResp, error)
GetWalletTransactionsById(context.Context, *GetWalletTransactionsByIdReq) (*GetWalletTransactionsByIdResp, error)
SearchWalletTransactions(context.Context, *SearchWalletTransactionsReq) (*SearchWalletTransactionsResp, error)
// -----------------------wallets-----------------------
AddWallets(context.Context, *AddWalletsReq) (*AddWalletsResp, error)
UpdateWallets(context.Context, *UpdateWalletsReq) (*UpdateWalletsResp, error)
DelWallets(context.Context, *DelWalletsReq) (*DelWalletsResp, error)
GetWalletsById(context.Context, *GetWalletsByIdReq) (*GetWalletsByIdResp, error)
SearchWallets(context.Context, *SearchWalletsReq) (*SearchWalletsResp, error)
mustEmbedUnimplementedWalletServiceServer()
}
// UnimplementedWalletServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedWalletServiceServer struct{}
func (UnimplementedWalletServiceServer) AddWalletTransactions(context.Context, *AddWalletTransactionsReq) (*AddWalletTransactionsResp, error) {
return nil, status.Error(codes.Unimplemented, "method AddWalletTransactions not implemented")
}
func (UnimplementedWalletServiceServer) UpdateWalletTransactions(context.Context, *UpdateWalletTransactionsReq) (*UpdateWalletTransactionsResp, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateWalletTransactions not implemented")
}
func (UnimplementedWalletServiceServer) DelWalletTransactions(context.Context, *DelWalletTransactionsReq) (*DelWalletTransactionsResp, error) {
return nil, status.Error(codes.Unimplemented, "method DelWalletTransactions not implemented")
}
func (UnimplementedWalletServiceServer) GetWalletTransactionsById(context.Context, *GetWalletTransactionsByIdReq) (*GetWalletTransactionsByIdResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetWalletTransactionsById not implemented")
}
func (UnimplementedWalletServiceServer) SearchWalletTransactions(context.Context, *SearchWalletTransactionsReq) (*SearchWalletTransactionsResp, error) {
return nil, status.Error(codes.Unimplemented, "method SearchWalletTransactions not implemented")
}
func (UnimplementedWalletServiceServer) AddWallets(context.Context, *AddWalletsReq) (*AddWalletsResp, error) {
return nil, status.Error(codes.Unimplemented, "method AddWallets not implemented")
}
func (UnimplementedWalletServiceServer) UpdateWallets(context.Context, *UpdateWalletsReq) (*UpdateWalletsResp, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateWallets not implemented")
}
func (UnimplementedWalletServiceServer) DelWallets(context.Context, *DelWalletsReq) (*DelWalletsResp, error) {
return nil, status.Error(codes.Unimplemented, "method DelWallets not implemented")
}
func (UnimplementedWalletServiceServer) GetWalletsById(context.Context, *GetWalletsByIdReq) (*GetWalletsByIdResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetWalletsById not implemented")
}
func (UnimplementedWalletServiceServer) SearchWallets(context.Context, *SearchWalletsReq) (*SearchWalletsResp, error) {
return nil, status.Error(codes.Unimplemented, "method SearchWallets not implemented")
}
func (UnimplementedWalletServiceServer) mustEmbedUnimplementedWalletServiceServer() {}
func (UnimplementedWalletServiceServer) testEmbeddedByValue() {}
// UnsafeWalletServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WalletServiceServer will
// result in compilation errors.
type UnsafeWalletServiceServer interface {
mustEmbedUnimplementedWalletServiceServer()
}
func RegisterWalletServiceServer(s grpc.ServiceRegistrar, srv WalletServiceServer) {
// If the following call panics, it indicates UnimplementedWalletServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&WalletService_ServiceDesc, srv)
}
func _WalletService_AddWalletTransactions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddWalletTransactionsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).AddWalletTransactions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_AddWalletTransactions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).AddWalletTransactions(ctx, req.(*AddWalletTransactionsReq))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_UpdateWalletTransactions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateWalletTransactionsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).UpdateWalletTransactions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_UpdateWalletTransactions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).UpdateWalletTransactions(ctx, req.(*UpdateWalletTransactionsReq))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_DelWalletTransactions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DelWalletTransactionsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).DelWalletTransactions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_DelWalletTransactions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).DelWalletTransactions(ctx, req.(*DelWalletTransactionsReq))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_GetWalletTransactionsById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWalletTransactionsByIdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).GetWalletTransactionsById(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_GetWalletTransactionsById_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).GetWalletTransactionsById(ctx, req.(*GetWalletTransactionsByIdReq))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_SearchWalletTransactions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchWalletTransactionsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).SearchWalletTransactions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_SearchWalletTransactions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).SearchWalletTransactions(ctx, req.(*SearchWalletTransactionsReq))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_AddWallets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddWalletsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).AddWallets(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_AddWallets_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).AddWallets(ctx, req.(*AddWalletsReq))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_UpdateWallets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateWalletsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).UpdateWallets(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_UpdateWallets_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).UpdateWallets(ctx, req.(*UpdateWalletsReq))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_DelWallets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DelWalletsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).DelWallets(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_DelWallets_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).DelWallets(ctx, req.(*DelWalletsReq))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_GetWalletsById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWalletsByIdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).GetWalletsById(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_GetWalletsById_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).GetWalletsById(ctx, req.(*GetWalletsByIdReq))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_SearchWallets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchWalletsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).SearchWallets(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_SearchWallets_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).SearchWallets(ctx, req.(*SearchWalletsReq))
}
return interceptor(ctx, in, info, handler)
}
// WalletService_ServiceDesc is the grpc.ServiceDesc for WalletService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var WalletService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pb.walletService",
HandlerType: (*WalletServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AddWalletTransactions",
Handler: _WalletService_AddWalletTransactions_Handler,
},
{
MethodName: "UpdateWalletTransactions",
Handler: _WalletService_UpdateWalletTransactions_Handler,
},
{
MethodName: "DelWalletTransactions",
Handler: _WalletService_DelWalletTransactions_Handler,
},
{
MethodName: "GetWalletTransactionsById",
Handler: _WalletService_GetWalletTransactionsById_Handler,
},
{
MethodName: "SearchWalletTransactions",
Handler: _WalletService_SearchWalletTransactions_Handler,
},
{
MethodName: "AddWallets",
Handler: _WalletService_AddWallets_Handler,
},
{
MethodName: "UpdateWallets",
Handler: _WalletService_UpdateWallets_Handler,
},
{
MethodName: "DelWallets",
Handler: _WalletService_DelWallets_Handler,
},
{
MethodName: "GetWalletsById",
Handler: _WalletService_GetWalletsById_Handler,
},
{
MethodName: "SearchWallets",
Handler: _WalletService_SearchWallets_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "wallet.proto",
}