From 0449bf9683f64cad8ff60334a3d78c2c219e5eaf Mon Sep 17 00:00:00 2001 From: gjs Date: Mon, 2 Nov 2026 15:08:56 +0800 Subject: [PATCH 1/3] fix --- services/water/internal/logic/applyUserLogic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/water/internal/logic/applyUserLogic.go b/services/water/internal/logic/applyUserLogic.go index 69629d0..6238373 100644 --- a/services/water/internal/logic/applyUserLogic.go +++ b/services/water/internal/logic/applyUserLogic.go @@ -29,7 +29,7 @@ func NewApplyUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApplyUs } } -// 申请 +// ApplyUser 申请 func (l *ApplyUserLogic) ApplyUser(in *water.ApplyUserRequest) (*water.Response, error) { var v validator.UserApplyValidator if fail := l.checkParams(in, &v); fail != nil { From 997b4bca47f773e00b0eb6854ad19e866447f014 Mon Sep 17 00:00:00 2001 From: gjs Date: Mon, 2 Nov 2026 16:23:13 +0800 Subject: [PATCH 2/3] add apis --- rpc/water/pb/water.pb.go | 46 ++++++------ rpc/water/pb/water_grpc.pb.go | 68 ++++++++++++++---- rpc/water/water.pb | Bin 15876 -> 16322 bytes rpc/water/water.proto | 7 ++ .../internal/logic/usersApplyItemsLogic.go | 51 +++++++++++++ services/water/internal/server/waterServer.go | 5 ++ services/water/waterClient/water.go | 6 ++ 7 files changed, 147 insertions(+), 36 deletions(-) create mode 100644 services/water/internal/logic/usersApplyItemsLogic.go diff --git a/rpc/water/pb/water.pb.go b/rpc/water/pb/water.pb.go index 6639d5a..76984ac 100644 --- a/rpc/water/pb/water.pb.go +++ b/rpc/water/pb/water.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 -// protoc v4.25.8 +// protoc-gen-go v1.36.12 +// protoc v3.19.4 // source: water/water.proto package water @@ -924,7 +924,8 @@ const file_water_water_proto_rawDesc = "" + "\n" + "use_number\x18\x05 \x01(\x05R\tuseNumber\x12\x16\n" + "\x06soften\x18\x06 \x01(\x05R\x06soften\x12#\n" + - "\rno_disturbing\x18\a \x01(\tR\fnoDisturbing2\xfd\t\n" + + "\rno_disturbing\x18\a \x01(\tR\fnoDisturbing2\xdc\n" + + "\n" + "\x05Water\x12Z\n" + "\tWifiCheck\x12\x17.water.WifiCheckRequest\x1a\x0f.water.Response\"#\x82\xd3\xe4\x93\x02\x1d:\x01*\x12\x18/api/v3/water/wifi/check\x12T\n" + "\aWifiSet\x12\x15.water.WifiSetRequest\x1a\x0f.water.Response\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/api/v3/water/wifi/set\x12Q\n" + @@ -941,7 +942,8 @@ const file_water_water_proto_rawDesc = "" + "\rWarningStatus\x12\x1b.water.WarningStatusRequest\x1a\x0f.water.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/api/v3/water/warning/status\x12U\n" + "\tApplyUser\x12\x17.water.ApplyUserRequest\x1a\x0f.water.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/api/v3/water/apply\x12`\n" + "\vApplyStatus\x12\x19.water.ApplyStatusRequest\x1a\x0f.water.Response\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\"\x1a/api/v3/water/apply/status\x12`\n" + - "\vchangeAdmin\x12\x19.water.changeAdminRequest\x1a\x0f.water.Response\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\"\x1a/api/v3/water/change/admin\x12M\n" + + "\vchangeAdmin\x12\x19.water.changeAdminRequest\x1a\x0f.water.Response\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\"\x1a/api/v3/water/change/admin\x12]\n" + + "\x0fUsersApplyItems\x12\x13.water.UsersRequest\x1a\x0f.water.Response\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\x12\x19/api/v3/water/users/apply\x12M\n" + "\x05Users\x12\x13.water.UsersRequest\x1a\x0f.water.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/api/v3/water/usersB\tZ\a./waterb\x06proto3" var ( @@ -988,23 +990,25 @@ var file_water_water_proto_depIdxs = []int32{ 12, // 10: water.Water.ApplyUser:input_type -> water.ApplyUserRequest 13, // 11: water.Water.ApplyStatus:input_type -> water.ApplyStatusRequest 10, // 12: water.Water.changeAdmin:input_type -> water.changeAdminRequest - 11, // 13: water.Water.Users:input_type -> water.UsersRequest - 5, // 14: water.Water.WifiCheck:output_type -> water.Response - 5, // 15: water.Water.WifiSet:output_type -> water.Response - 5, // 16: water.Water.AddLog:output_type -> water.Response - 5, // 17: water.Water.LogItems:output_type -> water.Response - 5, // 18: water.Water.Setting:output_type -> water.Response - 5, // 19: water.Water.GetSetting:output_type -> water.Response - 5, // 20: water.Water.GetWaterInfo:output_type -> water.Response - 5, // 21: water.Water.GetWarning:output_type -> water.Response - 5, // 22: water.Water.AddWarning:output_type -> water.Response - 5, // 23: water.Water.WarningStatus:output_type -> water.Response - 5, // 24: water.Water.ApplyUser:output_type -> water.Response - 5, // 25: water.Water.ApplyStatus:output_type -> water.Response - 5, // 26: water.Water.changeAdmin:output_type -> water.Response - 5, // 27: water.Water.Users:output_type -> water.Response - 14, // [14:28] is the sub-list for method output_type - 0, // [0:14] is the sub-list for method input_type + 11, // 13: water.Water.UsersApplyItems:input_type -> water.UsersRequest + 11, // 14: water.Water.Users:input_type -> water.UsersRequest + 5, // 15: water.Water.WifiCheck:output_type -> water.Response + 5, // 16: water.Water.WifiSet:output_type -> water.Response + 5, // 17: water.Water.AddLog:output_type -> water.Response + 5, // 18: water.Water.LogItems:output_type -> water.Response + 5, // 19: water.Water.Setting:output_type -> water.Response + 5, // 20: water.Water.GetSetting:output_type -> water.Response + 5, // 21: water.Water.GetWaterInfo:output_type -> water.Response + 5, // 22: water.Water.GetWarning:output_type -> water.Response + 5, // 23: water.Water.AddWarning:output_type -> water.Response + 5, // 24: water.Water.WarningStatus:output_type -> water.Response + 5, // 25: water.Water.ApplyUser:output_type -> water.Response + 5, // 26: water.Water.ApplyStatus:output_type -> water.Response + 5, // 27: water.Water.changeAdmin:output_type -> water.Response + 5, // 28: water.Water.UsersApplyItems:output_type -> water.Response + 5, // 29: water.Water.Users:output_type -> water.Response + 15, // [15:30] is the sub-list for method output_type + 0, // [0:15] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name diff --git a/rpc/water/pb/water_grpc.pb.go b/rpc/water/pb/water_grpc.pb.go index db7df77..24fbe2a 100644 --- a/rpc/water/pb/water_grpc.pb.go +++ b/rpc/water/pb/water_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.2 -// - protoc v4.25.8 +// - protoc v3.19.4 // source: water/water.proto package water @@ -19,20 +19,21 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Water_WifiCheck_FullMethodName = "/water.Water/WifiCheck" - Water_WifiSet_FullMethodName = "/water.Water/WifiSet" - Water_AddLog_FullMethodName = "/water.Water/AddLog" - Water_LogItems_FullMethodName = "/water.Water/LogItems" - Water_Setting_FullMethodName = "/water.Water/Setting" - Water_GetSetting_FullMethodName = "/water.Water/GetSetting" - Water_GetWaterInfo_FullMethodName = "/water.Water/GetWaterInfo" - Water_GetWarning_FullMethodName = "/water.Water/GetWarning" - Water_AddWarning_FullMethodName = "/water.Water/AddWarning" - Water_WarningStatus_FullMethodName = "/water.Water/WarningStatus" - Water_ApplyUser_FullMethodName = "/water.Water/ApplyUser" - Water_ApplyStatus_FullMethodName = "/water.Water/ApplyStatus" - Water_ChangeAdmin_FullMethodName = "/water.Water/changeAdmin" - Water_Users_FullMethodName = "/water.Water/Users" + Water_WifiCheck_FullMethodName = "/water.Water/WifiCheck" + Water_WifiSet_FullMethodName = "/water.Water/WifiSet" + Water_AddLog_FullMethodName = "/water.Water/AddLog" + Water_LogItems_FullMethodName = "/water.Water/LogItems" + Water_Setting_FullMethodName = "/water.Water/Setting" + Water_GetSetting_FullMethodName = "/water.Water/GetSetting" + Water_GetWaterInfo_FullMethodName = "/water.Water/GetWaterInfo" + Water_GetWarning_FullMethodName = "/water.Water/GetWarning" + Water_AddWarning_FullMethodName = "/water.Water/AddWarning" + Water_WarningStatus_FullMethodName = "/water.Water/WarningStatus" + Water_ApplyUser_FullMethodName = "/water.Water/ApplyUser" + Water_ApplyStatus_FullMethodName = "/water.Water/ApplyStatus" + Water_ChangeAdmin_FullMethodName = "/water.Water/changeAdmin" + Water_UsersApplyItems_FullMethodName = "/water.Water/UsersApplyItems" + Water_Users_FullMethodName = "/water.Water/Users" ) // WaterClient is the client API for Water service. @@ -59,6 +60,7 @@ type WaterClient interface { ApplyStatus(ctx context.Context, in *ApplyStatusRequest, opts ...grpc.CallOption) (*Response, error) // 转移管理人 ChangeAdmin(ctx context.Context, in *ChangeAdminRequest, opts ...grpc.CallOption) (*Response, error) + UsersApplyItems(ctx context.Context, in *UsersRequest, opts ...grpc.CallOption) (*Response, error) // 管理人列表 Users(ctx context.Context, in *UsersRequest, opts ...grpc.CallOption) (*Response, error) } @@ -201,6 +203,16 @@ func (c *waterClient) ChangeAdmin(ctx context.Context, in *ChangeAdminRequest, o return out, nil } +func (c *waterClient) UsersApplyItems(ctx context.Context, in *UsersRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Water_UsersApplyItems_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *waterClient) Users(ctx context.Context, in *UsersRequest, opts ...grpc.CallOption) (*Response, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Response) @@ -235,6 +247,7 @@ type WaterServer interface { ApplyStatus(context.Context, *ApplyStatusRequest) (*Response, error) // 转移管理人 ChangeAdmin(context.Context, *ChangeAdminRequest) (*Response, error) + UsersApplyItems(context.Context, *UsersRequest) (*Response, error) // 管理人列表 Users(context.Context, *UsersRequest) (*Response, error) mustEmbedUnimplementedWaterServer() @@ -286,6 +299,9 @@ func (UnimplementedWaterServer) ApplyStatus(context.Context, *ApplyStatusRequest func (UnimplementedWaterServer) ChangeAdmin(context.Context, *ChangeAdminRequest) (*Response, error) { return nil, status.Error(codes.Unimplemented, "method ChangeAdmin not implemented") } +func (UnimplementedWaterServer) UsersApplyItems(context.Context, *UsersRequest) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method UsersApplyItems not implemented") +} func (UnimplementedWaterServer) Users(context.Context, *UsersRequest) (*Response, error) { return nil, status.Error(codes.Unimplemented, "method Users not implemented") } @@ -544,6 +560,24 @@ func _Water_ChangeAdmin_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Water_UsersApplyItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UsersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaterServer).UsersApplyItems(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Water_UsersApplyItems_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaterServer).UsersApplyItems(ctx, req.(*UsersRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Water_Users_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UsersRequest) if err := dec(in); err != nil { @@ -621,6 +655,10 @@ var Water_ServiceDesc = grpc.ServiceDesc{ MethodName: "changeAdmin", Handler: _Water_ChangeAdmin_Handler, }, + { + MethodName: "UsersApplyItems", + Handler: _Water_UsersApplyItems_Handler, + }, { MethodName: "Users", Handler: _Water_Users_Handler, diff --git a/rpc/water/water.pb b/rpc/water/water.pb index 2c6bbfc344e08392d8766f9d7fda0be17ad5fae8..b5ba03c6818f2d4b2a36e94536716313ec8747eb 100644 GIT binary patch delta 636 zcmZpvIaI%4Efdr8q{-`7}F= zCl_TFl;jubl^KFW;?pv7QsWWA@x`en@u?Lhsd>ej`FT>hSai7ob-2LI2~I6>g(+8> z!MfRrSyhE;E%)S1^=P(DjLaM_*e4%RH<= zBc~9HpTD20L<{>OMs6XtFxMbYw@8WSlN&XYWngMVg!p}2{oF%5;sb(Q-8>^)T_jp2 zX~n^ejMGxz+^zMDvA&xTXum+WpHvg0kSvfX#I9G6q?cS!AjJ=2I2RPSr6!h?7Nr&o z$#cA97vcbkW+j#-N(q2iUO*OHfi%Y}b|E&9aC*KJABc9(hf6ARwD}2ffdmVR@=Nj! zrG!9iz5p->rfPGA4mT6iJm$@`VE|dz5C~&l3iKycI(xT+l_~iVQ)cDN2 zw0xvk(!vr;!C>XiK-Hc=#fT`nz{Dl!o|>1s`LMnM3**1dPmK9kneK3H{$jD7MKG3& nKeRZtsMxWfAg9u^BsF*PDqD@o&#c6`OF_c=i6HUG^KDZB>S^Di delta 252 zcmX?9-%_(-EfZ5m!sPW#CXCUOpECLJ@^Cb~IrX1Wpb|>L>A>9i-&NsS$uf%=MTGc$T>acbJmLd_T-`h)z{W!iDbR|W zd__wgV&vvuTF)8T**IRX3v~N!&eP>)V%o~IxmsU?5zPmZhMFvl^EW%2^06}g<=h-> LwVq{iqJ1I&)mKsD diff --git a/rpc/water/water.proto b/rpc/water/water.proto index 0518154..7e85798 100644 --- a/rpc/water/water.proto +++ b/rpc/water/water.proto @@ -182,6 +182,13 @@ service Water { }; } + rpc UsersApplyItems(UsersRequest) returns (Response) { + option (google.api.http) = { + get: "/api/v3/water/users/apply" + body: "*" + }; + } + // 管理人列表 rpc Users(UsersRequest) returns (Response) { option (google.api.http) = { diff --git a/services/water/internal/logic/usersApplyItemsLogic.go b/services/water/internal/logic/usersApplyItemsLogic.go new file mode 100644 index 0000000..03899ac --- /dev/null +++ b/services/water/internal/logic/usersApplyItemsLogic.go @@ -0,0 +1,51 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/water/internal/dao" + "lone-services/services/water/model" + "lone-services/services/water/validator" + + "lone-services/rpc/water/pb" + "lone-services/services/water/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UsersApplyItemsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewUsersApplyItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UsersApplyItemsLogic { + return &UsersApplyItemsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UsersApplyItemsLogic) UsersApplyItems(in *water.UsersRequest) (*water.Response, error) { + var v validator.UserItemsValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + + w := modelbase.Params{Eq: map[string]string{"host_code": in.HostCode, "status": utils.StatusForbiddenString}} + + var info []dao.UsersInfo + items, err := model.UsersModel{}.Init().Page(w, &info) + if err != nil { + return l.fail(utils.Fail) + } + + return l.ok(items) +} diff --git a/services/water/internal/server/waterServer.go b/services/water/internal/server/waterServer.go index f53de56..e2d8d3f 100644 --- a/services/water/internal/server/waterServer.go +++ b/services/water/internal/server/waterServer.go @@ -95,6 +95,11 @@ func (s *WaterServer) ChangeAdmin(ctx context.Context, in *water.ChangeAdminRequ return l.ChangeAdmin(in) } +func (s *WaterServer) UsersApplyItems(ctx context.Context, in *water.UsersRequest) (*water.Response, error) { + l := logic.NewUsersApplyItemsLogic(ctx, s.svcCtx) + return l.UsersApplyItems(in) +} + // 管理人列表 func (s *WaterServer) Users(ctx context.Context, in *water.UsersRequest) (*water.Response, error) { l := logic.NewUsersLogic(ctx, s.svcCtx) diff --git a/services/water/waterClient/water.go b/services/water/waterClient/water.go index 2010501..0e03bc6 100644 --- a/services/water/waterClient/water.go +++ b/services/water/waterClient/water.go @@ -51,6 +51,7 @@ type ( ApplyStatus(ctx context.Context, in *ApplyStatusRequest, opts ...grpc.CallOption) (*Response, error) // 转移管理人 ChangeAdmin(ctx context.Context, in *ChangeAdminRequest, opts ...grpc.CallOption) (*Response, error) + UsersApplyItems(ctx context.Context, in *UsersRequest, opts ...grpc.CallOption) (*Response, error) // 管理人列表 Users(ctx context.Context, in *UsersRequest, opts ...grpc.CallOption) (*Response, error) } @@ -138,6 +139,11 @@ func (m *defaultWater) ChangeAdmin(ctx context.Context, in *ChangeAdminRequest, return client.ChangeAdmin(ctx, in, opts...) } +func (m *defaultWater) UsersApplyItems(ctx context.Context, in *UsersRequest, opts ...grpc.CallOption) (*Response, error) { + client := water.NewWaterClient(m.cli.Conn()) + return client.UsersApplyItems(ctx, in, opts...) +} + // 管理人列表 func (m *defaultWater) Users(ctx context.Context, in *UsersRequest, opts ...grpc.CallOption) (*Response, error) { client := water.NewWaterClient(m.cli.Conn()) From 7d74f01eaa83db0a451c0bb4bbffd8f8ead6acdb Mon Sep 17 00:00:00 2001 From: gjs Date: Mon, 2 Nov 2026 16:51:31 +0800 Subject: [PATCH 3/3] fix apis --- services/water/internal/dao/users.go | 4 ++++ services/water/internal/logic/applyStatusLogic.go | 7 ++++--- services/water/internal/logic/applyUserLogic.go | 3 ++- services/water/internal/logic/getWarningLogic.go | 3 ++- services/water/internal/logic/warningStatusLogic.go | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/services/water/internal/dao/users.go b/services/water/internal/dao/users.go index e8dd10a..6bc1683 100644 --- a/services/water/internal/dao/users.go +++ b/services/water/internal/dao/users.go @@ -20,3 +20,7 @@ type UsersInfo struct { UpdateTime utils.CustomTime `json:"update_time" gorm:"update_time"` CarteTime utils.CustomTime `json:"carte_time" gorm:"carte_time"` } + +type UsersStatus struct { + Status int32 `gorm:"column:status;type:tinyint(1);not null;default:3" json:"status"` // 状态:1为正常,2为禁用,3为申请 +} diff --git a/services/water/internal/logic/applyStatusLogic.go b/services/water/internal/logic/applyStatusLogic.go index d37b877..1281c4b 100644 --- a/services/water/internal/logic/applyStatusLogic.go +++ b/services/water/internal/logic/applyStatusLogic.go @@ -7,6 +7,7 @@ import ( "lone-services/services/water/internal/dao" "lone-services/services/water/model" "lone-services/services/water/validator" + "strconv" "lone-services/rpc/water/pb" "lone-services/services/water/internal/svc" @@ -40,7 +41,7 @@ func (l *ApplyStatusLogic) ApplyStatus(in *water.ApplyStatusRequest) (*water.Res return l.fail(utils.ErrorNoLoginInfo) } - w := modelbase.Params{Eq: map[string]string{"id": string(in.Id)}} + w := modelbase.Params{Eq: map[string]string{"id": strconv.FormatInt(in.Id, utils.NumberTen)}} var info dao.UsersInfo err := model.UsersModel{}.Init().GetOne(w, &info) @@ -51,9 +52,9 @@ func (l *ApplyStatusLogic) ApplyStatus(in *water.ApplyStatusRequest) (*water.Res return l.fail(utils.ErrorNotFund) } - info.Status = in.Status + up := dao.UsersStatus{Status: in.Status} - _, err = model.UsersModel{}.Init().Edit(w, &info) + _, err = model.UsersModel{}.Init().Edit(w, &up) if err != nil { return l.fail(utils.Fail) } diff --git a/services/water/internal/logic/applyUserLogic.go b/services/water/internal/logic/applyUserLogic.go index 6238373..5fd9ba4 100644 --- a/services/water/internal/logic/applyUserLogic.go +++ b/services/water/internal/logic/applyUserLogic.go @@ -7,6 +7,7 @@ import ( "lone-services/services/water/internal/dao" "lone-services/services/water/model" "lone-services/services/water/validator" + "strconv" "lone-services/rpc/water/pb" "lone-services/services/water/internal/svc" @@ -40,7 +41,7 @@ func (l *ApplyUserLogic) ApplyUser(in *water.ApplyUserRequest) (*water.Response, return l.fail(utils.ErrorNoLoginInfo) } - w := modelbase.Params{Eq: map[string]string{"user_id": string(in.UserId), "status": utils.StringStatusOk}} + w := modelbase.Params{Eq: map[string]string{"user_id": strconv.FormatInt(in.UserId, utils.NumberTen), "status": utils.StringStatusOk}} var info dao.UsersCreate err := model.UsersModel{}.Init().GetOne(w, &info) diff --git a/services/water/internal/logic/getWarningLogic.go b/services/water/internal/logic/getWarningLogic.go index acb7610..28ffc73 100644 --- a/services/water/internal/logic/getWarningLogic.go +++ b/services/water/internal/logic/getWarningLogic.go @@ -6,6 +6,7 @@ import ( "lone-services/pkg/utils" "lone-services/services/water/internal/dao" "lone-services/services/water/model" + "strconv" "lone-services/rpc/water/pb" "lone-services/services/water/internal/svc" @@ -44,7 +45,7 @@ func (l *GetWarningLogic) GetWarning(in *water.GetWarningItemsRequest) (*water.R w.Eq["host_code"] = in.HostCode } if in.Type > utils.NumberZero { - w.Eq["type"] = string(in.Type) + w.Eq["type"] = strconv.Itoa(int(in.Type)) } var info []dao.WarningInfo diff --git a/services/water/internal/logic/warningStatusLogic.go b/services/water/internal/logic/warningStatusLogic.go index c3db53e..1ae131e 100644 --- a/services/water/internal/logic/warningStatusLogic.go +++ b/services/water/internal/logic/warningStatusLogic.go @@ -7,6 +7,7 @@ import ( "lone-services/services/water/internal/dao" "lone-services/services/water/model" "lone-services/services/water/validator" + "strconv" "lone-services/rpc/water/pb" "lone-services/services/water/internal/svc" @@ -40,7 +41,7 @@ func (l *WarningStatusLogic) WarningStatus(in *water.WarningStatusRequest) (*wat return l.fail(utils.ErrorNoLoginInfo) } - w := modelbase.Params{Eq: map[string]string{"id": string(in.Id)}} + w := modelbase.Params{Eq: map[string]string{"id": strconv.FormatInt(in.Id, utils.NumberTen)}} var info dao.WarningInfo err := model.WarningModel{}.Init().GetOne(w, &info)