diff --git a/deploy/apisix/lua/auth.lua b/deploy/apisix/lua/auth.lua index f188adc..01ab588 100644 --- a/deploy/apisix/lua/auth.lua +++ b/deploy/apisix/lua/auth.lua @@ -31,6 +31,10 @@ function _M.access(conf, ctx) ["/api/v2/analysis/switch"] = true, ["/api/v2/analysis/user/delete"] = true, ["/api/v2/analysis/store/info"] = true, + + ["/api/v3/chore/answer/items"] = true, + ["/api/v3/chore/system/info"] = true, + ["/api/v3/chore/system/items"] = true, } local user_key = core.request.header(ctx, "authorization") diff --git a/rpc/chore/chore.pb b/rpc/chore/chore.pb index ed1299f..df9ea19 100644 Binary files a/rpc/chore/chore.pb and b/rpc/chore/chore.pb differ diff --git a/rpc/chore/chore.proto b/rpc/chore/chore.proto index 10b2493..eaa9378 100644 --- a/rpc/chore/chore.proto +++ b/rpc/chore/chore.proto @@ -41,6 +41,40 @@ service Chore { body: "*" }; } + rpc ApiSystemItems(ApiSystemReq) returns (Response) { + option (google.api.http) = { + get: "/api/v3/chore/system/items" + body: "*" + }; + } + + rpc ApiSystemInfo(ApiSystemReq) returns (Response) { + option (google.api.http) = { + get: "/api/v3/chore/system/info" + body: "*" + }; + } + + rpc ApiAnswerItems(EmptyReq) returns (Response) { + option (google.api.http) = { + get: "/api/v3/chore/answer/items" + body: "*" + }; + } + rpc ApiAnswerIProgress(EmptyReq) returns (Response) { + option (google.api.http) = { + get: "/api/v3/chore/answer/progress" + body: "*" + }; + } + rpc ApiAnswerSave(EmptyReq) returns (Response) { + option (google.api.http) = { + post: "/api/v3/chore/answer/save" + body: "*" + }; + } + + /********************* 管理员接口 *********************/ rpc AnswerItems(EmptyReq) returns (Response) { option (google.api.http) = { get: "/admin/v3/chore/answer/items" @@ -126,6 +160,10 @@ message SystemEditReq { string content = 2; } +message ApiSystemReq { + int32 type = 1; +} + message DocumentReq { int32 type = 1; } diff --git a/rpc/chore/pb/chore.pb.go b/rpc/chore/pb/chore.pb.go index 15fd68d..5353afc 100644 --- a/rpc/chore/pb/chore.pb.go +++ b/rpc/chore/pb/chore.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc v3.19.4 +// protoc v4.25.8 // source: chore/chore.proto package chore @@ -350,6 +350,50 @@ func (x *SystemEditReq) GetContent() string { return "" } +type ApiSystemReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiSystemReq) Reset() { + *x = ApiSystemReq{} + mi := &file_chore_chore_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiSystemReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiSystemReq) ProtoMessage() {} + +func (x *ApiSystemReq) ProtoReflect() protoreflect.Message { + mi := &file_chore_chore_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiSystemReq.ProtoReflect.Descriptor instead. +func (*ApiSystemReq) Descriptor() ([]byte, []int) { + return file_chore_chore_proto_rawDescGZIP(), []int{6} +} + +func (x *ApiSystemReq) GetType() int32 { + if x != nil { + return x.Type + } + return 0 +} + type DocumentReq struct { state protoimpl.MessageState `protogen:"open.v1"` Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` @@ -359,7 +403,7 @@ type DocumentReq struct { func (x *DocumentReq) Reset() { *x = DocumentReq{} - mi := &file_chore_chore_proto_msgTypes[6] + mi := &file_chore_chore_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -371,7 +415,7 @@ func (x *DocumentReq) String() string { func (*DocumentReq) ProtoMessage() {} func (x *DocumentReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[6] + mi := &file_chore_chore_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -384,7 +428,7 @@ func (x *DocumentReq) ProtoReflect() protoreflect.Message { // Deprecated: Use DocumentReq.ProtoReflect.Descriptor instead. func (*DocumentReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{6} + return file_chore_chore_proto_rawDescGZIP(), []int{7} } func (x *DocumentReq) GetType() int32 { @@ -403,7 +447,7 @@ type PolicyReq struct { func (x *PolicyReq) Reset() { *x = PolicyReq{} - mi := &file_chore_chore_proto_msgTypes[7] + mi := &file_chore_chore_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -415,7 +459,7 @@ func (x *PolicyReq) String() string { func (*PolicyReq) ProtoMessage() {} func (x *PolicyReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[7] + mi := &file_chore_chore_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -428,7 +472,7 @@ func (x *PolicyReq) ProtoReflect() protoreflect.Message { // Deprecated: Use PolicyReq.ProtoReflect.Descriptor instead. func (*PolicyReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{7} + return file_chore_chore_proto_rawDescGZIP(), []int{8} } func (x *PolicyReq) GetKey() string { @@ -448,7 +492,7 @@ type UploadReq struct { func (x *UploadReq) Reset() { *x = UploadReq{} - mi := &file_chore_chore_proto_msgTypes[8] + mi := &file_chore_chore_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -460,7 +504,7 @@ func (x *UploadReq) String() string { func (*UploadReq) ProtoMessage() {} func (x *UploadReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[8] + mi := &file_chore_chore_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -473,7 +517,7 @@ func (x *UploadReq) ProtoReflect() protoreflect.Message { // Deprecated: Use UploadReq.ProtoReflect.Descriptor instead. func (*UploadReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{8} + return file_chore_chore_proto_rawDescGZIP(), []int{9} } func (x *UploadReq) GetFilename() string { @@ -500,7 +544,7 @@ type InternalUploadReq struct { func (x *InternalUploadReq) Reset() { *x = InternalUploadReq{} - mi := &file_chore_chore_proto_msgTypes[9] + mi := &file_chore_chore_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -512,7 +556,7 @@ func (x *InternalUploadReq) String() string { func (*InternalUploadReq) ProtoMessage() {} func (x *InternalUploadReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[9] + mi := &file_chore_chore_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -525,7 +569,7 @@ func (x *InternalUploadReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalUploadReq.ProtoReflect.Descriptor instead. func (*InternalUploadReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{9} + return file_chore_chore_proto_rawDescGZIP(), []int{10} } func (x *InternalUploadReq) GetFilename() string { @@ -553,7 +597,7 @@ type InternalUploadData struct { func (x *InternalUploadData) Reset() { *x = InternalUploadData{} - mi := &file_chore_chore_proto_msgTypes[10] + mi := &file_chore_chore_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -565,7 +609,7 @@ func (x *InternalUploadData) String() string { func (*InternalUploadData) ProtoMessage() {} func (x *InternalUploadData) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[10] + mi := &file_chore_chore_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -578,7 +622,7 @@ func (x *InternalUploadData) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalUploadData.ProtoReflect.Descriptor instead. func (*InternalUploadData) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{10} + return file_chore_chore_proto_rawDescGZIP(), []int{11} } func (x *InternalUploadData) GetUrl() string { @@ -614,7 +658,7 @@ type TestReq struct { func (x *TestReq) Reset() { *x = TestReq{} - mi := &file_chore_chore_proto_msgTypes[11] + mi := &file_chore_chore_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -626,7 +670,7 @@ func (x *TestReq) String() string { func (*TestReq) ProtoMessage() {} func (x *TestReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[11] + mi := &file_chore_chore_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -639,7 +683,7 @@ func (x *TestReq) ProtoReflect() protoreflect.Message { // Deprecated: Use TestReq.ProtoReflect.Descriptor instead. func (*TestReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{11} + return file_chore_chore_proto_rawDescGZIP(), []int{12} } func (x *TestReq) GetId() int32 { @@ -679,7 +723,7 @@ type DecryptMobileReq struct { func (x *DecryptMobileReq) Reset() { *x = DecryptMobileReq{} - mi := &file_chore_chore_proto_msgTypes[12] + mi := &file_chore_chore_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -691,7 +735,7 @@ func (x *DecryptMobileReq) String() string { func (*DecryptMobileReq) ProtoMessage() {} func (x *DecryptMobileReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[12] + mi := &file_chore_chore_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -704,7 +748,7 @@ func (x *DecryptMobileReq) ProtoReflect() protoreflect.Message { // Deprecated: Use DecryptMobileReq.ProtoReflect.Descriptor instead. func (*DecryptMobileReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{12} + return file_chore_chore_proto_rawDescGZIP(), []int{13} } func (x *DecryptMobileReq) GetOriginMobile() string { @@ -723,7 +767,7 @@ type RegionsReq struct { func (x *RegionsReq) Reset() { *x = RegionsReq{} - mi := &file_chore_chore_proto_msgTypes[13] + mi := &file_chore_chore_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -735,7 +779,7 @@ func (x *RegionsReq) String() string { func (*RegionsReq) ProtoMessage() {} func (x *RegionsReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[13] + mi := &file_chore_chore_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -748,7 +792,7 @@ func (x *RegionsReq) ProtoReflect() protoreflect.Message { // Deprecated: Use RegionsReq.ProtoReflect.Descriptor instead. func (*RegionsReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{13} + return file_chore_chore_proto_rawDescGZIP(), []int{14} } func (x *RegionsReq) GetParentId() int32 { @@ -767,7 +811,7 @@ type RegionsByIdsReq struct { func (x *RegionsByIdsReq) Reset() { *x = RegionsByIdsReq{} - mi := &file_chore_chore_proto_msgTypes[14] + mi := &file_chore_chore_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -779,7 +823,7 @@ func (x *RegionsByIdsReq) String() string { func (*RegionsByIdsReq) ProtoMessage() {} func (x *RegionsByIdsReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[14] + mi := &file_chore_chore_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -792,7 +836,7 @@ func (x *RegionsByIdsReq) ProtoReflect() protoreflect.Message { // Deprecated: Use RegionsByIdsReq.ProtoReflect.Descriptor instead. func (*RegionsByIdsReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{14} + return file_chore_chore_proto_rawDescGZIP(), []int{15} } func (x *RegionsByIdsReq) GetIds() []int64 { @@ -812,7 +856,7 @@ type RegionItem struct { func (x *RegionItem) Reset() { *x = RegionItem{} - mi := &file_chore_chore_proto_msgTypes[15] + mi := &file_chore_chore_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -824,7 +868,7 @@ func (x *RegionItem) String() string { func (*RegionItem) ProtoMessage() {} func (x *RegionItem) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[15] + mi := &file_chore_chore_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -837,7 +881,7 @@ func (x *RegionItem) ProtoReflect() protoreflect.Message { // Deprecated: Use RegionItem.ProtoReflect.Descriptor instead. func (*RegionItem) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{15} + return file_chore_chore_proto_rawDescGZIP(), []int{16} } func (x *RegionItem) GetId() int64 { @@ -863,7 +907,7 @@ type RegionsByIdsData struct { func (x *RegionsByIdsData) Reset() { *x = RegionsByIdsData{} - mi := &file_chore_chore_proto_msgTypes[16] + mi := &file_chore_chore_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -875,7 +919,7 @@ func (x *RegionsByIdsData) String() string { func (*RegionsByIdsData) ProtoMessage() {} func (x *RegionsByIdsData) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[16] + mi := &file_chore_chore_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -888,7 +932,7 @@ func (x *RegionsByIdsData) ProtoReflect() protoreflect.Message { // Deprecated: Use RegionsByIdsData.ProtoReflect.Descriptor instead. func (*RegionsByIdsData) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{16} + return file_chore_chore_proto_rawDescGZIP(), []int{17} } func (x *RegionsByIdsData) GetItems() []*RegionItem { @@ -908,7 +952,7 @@ type SendSmsReq struct { func (x *SendSmsReq) Reset() { *x = SendSmsReq{} - mi := &file_chore_chore_proto_msgTypes[17] + mi := &file_chore_chore_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -920,7 +964,7 @@ func (x *SendSmsReq) String() string { func (*SendSmsReq) ProtoMessage() {} func (x *SendSmsReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[17] + mi := &file_chore_chore_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -933,7 +977,7 @@ func (x *SendSmsReq) ProtoReflect() protoreflect.Message { // Deprecated: Use SendSmsReq.ProtoReflect.Descriptor instead. func (*SendSmsReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{17} + return file_chore_chore_proto_rawDescGZIP(), []int{18} } func (x *SendSmsReq) GetMobile() string { @@ -963,7 +1007,7 @@ type InternalActionApplyLogCreateReq struct { func (x *InternalActionApplyLogCreateReq) Reset() { *x = InternalActionApplyLogCreateReq{} - mi := &file_chore_chore_proto_msgTypes[18] + mi := &file_chore_chore_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -975,7 +1019,7 @@ func (x *InternalActionApplyLogCreateReq) String() string { func (*InternalActionApplyLogCreateReq) ProtoMessage() {} func (x *InternalActionApplyLogCreateReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[18] + mi := &file_chore_chore_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -988,7 +1032,7 @@ func (x *InternalActionApplyLogCreateReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalActionApplyLogCreateReq.ProtoReflect.Descriptor instead. func (*InternalActionApplyLogCreateReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{18} + return file_chore_chore_proto_rawDescGZIP(), []int{19} } func (x *InternalActionApplyLogCreateReq) GetAdminId() int64 { @@ -1035,7 +1079,7 @@ type InternalActionApplyLogCreateData struct { func (x *InternalActionApplyLogCreateData) Reset() { *x = InternalActionApplyLogCreateData{} - mi := &file_chore_chore_proto_msgTypes[19] + mi := &file_chore_chore_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1047,7 +1091,7 @@ func (x *InternalActionApplyLogCreateData) String() string { func (*InternalActionApplyLogCreateData) ProtoMessage() {} func (x *InternalActionApplyLogCreateData) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[19] + mi := &file_chore_chore_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1060,7 +1104,7 @@ func (x *InternalActionApplyLogCreateData) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalActionApplyLogCreateData.ProtoReflect.Descriptor instead. func (*InternalActionApplyLogCreateData) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{19} + return file_chore_chore_proto_rawDescGZIP(), []int{20} } func (x *InternalActionApplyLogCreateData) GetId() int64 { @@ -1083,7 +1127,7 @@ type SendPasswordReq struct { func (x *SendPasswordReq) Reset() { *x = SendPasswordReq{} - mi := &file_chore_chore_proto_msgTypes[20] + mi := &file_chore_chore_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1095,7 +1139,7 @@ func (x *SendPasswordReq) String() string { func (*SendPasswordReq) ProtoMessage() {} func (x *SendPasswordReq) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[20] + mi := &file_chore_chore_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1108,7 +1152,7 @@ func (x *SendPasswordReq) ProtoReflect() protoreflect.Message { // Deprecated: Use SendPasswordReq.ProtoReflect.Descriptor instead. func (*SendPasswordReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{20} + return file_chore_chore_proto_rawDescGZIP(), []int{21} } func (x *SendPasswordReq) GetMobile() string { @@ -1155,7 +1199,7 @@ type SendPasswordResp struct { func (x *SendPasswordResp) Reset() { *x = SendPasswordResp{} - mi := &file_chore_chore_proto_msgTypes[21] + mi := &file_chore_chore_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1167,7 +1211,7 @@ func (x *SendPasswordResp) String() string { func (*SendPasswordResp) ProtoMessage() {} func (x *SendPasswordResp) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[21] + mi := &file_chore_chore_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1180,7 +1224,7 @@ func (x *SendPasswordResp) ProtoReflect() protoreflect.Message { // Deprecated: Use SendPasswordResp.ProtoReflect.Descriptor instead. func (*SendPasswordResp) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{21} + return file_chore_chore_proto_rawDescGZIP(), []int{22} } func (x *SendPasswordResp) GetCode() int32 { @@ -1215,7 +1259,9 @@ const file_chore_chore_proto_rawDesc = "" + "\aanswers\x18\x05 \x01(\tR\aanswers\"=\n" + "\rSystemEditReq\x12\x12\n" + "\x04type\x18\x01 \x01(\x05R\x04type\x12\x18\n" + - "\acontent\x18\x02 \x01(\tR\acontent\"!\n" + + "\acontent\x18\x02 \x01(\tR\acontent\"\"\n" + + "\fApiSystemReq\x12\x12\n" + + "\x04type\x18\x01 \x01(\x05R\x04type\"!\n" + "\vDocumentReq\x12\x12\n" + "\x04type\x18\x01 \x01(\x05R\x04type\"\x1d\n" + "\tPolicyReq\x12\x10\n" + @@ -1267,14 +1313,19 @@ const file_chore_chore_proto_rawDesc = "" + "\x02ip\x18\x04 \x01(\tR\x02ip\x12!\n" + "\fbrowser_name\x18\x05 \x01(\tR\vbrowserName\"&\n" + "\x10SendPasswordResp\x12\x12\n" + - "\x04code\x18\x01 \x01(\x05R\x04code2\xba\f\n" + + "\x04code\x18\x01 \x01(\x05R\x04code2\x8c\x10\n" + "\x05Chore\x12P\n" + "\x06Policy\x12\x10.chore.PolicyReq\x1a\x0f.chore.Response\"#\x82\xd3\xe4\x93\x02\x1d:\x01*\x12\x18/api/v3/chore/oss/policy\x12P\n" + "\x06Upload\x12\x10.chore.UploadReq\x1a\x0f.chore.Response\"#\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/api/v3/chore/oss/upload\x12F\n" + "\x04Test\x12\x0e.chore.TestReq\x1a\x0f.chore.Response\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/api/v3/chore/test\x12_\n" + "\rDecryptMobile\x12\x17.chore.DecryptMobileReq\x1a\x0f.chore.Response\"$\x82\xd3\xe4\x93\x02\x1e\x12\x1c/api/v3/chore/decrypt/mobile\x12L\n" + "\aRegions\x12\x11.chore.RegionsReq\x1a\x0f.chore.Response\"\x1d\x82\xd3\xe4\x93\x02\x17\x12\x15/api/v3/chore/regions\x12P\n" + - "\aSendSms\x12\x11.chore.SendSmsReq\x1a\x0f.chore.Response\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/api/v3/chore/sms/send\x12U\n" + + "\aSendSms\x12\x11.chore.SendSmsReq\x1a\x0f.chore.Response\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/api/v3/chore/sms/send\x12]\n" + + "\x0eApiSystemItems\x12\x13.chore.ApiSystemReq\x1a\x0f.chore.Response\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\x12\x1a/api/v3/chore/system/items\x12[\n" + + "\rApiSystemInfo\x12\x13.chore.ApiSystemReq\x1a\x0f.chore.Response\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\x12\x19/api/v3/chore/system/info\x12Y\n" + + "\x0eApiAnswerItems\x12\x0f.chore.EmptyReq\x1a\x0f.chore.Response\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\x12\x1a/api/v3/chore/answer/items\x12`\n" + + "\x12ApiAnswerIProgress\x12\x0f.chore.EmptyReq\x1a\x0f.chore.Response\"(\x82\xd3\xe4\x93\x02\":\x01*\x12\x1d/api/v3/chore/answer/progress\x12W\n" + + "\rApiAnswerSave\x12\x0f.chore.EmptyReq\x1a\x0f.chore.Response\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/api/v3/chore/answer/save\x12U\n" + "\vAnswerItems\x12\x0f.chore.EmptyReq\x1a\x0f.chore.Response\"$\x82\xd3\xe4\x93\x02\x1e\x12\x1c/admin/v3/chore/answer/items\x12X\n" + "\fAnswerStatus\x12\x10.chore.StatusReq\x1a\x0f.chore.Response\"%\x82\xd3\xe4\x93\x02\x1f\"\x1d/admin/v3/chore/answer/status\x12P\n" + "\n" + @@ -1305,7 +1356,7 @@ func file_chore_chore_proto_rawDescGZIP() []byte { return file_chore_chore_proto_rawDescData } -var file_chore_chore_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_chore_chore_proto_msgTypes = make([]protoimpl.MessageInfo, 23) var file_chore_chore_proto_goTypes = []any{ (*Response)(nil), // 0: chore.Response (*EmptyReq)(nil), // 1: chore.EmptyReq @@ -1313,65 +1364,76 @@ var file_chore_chore_proto_goTypes = []any{ (*StatusReq)(nil), // 3: chore.StatusReq (*EditReq)(nil), // 4: chore.EditReq (*SystemEditReq)(nil), // 5: chore.SystemEditReq - (*DocumentReq)(nil), // 6: chore.DocumentReq - (*PolicyReq)(nil), // 7: chore.PolicyReq - (*UploadReq)(nil), // 8: chore.UploadReq - (*InternalUploadReq)(nil), // 9: chore.InternalUploadReq - (*InternalUploadData)(nil), // 10: chore.InternalUploadData - (*TestReq)(nil), // 11: chore.TestReq - (*DecryptMobileReq)(nil), // 12: chore.DecryptMobileReq - (*RegionsReq)(nil), // 13: chore.RegionsReq - (*RegionsByIdsReq)(nil), // 14: chore.RegionsByIdsReq - (*RegionItem)(nil), // 15: chore.RegionItem - (*RegionsByIdsData)(nil), // 16: chore.RegionsByIdsData - (*SendSmsReq)(nil), // 17: chore.SendSmsReq - (*InternalActionApplyLogCreateReq)(nil), // 18: chore.InternalActionApplyLogCreateReq - (*InternalActionApplyLogCreateData)(nil), // 19: chore.InternalActionApplyLogCreateData - (*SendPasswordReq)(nil), // 20: chore.SendPasswordReq - (*SendPasswordResp)(nil), // 21: chore.SendPasswordResp + (*ApiSystemReq)(nil), // 6: chore.ApiSystemReq + (*DocumentReq)(nil), // 7: chore.DocumentReq + (*PolicyReq)(nil), // 8: chore.PolicyReq + (*UploadReq)(nil), // 9: chore.UploadReq + (*InternalUploadReq)(nil), // 10: chore.InternalUploadReq + (*InternalUploadData)(nil), // 11: chore.InternalUploadData + (*TestReq)(nil), // 12: chore.TestReq + (*DecryptMobileReq)(nil), // 13: chore.DecryptMobileReq + (*RegionsReq)(nil), // 14: chore.RegionsReq + (*RegionsByIdsReq)(nil), // 15: chore.RegionsByIdsReq + (*RegionItem)(nil), // 16: chore.RegionItem + (*RegionsByIdsData)(nil), // 17: chore.RegionsByIdsData + (*SendSmsReq)(nil), // 18: chore.SendSmsReq + (*InternalActionApplyLogCreateReq)(nil), // 19: chore.InternalActionApplyLogCreateReq + (*InternalActionApplyLogCreateData)(nil), // 20: chore.InternalActionApplyLogCreateData + (*SendPasswordReq)(nil), // 21: chore.SendPasswordReq + (*SendPasswordResp)(nil), // 22: chore.SendPasswordResp } var file_chore_chore_proto_depIdxs = []int32{ - 15, // 0: chore.RegionsByIdsData.items:type_name -> chore.RegionItem - 7, // 1: chore.Chore.Policy:input_type -> chore.PolicyReq - 8, // 2: chore.Chore.Upload:input_type -> chore.UploadReq - 11, // 3: chore.Chore.Test:input_type -> chore.TestReq - 12, // 4: chore.Chore.DecryptMobile:input_type -> chore.DecryptMobileReq - 13, // 5: chore.Chore.Regions:input_type -> chore.RegionsReq - 17, // 6: chore.Chore.SendSms:input_type -> chore.SendSmsReq - 1, // 7: chore.Chore.AnswerItems:input_type -> chore.EmptyReq - 3, // 8: chore.Chore.AnswerStatus:input_type -> chore.StatusReq - 2, // 9: chore.Chore.AnswerInfo:input_type -> chore.IdReq - 4, // 10: chore.Chore.AnswerCreate:input_type -> chore.EditReq - 4, // 11: chore.Chore.AnswerEdit:input_type -> chore.EditReq - 5, // 12: chore.Chore.SystemEdit:input_type -> chore.SystemEditReq - 3, // 13: chore.Chore.SystemStatus:input_type -> chore.StatusReq - 2, // 14: chore.Chore.SystemInfo:input_type -> chore.IdReq - 1, // 15: chore.Chore.SystemItems:input_type -> chore.EmptyReq - 9, // 16: chore.Chore.InternalUpload:input_type -> chore.InternalUploadReq - 14, // 17: chore.Chore.RegionsByIds:input_type -> chore.RegionsByIdsReq - 18, // 18: chore.Chore.InternalActionApplyLogCreate:input_type -> chore.InternalActionApplyLogCreateReq - 20, // 19: chore.Chore.SendPassword:input_type -> chore.SendPasswordReq - 0, // 20: chore.Chore.Policy:output_type -> chore.Response - 0, // 21: chore.Chore.Upload:output_type -> chore.Response - 0, // 22: chore.Chore.Test:output_type -> chore.Response - 0, // 23: chore.Chore.DecryptMobile:output_type -> chore.Response - 0, // 24: chore.Chore.Regions:output_type -> chore.Response - 0, // 25: chore.Chore.SendSms:output_type -> chore.Response - 0, // 26: chore.Chore.AnswerItems:output_type -> chore.Response - 0, // 27: chore.Chore.AnswerStatus:output_type -> chore.Response - 0, // 28: chore.Chore.AnswerInfo:output_type -> chore.Response - 0, // 29: chore.Chore.AnswerCreate:output_type -> chore.Response - 0, // 30: chore.Chore.AnswerEdit:output_type -> chore.Response - 0, // 31: chore.Chore.SystemEdit:output_type -> chore.Response - 0, // 32: chore.Chore.SystemStatus:output_type -> chore.Response - 0, // 33: chore.Chore.SystemInfo:output_type -> chore.Response - 0, // 34: chore.Chore.SystemItems:output_type -> chore.Response - 10, // 35: chore.Chore.InternalUpload:output_type -> chore.InternalUploadData - 16, // 36: chore.Chore.RegionsByIds:output_type -> chore.RegionsByIdsData - 19, // 37: chore.Chore.InternalActionApplyLogCreate:output_type -> chore.InternalActionApplyLogCreateData - 21, // 38: chore.Chore.SendPassword:output_type -> chore.SendPasswordResp - 20, // [20:39] is the sub-list for method output_type - 1, // [1:20] is the sub-list for method input_type + 16, // 0: chore.RegionsByIdsData.items:type_name -> chore.RegionItem + 8, // 1: chore.Chore.Policy:input_type -> chore.PolicyReq + 9, // 2: chore.Chore.Upload:input_type -> chore.UploadReq + 12, // 3: chore.Chore.Test:input_type -> chore.TestReq + 13, // 4: chore.Chore.DecryptMobile:input_type -> chore.DecryptMobileReq + 14, // 5: chore.Chore.Regions:input_type -> chore.RegionsReq + 18, // 6: chore.Chore.SendSms:input_type -> chore.SendSmsReq + 6, // 7: chore.Chore.ApiSystemItems:input_type -> chore.ApiSystemReq + 6, // 8: chore.Chore.ApiSystemInfo:input_type -> chore.ApiSystemReq + 1, // 9: chore.Chore.ApiAnswerItems:input_type -> chore.EmptyReq + 1, // 10: chore.Chore.ApiAnswerIProgress:input_type -> chore.EmptyReq + 1, // 11: chore.Chore.ApiAnswerSave:input_type -> chore.EmptyReq + 1, // 12: chore.Chore.AnswerItems:input_type -> chore.EmptyReq + 3, // 13: chore.Chore.AnswerStatus:input_type -> chore.StatusReq + 2, // 14: chore.Chore.AnswerInfo:input_type -> chore.IdReq + 4, // 15: chore.Chore.AnswerCreate:input_type -> chore.EditReq + 4, // 16: chore.Chore.AnswerEdit:input_type -> chore.EditReq + 5, // 17: chore.Chore.SystemEdit:input_type -> chore.SystemEditReq + 3, // 18: chore.Chore.SystemStatus:input_type -> chore.StatusReq + 2, // 19: chore.Chore.SystemInfo:input_type -> chore.IdReq + 1, // 20: chore.Chore.SystemItems:input_type -> chore.EmptyReq + 10, // 21: chore.Chore.InternalUpload:input_type -> chore.InternalUploadReq + 15, // 22: chore.Chore.RegionsByIds:input_type -> chore.RegionsByIdsReq + 19, // 23: chore.Chore.InternalActionApplyLogCreate:input_type -> chore.InternalActionApplyLogCreateReq + 21, // 24: chore.Chore.SendPassword:input_type -> chore.SendPasswordReq + 0, // 25: chore.Chore.Policy:output_type -> chore.Response + 0, // 26: chore.Chore.Upload:output_type -> chore.Response + 0, // 27: chore.Chore.Test:output_type -> chore.Response + 0, // 28: chore.Chore.DecryptMobile:output_type -> chore.Response + 0, // 29: chore.Chore.Regions:output_type -> chore.Response + 0, // 30: chore.Chore.SendSms:output_type -> chore.Response + 0, // 31: chore.Chore.ApiSystemItems:output_type -> chore.Response + 0, // 32: chore.Chore.ApiSystemInfo:output_type -> chore.Response + 0, // 33: chore.Chore.ApiAnswerItems:output_type -> chore.Response + 0, // 34: chore.Chore.ApiAnswerIProgress:output_type -> chore.Response + 0, // 35: chore.Chore.ApiAnswerSave:output_type -> chore.Response + 0, // 36: chore.Chore.AnswerItems:output_type -> chore.Response + 0, // 37: chore.Chore.AnswerStatus:output_type -> chore.Response + 0, // 38: chore.Chore.AnswerInfo:output_type -> chore.Response + 0, // 39: chore.Chore.AnswerCreate:output_type -> chore.Response + 0, // 40: chore.Chore.AnswerEdit:output_type -> chore.Response + 0, // 41: chore.Chore.SystemEdit:output_type -> chore.Response + 0, // 42: chore.Chore.SystemStatus:output_type -> chore.Response + 0, // 43: chore.Chore.SystemInfo:output_type -> chore.Response + 0, // 44: chore.Chore.SystemItems:output_type -> chore.Response + 11, // 45: chore.Chore.InternalUpload:output_type -> chore.InternalUploadData + 17, // 46: chore.Chore.RegionsByIds:output_type -> chore.RegionsByIdsData + 20, // 47: chore.Chore.InternalActionApplyLogCreate:output_type -> chore.InternalActionApplyLogCreateData + 22, // 48: chore.Chore.SendPassword:output_type -> chore.SendPasswordResp + 25, // [25:49] is the sub-list for method output_type + 1, // [1:25] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name @@ -1388,7 +1450,7 @@ func file_chore_chore_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_chore_chore_proto_rawDesc), len(file_chore_chore_proto_rawDesc)), NumEnums: 0, - NumMessages: 22, + NumMessages: 23, NumExtensions: 0, NumServices: 1, }, diff --git a/rpc/chore/pb/chore_grpc.pb.go b/rpc/chore/pb/chore_grpc.pb.go index 00f194a..d6d04ee 100644 --- a/rpc/chore/pb/chore_grpc.pb.go +++ b/rpc/chore/pb/chore_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 v3.19.4 +// - protoc v4.25.8 // source: chore/chore.proto package chore @@ -25,6 +25,11 @@ const ( Chore_DecryptMobile_FullMethodName = "/chore.Chore/DecryptMobile" Chore_Regions_FullMethodName = "/chore.Chore/Regions" Chore_SendSms_FullMethodName = "/chore.Chore/SendSms" + Chore_ApiSystemItems_FullMethodName = "/chore.Chore/ApiSystemItems" + Chore_ApiSystemInfo_FullMethodName = "/chore.Chore/ApiSystemInfo" + Chore_ApiAnswerItems_FullMethodName = "/chore.Chore/ApiAnswerItems" + Chore_ApiAnswerIProgress_FullMethodName = "/chore.Chore/ApiAnswerIProgress" + Chore_ApiAnswerSave_FullMethodName = "/chore.Chore/ApiAnswerSave" Chore_AnswerItems_FullMethodName = "/chore.Chore/AnswerItems" Chore_AnswerStatus_FullMethodName = "/chore.Chore/AnswerStatus" Chore_AnswerInfo_FullMethodName = "/chore.Chore/AnswerInfo" @@ -50,6 +55,12 @@ type ChoreClient interface { DecryptMobile(ctx context.Context, in *DecryptMobileReq, opts ...grpc.CallOption) (*Response, error) Regions(ctx context.Context, in *RegionsReq, opts ...grpc.CallOption) (*Response, error) SendSms(ctx context.Context, in *SendSmsReq, opts ...grpc.CallOption) (*Response, error) + ApiSystemItems(ctx context.Context, in *ApiSystemReq, opts ...grpc.CallOption) (*Response, error) + ApiSystemInfo(ctx context.Context, in *ApiSystemReq, opts ...grpc.CallOption) (*Response, error) + ApiAnswerItems(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) + ApiAnswerIProgress(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) + ApiAnswerSave(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) + // ******************** 管理员接口 ******************** AnswerItems(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) AnswerStatus(ctx context.Context, in *StatusReq, opts ...grpc.CallOption) (*Response, error) AnswerInfo(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*Response, error) @@ -133,6 +144,56 @@ func (c *choreClient) SendSms(ctx context.Context, in *SendSmsReq, opts ...grpc. return out, nil } +func (c *choreClient) ApiSystemItems(ctx context.Context, in *ApiSystemReq, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Chore_ApiSystemItems_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *choreClient) ApiSystemInfo(ctx context.Context, in *ApiSystemReq, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Chore_ApiSystemInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *choreClient) ApiAnswerItems(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Chore_ApiAnswerItems_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *choreClient) ApiAnswerIProgress(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Chore_ApiAnswerIProgress_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *choreClient) ApiAnswerSave(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, Chore_ApiAnswerSave_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *choreClient) AnswerItems(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Response) @@ -273,6 +334,12 @@ type ChoreServer interface { DecryptMobile(context.Context, *DecryptMobileReq) (*Response, error) Regions(context.Context, *RegionsReq) (*Response, error) SendSms(context.Context, *SendSmsReq) (*Response, error) + ApiSystemItems(context.Context, *ApiSystemReq) (*Response, error) + ApiSystemInfo(context.Context, *ApiSystemReq) (*Response, error) + ApiAnswerItems(context.Context, *EmptyReq) (*Response, error) + ApiAnswerIProgress(context.Context, *EmptyReq) (*Response, error) + ApiAnswerSave(context.Context, *EmptyReq) (*Response, error) + // ******************** 管理员接口 ******************** AnswerItems(context.Context, *EmptyReq) (*Response, error) AnswerStatus(context.Context, *StatusReq) (*Response, error) AnswerInfo(context.Context, *IdReq) (*Response, error) @@ -314,6 +381,21 @@ func (UnimplementedChoreServer) Regions(context.Context, *RegionsReq) (*Response func (UnimplementedChoreServer) SendSms(context.Context, *SendSmsReq) (*Response, error) { return nil, status.Error(codes.Unimplemented, "method SendSms not implemented") } +func (UnimplementedChoreServer) ApiSystemItems(context.Context, *ApiSystemReq) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method ApiSystemItems not implemented") +} +func (UnimplementedChoreServer) ApiSystemInfo(context.Context, *ApiSystemReq) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method ApiSystemInfo not implemented") +} +func (UnimplementedChoreServer) ApiAnswerItems(context.Context, *EmptyReq) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method ApiAnswerItems not implemented") +} +func (UnimplementedChoreServer) ApiAnswerIProgress(context.Context, *EmptyReq) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method ApiAnswerIProgress not implemented") +} +func (UnimplementedChoreServer) ApiAnswerSave(context.Context, *EmptyReq) (*Response, error) { + return nil, status.Error(codes.Unimplemented, "method ApiAnswerSave not implemented") +} func (UnimplementedChoreServer) AnswerItems(context.Context, *EmptyReq) (*Response, error) { return nil, status.Error(codes.Unimplemented, "method AnswerItems not implemented") } @@ -482,6 +564,96 @@ func _Chore_SendSms_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +func _Chore_ApiSystemItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApiSystemReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChoreServer).ApiSystemItems(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Chore_ApiSystemItems_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChoreServer).ApiSystemItems(ctx, req.(*ApiSystemReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Chore_ApiSystemInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApiSystemReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChoreServer).ApiSystemInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Chore_ApiSystemInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChoreServer).ApiSystemInfo(ctx, req.(*ApiSystemReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Chore_ApiAnswerItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EmptyReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChoreServer).ApiAnswerItems(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Chore_ApiAnswerItems_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChoreServer).ApiAnswerItems(ctx, req.(*EmptyReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Chore_ApiAnswerIProgress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EmptyReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChoreServer).ApiAnswerIProgress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Chore_ApiAnswerIProgress_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChoreServer).ApiAnswerIProgress(ctx, req.(*EmptyReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Chore_ApiAnswerSave_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EmptyReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChoreServer).ApiAnswerSave(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Chore_ApiAnswerSave_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChoreServer).ApiAnswerSave(ctx, req.(*EmptyReq)) + } + return interceptor(ctx, in, info, handler) +} + func _Chore_AnswerItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(EmptyReq) if err := dec(in); err != nil { @@ -747,6 +919,26 @@ var Chore_ServiceDesc = grpc.ServiceDesc{ MethodName: "SendSms", Handler: _Chore_SendSms_Handler, }, + { + MethodName: "ApiSystemItems", + Handler: _Chore_ApiSystemItems_Handler, + }, + { + MethodName: "ApiSystemInfo", + Handler: _Chore_ApiSystemInfo_Handler, + }, + { + MethodName: "ApiAnswerItems", + Handler: _Chore_ApiAnswerItems_Handler, + }, + { + MethodName: "ApiAnswerIProgress", + Handler: _Chore_ApiAnswerIProgress_Handler, + }, + { + MethodName: "ApiAnswerSave", + Handler: _Chore_ApiAnswerSave_Handler, + }, { MethodName: "AnswerItems", Handler: _Chore_AnswerItems_Handler, diff --git a/services/chore/choreclient/chore.go b/services/chore/choreclient/chore.go index 6bd75fe..f06c3d3 100644 --- a/services/chore/choreclient/chore.go +++ b/services/chore/choreclient/chore.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 +// goctl 1.10.2 // Source: chore.proto package choreClient @@ -14,6 +14,7 @@ import ( ) type ( + ApiSystemReq = chore.ApiSystemReq DecryptMobileReq = chore.DecryptMobileReq DocumentReq = chore.DocumentReq EditReq = chore.EditReq @@ -44,6 +45,12 @@ type ( DecryptMobile(ctx context.Context, in *DecryptMobileReq, opts ...grpc.CallOption) (*Response, error) Regions(ctx context.Context, in *RegionsReq, opts ...grpc.CallOption) (*Response, error) SendSms(ctx context.Context, in *SendSmsReq, opts ...grpc.CallOption) (*Response, error) + ApiSystemItems(ctx context.Context, in *ApiSystemReq, opts ...grpc.CallOption) (*Response, error) + ApiSystemInfo(ctx context.Context, in *ApiSystemReq, opts ...grpc.CallOption) (*Response, error) + ApiAnswerItems(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) + ApiAnswerIProgress(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) + ApiAnswerSave(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) + // 管理员接口 AnswerItems(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) AnswerStatus(ctx context.Context, in *StatusReq, opts ...grpc.CallOption) (*Response, error) AnswerInfo(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*Response, error) @@ -100,6 +107,32 @@ func (m *defaultChore) SendSms(ctx context.Context, in *SendSmsReq, opts ...grpc return client.SendSms(ctx, in, opts...) } +func (m *defaultChore) ApiSystemItems(ctx context.Context, in *ApiSystemReq, opts ...grpc.CallOption) (*Response, error) { + client := chore.NewChoreClient(m.cli.Conn()) + return client.ApiSystemItems(ctx, in, opts...) +} + +func (m *defaultChore) ApiSystemInfo(ctx context.Context, in *ApiSystemReq, opts ...grpc.CallOption) (*Response, error) { + client := chore.NewChoreClient(m.cli.Conn()) + return client.ApiSystemInfo(ctx, in, opts...) +} + +func (m *defaultChore) ApiAnswerItems(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) { + client := chore.NewChoreClient(m.cli.Conn()) + return client.ApiAnswerItems(ctx, in, opts...) +} + +func (m *defaultChore) ApiAnswerIProgress(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) { + client := chore.NewChoreClient(m.cli.Conn()) + return client.ApiAnswerIProgress(ctx, in, opts...) +} + +func (m *defaultChore) ApiAnswerSave(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) { + client := chore.NewChoreClient(m.cli.Conn()) + return client.ApiAnswerSave(ctx, in, opts...) +} + +// 管理员接口 func (m *defaultChore) AnswerItems(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) { client := chore.NewChoreClient(m.cli.Conn()) return client.AnswerItems(ctx, in, opts...) diff --git a/services/chore/internal/dao/answerUser.go b/services/chore/internal/dao/answerUser.go new file mode 100644 index 0000000..1d669e2 --- /dev/null +++ b/services/chore/internal/dao/answerUser.go @@ -0,0 +1,6 @@ +package dao + +type UserAnswer struct { + Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Answer uint8 `gorm:"column:answer;type:tinyint(1);default:2;comment:答题状态,1为答完, 2为未答" json:"answer"` +} diff --git a/services/chore/internal/dao/system.go b/services/chore/internal/dao/system.go index 435f1ec..60269db 100644 --- a/services/chore/internal/dao/system.go +++ b/services/chore/internal/dao/system.go @@ -16,3 +16,8 @@ type SystemStatus struct { AdminId int64 `gorm:"column:admin_id;type:int(11)" json:"admin_id"` AdminName string `gorm:"column:admin_name;type:varchar(255)" json:"admin_name"` } + +type ApiSystemInfo struct { + Type int32 `gorm:"column:type;type:tinyint(1);default:0;NOT NULL" json:"type"` + Content string `gorm:"column:content;type:text;default:'';NOT NULL" json:"content"` +} diff --git a/services/chore/internal/logic/apiAnswerIProgressLogic.go b/services/chore/internal/logic/apiAnswerIProgressLogic.go new file mode 100644 index 0000000..4f1c4ac --- /dev/null +++ b/services/chore/internal/logic/apiAnswerIProgressLogic.go @@ -0,0 +1,46 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/rpc/chore/pb" + "lone-services/services/chore/internal/dao" + "lone-services/services/chore/internal/model" + "lone-services/services/chore/internal/svc" + "strconv" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ApiAnswerIProgressLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewApiAnswerIProgressLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiAnswerIProgressLogic { + return &ApiAnswerIProgressLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ApiAnswerIProgressLogic) ApiAnswerIProgress(in *chore.EmptyReq) (*chore.Response, error) { + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var info dao.UserAnswer + w := modelbase.Params{Eq: map[string]string{"id": strconv.FormatInt(adminInfo.ID, utils.NumberTen)}} + + err := model.AnswerUserModel{}.Init().GetOne(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + + return l.ok(info) +} diff --git a/services/chore/internal/logic/apiAnswerItemsLogic.go b/services/chore/internal/logic/apiAnswerItemsLogic.go new file mode 100644 index 0000000..523185a --- /dev/null +++ b/services/chore/internal/logic/apiAnswerItemsLogic.go @@ -0,0 +1,46 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/chore/internal/dao" + "lone-services/services/chore/internal/model" + + "lone-services/rpc/chore/pb" + "lone-services/services/chore/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ApiAnswerItemsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewApiAnswerItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiAnswerItemsLogic { + return &ApiAnswerItemsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ApiAnswerItemsLogic) ApiAnswerItems(in *chore.EmptyReq) (*chore.Response, error) { + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var info []dao.AnswerInfo + w := modelbase.Params{Eq: map[string]string{"status": utils.StringStatusOk}} + + err := model.AnswerModel{}.Init().Items(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + + return l.ok(info) +} diff --git a/services/chore/internal/logic/apiAnswerSaveLogic.go b/services/chore/internal/logic/apiAnswerSaveLogic.go new file mode 100644 index 0000000..58b09af --- /dev/null +++ b/services/chore/internal/logic/apiAnswerSaveLogic.go @@ -0,0 +1,56 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/chore/internal/dao" + "lone-services/services/chore/internal/model" + "strconv" + + "lone-services/rpc/chore/pb" + "lone-services/services/chore/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ApiAnswerSaveLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewApiAnswerSaveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiAnswerSaveLogic { + return &ApiAnswerSaveLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ApiAnswerSaveLogic) ApiAnswerSave(in *chore.EmptyReq) (*chore.Response, error) { + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + var info dao.UserAnswer + w := modelbase.Params{Eq: map[string]string{"user_id": strconv.FormatInt(adminInfo.ID, utils.NumberTen)}} + + err := model.AnswerUserModel{}.Init().GetOne(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + if info.Id < utils.NumberOne { + return l.fail(utils.SetError(utils.ErrorNotFund, "用户不存在")) + } + + info.Answer = utils.StatusOk + _, err = model.AnswerUserModel{}.Init().Edit(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + return l.ok(info.Id) +} diff --git a/services/chore/internal/logic/apiSystemInfoLogic.go b/services/chore/internal/logic/apiSystemInfoLogic.go new file mode 100644 index 0000000..be0b982 --- /dev/null +++ b/services/chore/internal/logic/apiSystemInfoLogic.go @@ -0,0 +1,47 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/chore/internal/dao" + "lone-services/services/chore/internal/model" + "lone-services/services/chore/validator" + "strconv" + + "lone-services/rpc/chore/pb" + "lone-services/services/chore/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ApiSystemInfoLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewApiSystemInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiSystemInfoLogic { + return &ApiSystemInfoLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ApiSystemInfoLogic) ApiSystemInfo(in *chore.ApiSystemReq) (*chore.Response, error) { + var v validator.ApiSystemInfoValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } + + var info []dao.ApiSystemInfo + w := modelbase.Params{Eq: map[string]string{"type": strconv.Itoa(int(in.Type))}} + err := model.SystemModel{}.Init().GetOne(w, &info) + if err != nil { + return l.fail(utils.ErrorNotFund) + } + + return l.ok(info) +} diff --git a/services/chore/internal/logic/apiSystemItemsLogic.go b/services/chore/internal/logic/apiSystemItemsLogic.go new file mode 100644 index 0000000..7213dbe --- /dev/null +++ b/services/chore/internal/logic/apiSystemItemsLogic.go @@ -0,0 +1,45 @@ +package logic + +import ( + "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/chore/internal/dao" + "lone-services/services/chore/internal/model" + "strconv" + + "lone-services/rpc/chore/pb" + "lone-services/services/chore/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ApiSystemItemsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger + BaseLogic +} + +func NewApiSystemItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiSystemItemsLogic { + return &ApiSystemItemsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ApiSystemItemsLogic) ApiSystemItems(in *chore.ApiSystemReq) (*chore.Response, error) { + var info []dao.ApiSystemInfo + w := modelbase.Params{} + if in.Type > utils.NumberZero { + w.Eq = make(map[string]string) + w.Eq["type"] = strconv.Itoa(int(in.Type)) + } + err := model.SystemModel{}.Init().Items(w, &info) + if err != nil { + return l.fail(utils.ErrorNotFund) + } + + return l.ok(info) +} diff --git a/services/chore/internal/model/answerUser.go b/services/chore/internal/model/answerUser.go new file mode 100644 index 0000000..ad05c45 --- /dev/null +++ b/services/chore/internal/model/answerUser.go @@ -0,0 +1,18 @@ +package model + +import ( + "lone-services/pkg/modelbase" +) + +type AnswerUserModel struct { + modelbase.Base +} + +func (m AnswerUserModel) TableName() string { + return modelbase.Prefix() + "answer_user" +} + +func (m AnswerUserModel) Init() AnswerUserModel { + m.Table = m.TableName() + return m +} diff --git a/services/chore/internal/server/choreServer.go b/services/chore/internal/server/choreServer.go index 53b3775..c8661eb 100644 --- a/services/chore/internal/server/choreServer.go +++ b/services/chore/internal/server/choreServer.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 +// goctl 1.10.2 // Source: chore.proto package server @@ -53,6 +53,32 @@ func (s *ChoreServer) SendSms(ctx context.Context, in *chore.SendSmsReq) (*chore return l.SendSms(in) } +func (s *ChoreServer) ApiSystemItems(ctx context.Context, in *chore.ApiSystemReq) (*chore.Response, error) { + l := logic.NewApiSystemItemsLogic(ctx, s.svcCtx) + return l.ApiSystemItems(in) +} + +func (s *ChoreServer) ApiSystemInfo(ctx context.Context, in *chore.ApiSystemReq) (*chore.Response, error) { + l := logic.NewApiSystemInfoLogic(ctx, s.svcCtx) + return l.ApiSystemInfo(in) +} + +func (s *ChoreServer) ApiAnswerItems(ctx context.Context, in *chore.EmptyReq) (*chore.Response, error) { + l := logic.NewApiAnswerItemsLogic(ctx, s.svcCtx) + return l.ApiAnswerItems(in) +} + +func (s *ChoreServer) ApiAnswerIProgress(ctx context.Context, in *chore.EmptyReq) (*chore.Response, error) { + l := logic.NewApiAnswerIProgressLogic(ctx, s.svcCtx) + return l.ApiAnswerIProgress(in) +} + +func (s *ChoreServer) ApiAnswerSave(ctx context.Context, in *chore.EmptyReq) (*chore.Response, error) { + l := logic.NewApiAnswerSaveLogic(ctx, s.svcCtx) + return l.ApiAnswerSave(in) +} + +// 管理员接口 func (s *ChoreServer) AnswerItems(ctx context.Context, in *chore.EmptyReq) (*chore.Response, error) { l := logic.NewAnswerItemsLogic(ctx, s.svcCtx) return l.AnswerItems(in) diff --git a/services/chore/validator/system.go b/services/chore/validator/system.go index 38d027f..51032e3 100644 --- a/services/chore/validator/system.go +++ b/services/chore/validator/system.go @@ -13,3 +13,13 @@ func (p SystemEditValidator) GetMessage() validate.ValidatorMessages { "Content.required": "Content 必传", } } + +type ApiSystemInfoValidator struct { + Type int32 `form:"type" json:"type" validate:"required"` +} + +func (p ApiSystemInfoValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + "Type.required": "Type 必传", + } +}