From 278713765cc5c254eae0bc221f326ac3b6824ae5 Mon Sep 17 00:00:00 2001 From: gjs Date: Tue, 20 Oct 2026 20:02:25 +0800 Subject: [PATCH 1/6] add apis --- rpc/chore/chore.pb | Bin 16940 -> 17056 bytes rpc/chore/pb/chore.pb.go | 282 +++++++----------- rpc/chore/pb/chore_grpc.pb.go | 2 - rpc/equipment/equipment.pb | Bin 19761 -> 19449 bytes rpc/equipment/equipment.proto | 5 +- rpc/equipment/pb/equipment.pb.go | 38 ++- rpc/equipment/pb/equipment_grpc.pb.go | 2 +- services/chore/choreclient/chore.go | 2 - services/chore/internal/server/choreServer.go | 1 - .../equipment/equipmentclient/equipment.go | 2 +- services/equipment/internal/dao/mask.go | 8 + .../equipment/internal/dao/maskUsageRecord.go | 18 ++ .../internal/logic/apiBindItemsLogic.go | 18 +- .../internal/logic/apiMaskAddLogic.go | 52 +++- .../logic/apiMaskStoreUseItemsLogic.go | 40 ++- .../internal/logic/apiMaskStoreUseLogic.go | 115 ++++++- .../internal/logic/apiMaskUseLogic.go | 126 +++++++- .../internal/logic/apiMaskUsedItemsLogic.go | 39 ++- .../internal/model/maskUsageRecord.go | 23 ++ .../internal/server/equipmentServer.go | 2 +- .../equipment/internal/svc/grpcService.go | 50 ++++ .../equipment/internal/svc/servicecontext.go | 89 +++++- 22 files changed, 704 insertions(+), 210 deletions(-) create mode 100644 services/equipment/internal/dao/maskUsageRecord.go create mode 100644 services/equipment/internal/model/maskUsageRecord.go create mode 100644 services/equipment/internal/svc/grpcService.go diff --git a/rpc/chore/chore.pb b/rpc/chore/chore.pb index df9ea1974c218e41a7ba607525d1055cd0a75a24..9e3955e152bb0c6c35d0feeeb409692cafcc9e4c 100644 GIT binary patch delta 129 zcmZ3}!nmN7al>O{rrolepBjrZ2?=uX`xh4nXQt;RmXsEy2Bj7*{%y*__;&Ii%e5-; zTs+8;PGFFs%Rp delta 33 pcmZ3`%DAS5al>O{rsFc3pBjrZZRR)o&&=2}ncr&dW?AcIb^zpk42%E( diff --git a/rpc/chore/pb/chore.pb.go b/rpc/chore/pb/chore.pb.go index ecb76f3..315dadd 100644 --- a/rpc/chore/pb/chore.pb.go +++ b/rpc/chore/pb/chore.pb.go @@ -490,7 +490,7 @@ type OssSignatureReq struct { func (x *OssSignatureReq) Reset() { *x = OssSignatureReq{} - mi := &file_chore_chore_proto_msgTypes[8] + mi := &file_chore_chore_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -502,7 +502,7 @@ func (x *OssSignatureReq) String() string { func (*OssSignatureReq) ProtoMessage() {} func (x *OssSignatureReq) 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 { @@ -515,7 +515,7 @@ func (x *OssSignatureReq) ProtoReflect() protoreflect.Message { // Deprecated: Use OssSignatureReq.ProtoReflect.Descriptor instead. func (*OssSignatureReq) Descriptor() ([]byte, []int) { - return file_chore_chore_proto_rawDescGZIP(), []int{8} + return file_chore_chore_proto_rawDescGZIP(), []int{9} } type UploadReq struct { @@ -528,7 +528,7 @@ type UploadReq struct { func (x *UploadReq) Reset() { *x = UploadReq{} - mi := &file_chore_chore_proto_msgTypes[9] + mi := &file_chore_chore_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -540,7 +540,7 @@ func (x *UploadReq) String() string { func (*UploadReq) ProtoMessage() {} func (x *UploadReq) 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 { @@ -553,7 +553,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{9} + return file_chore_chore_proto_rawDescGZIP(), []int{10} } func (x *UploadReq) GetFilename() string { @@ -580,7 +580,7 @@ type InternalUploadReq struct { func (x *InternalUploadReq) Reset() { *x = InternalUploadReq{} - mi := &file_chore_chore_proto_msgTypes[10] + mi := &file_chore_chore_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -592,7 +592,7 @@ func (x *InternalUploadReq) String() string { func (*InternalUploadReq) ProtoMessage() {} func (x *InternalUploadReq) 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 { @@ -605,7 +605,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{10} + return file_chore_chore_proto_rawDescGZIP(), []int{11} } func (x *InternalUploadReq) GetFilename() string { @@ -633,7 +633,7 @@ type InternalUploadData struct { func (x *InternalUploadData) Reset() { *x = InternalUploadData{} - mi := &file_chore_chore_proto_msgTypes[11] + mi := &file_chore_chore_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -645,7 +645,7 @@ func (x *InternalUploadData) String() string { func (*InternalUploadData) ProtoMessage() {} func (x *InternalUploadData) 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 { @@ -658,7 +658,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{11} + return file_chore_chore_proto_rawDescGZIP(), []int{12} } func (x *InternalUploadData) GetUrl() string { @@ -694,7 +694,7 @@ type TestReq struct { func (x *TestReq) Reset() { *x = TestReq{} - mi := &file_chore_chore_proto_msgTypes[12] + mi := &file_chore_chore_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -706,7 +706,7 @@ func (x *TestReq) String() string { func (*TestReq) ProtoMessage() {} func (x *TestReq) 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 { @@ -719,7 +719,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{12} + return file_chore_chore_proto_rawDescGZIP(), []int{13} } func (x *TestReq) GetId() int32 { @@ -759,7 +759,7 @@ type DecryptMobileReq struct { func (x *DecryptMobileReq) Reset() { *x = DecryptMobileReq{} - mi := &file_chore_chore_proto_msgTypes[13] + mi := &file_chore_chore_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -771,7 +771,7 @@ func (x *DecryptMobileReq) String() string { func (*DecryptMobileReq) ProtoMessage() {} func (x *DecryptMobileReq) 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 { @@ -784,7 +784,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{13} + return file_chore_chore_proto_rawDescGZIP(), []int{14} } func (x *DecryptMobileReq) GetOriginMobile() string { @@ -803,7 +803,7 @@ type RegionsReq struct { func (x *RegionsReq) Reset() { *x = RegionsReq{} - mi := &file_chore_chore_proto_msgTypes[14] + mi := &file_chore_chore_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -815,7 +815,7 @@ func (x *RegionsReq) String() string { func (*RegionsReq) ProtoMessage() {} func (x *RegionsReq) 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 { @@ -828,7 +828,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{14} + return file_chore_chore_proto_rawDescGZIP(), []int{15} } func (x *RegionsReq) GetParentId() int32 { @@ -847,7 +847,7 @@ type RegionsByIdsReq struct { func (x *RegionsByIdsReq) Reset() { *x = RegionsByIdsReq{} - mi := &file_chore_chore_proto_msgTypes[15] + mi := &file_chore_chore_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -859,7 +859,7 @@ func (x *RegionsByIdsReq) String() string { func (*RegionsByIdsReq) ProtoMessage() {} func (x *RegionsByIdsReq) 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 { @@ -872,7 +872,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{15} + return file_chore_chore_proto_rawDescGZIP(), []int{16} } func (x *RegionsByIdsReq) GetIds() []int64 { @@ -892,7 +892,7 @@ type RegionItem struct { func (x *RegionItem) Reset() { *x = RegionItem{} - mi := &file_chore_chore_proto_msgTypes[16] + mi := &file_chore_chore_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -904,7 +904,7 @@ func (x *RegionItem) String() string { func (*RegionItem) ProtoMessage() {} func (x *RegionItem) 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 { @@ -917,7 +917,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{16} + return file_chore_chore_proto_rawDescGZIP(), []int{17} } func (x *RegionItem) GetId() int64 { @@ -943,7 +943,7 @@ type RegionsByIdsData struct { func (x *RegionsByIdsData) Reset() { *x = RegionsByIdsData{} - mi := &file_chore_chore_proto_msgTypes[17] + mi := &file_chore_chore_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -955,7 +955,7 @@ func (x *RegionsByIdsData) String() string { func (*RegionsByIdsData) ProtoMessage() {} func (x *RegionsByIdsData) 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 { @@ -968,7 +968,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{17} + return file_chore_chore_proto_rawDescGZIP(), []int{18} } func (x *RegionsByIdsData) GetItems() []*RegionItem { @@ -988,7 +988,7 @@ type SendSmsReq struct { func (x *SendSmsReq) Reset() { *x = SendSmsReq{} - mi := &file_chore_chore_proto_msgTypes[18] + mi := &file_chore_chore_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1000,7 +1000,7 @@ func (x *SendSmsReq) String() string { func (*SendSmsReq) ProtoMessage() {} func (x *SendSmsReq) 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 { @@ -1013,7 +1013,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{18} + return file_chore_chore_proto_rawDescGZIP(), []int{19} } func (x *SendSmsReq) GetMobile() string { @@ -1043,7 +1043,7 @@ type InternalActionApplyLogCreateReq struct { func (x *InternalActionApplyLogCreateReq) Reset() { *x = InternalActionApplyLogCreateReq{} - mi := &file_chore_chore_proto_msgTypes[19] + mi := &file_chore_chore_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1055,7 +1055,7 @@ func (x *InternalActionApplyLogCreateReq) String() string { func (*InternalActionApplyLogCreateReq) ProtoMessage() {} func (x *InternalActionApplyLogCreateReq) 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 { @@ -1068,7 +1068,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{19} + return file_chore_chore_proto_rawDescGZIP(), []int{20} } func (x *InternalActionApplyLogCreateReq) GetAdminId() int64 { @@ -1115,7 +1115,7 @@ type InternalActionApplyLogCreateData struct { func (x *InternalActionApplyLogCreateData) Reset() { *x = InternalActionApplyLogCreateData{} - mi := &file_chore_chore_proto_msgTypes[20] + mi := &file_chore_chore_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1127,7 +1127,7 @@ func (x *InternalActionApplyLogCreateData) String() string { func (*InternalActionApplyLogCreateData) ProtoMessage() {} func (x *InternalActionApplyLogCreateData) 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 { @@ -1140,7 +1140,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{20} + return file_chore_chore_proto_rawDescGZIP(), []int{21} } func (x *InternalActionApplyLogCreateData) GetId() int64 { @@ -1163,7 +1163,7 @@ type SendPasswordReq struct { func (x *SendPasswordReq) Reset() { *x = SendPasswordReq{} - mi := &file_chore_chore_proto_msgTypes[21] + mi := &file_chore_chore_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1175,7 +1175,7 @@ func (x *SendPasswordReq) String() string { func (*SendPasswordReq) ProtoMessage() {} func (x *SendPasswordReq) 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 { @@ -1188,7 +1188,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{21} + return file_chore_chore_proto_rawDescGZIP(), []int{22} } func (x *SendPasswordReq) GetMobile() string { @@ -1235,7 +1235,7 @@ type SendPasswordResp struct { func (x *SendPasswordResp) Reset() { *x = SendPasswordResp{} - mi := &file_chore_chore_proto_msgTypes[22] + mi := &file_chore_chore_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1247,7 +1247,7 @@ func (x *SendPasswordResp) String() string { func (*SendPasswordResp) ProtoMessage() {} func (x *SendPasswordResp) ProtoReflect() protoreflect.Message { - mi := &file_chore_chore_proto_msgTypes[22] + mi := &file_chore_chore_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1260,7 +1260,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{22} + return file_chore_chore_proto_rawDescGZIP(), []int{23} } func (x *SendPasswordResp) GetCode() int32 { @@ -1350,11 +1350,7 @@ 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" + -<<<<<<< HEAD - "\x04code\x18\x01 \x01(\x05R\x04code2\x8c\x10\n" + -======= - "\x04code\x18\x01 \x01(\x05R\x04code2\x9b\r\n" + ->>>>>>> 5a3d66df250ad0fd3567ed512701f43a521951c6 + "\x04code\x18\x01 \x01(\x05R\x04code2\xed\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\x12_\n" + @@ -1398,7 +1394,7 @@ func file_chore_chore_proto_rawDescGZIP() []byte { return file_chore_chore_proto_rawDescData } -var file_chore_chore_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_chore_chore_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_chore_chore_proto_goTypes = []any{ (*Response)(nil), // 0: chore.Response (*EmptyReq)(nil), // 1: chore.EmptyReq @@ -1406,127 +1402,79 @@ var file_chore_chore_proto_goTypes = []any{ (*StatusReq)(nil), // 3: chore.StatusReq (*EditReq)(nil), // 4: chore.EditReq (*SystemEditReq)(nil), // 5: chore.SystemEditReq -<<<<<<< HEAD (*ApiSystemReq)(nil), // 6: chore.ApiSystemReq (*DocumentReq)(nil), // 7: chore.DocumentReq (*PolicyReq)(nil), // 8: chore.PolicyReq -======= - (*DocumentReq)(nil), // 6: chore.DocumentReq - (*PolicyReq)(nil), // 7: chore.PolicyReq - (*OssSignatureReq)(nil), // 8: chore.OssSignatureReq ->>>>>>> 5a3d66df250ad0fd3567ed512701f43a521951c6 - (*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 + (*OssSignatureReq)(nil), // 9: chore.OssSignatureReq + (*UploadReq)(nil), // 10: chore.UploadReq + (*InternalUploadReq)(nil), // 11: chore.InternalUploadReq + (*InternalUploadData)(nil), // 12: chore.InternalUploadData + (*TestReq)(nil), // 13: chore.TestReq + (*DecryptMobileReq)(nil), // 14: chore.DecryptMobileReq + (*RegionsReq)(nil), // 15: chore.RegionsReq + (*RegionsByIdsReq)(nil), // 16: chore.RegionsByIdsReq + (*RegionItem)(nil), // 17: chore.RegionItem + (*RegionsByIdsData)(nil), // 18: chore.RegionsByIdsData + (*SendSmsReq)(nil), // 19: chore.SendSmsReq + (*InternalActionApplyLogCreateReq)(nil), // 20: chore.InternalActionApplyLogCreateReq + (*InternalActionApplyLogCreateData)(nil), // 21: chore.InternalActionApplyLogCreateData + (*SendPasswordReq)(nil), // 22: chore.SendPasswordReq + (*SendPasswordResp)(nil), // 23: chore.SendPasswordResp } var file_chore_chore_proto_depIdxs = []int32{ - 16, // 0: chore.RegionsByIdsData.items:type_name -> chore.RegionItem -<<<<<<< HEAD + 17, // 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 -======= - 7, // 1: chore.Chore.Policy:input_type -> chore.PolicyReq - 9, // 2: chore.Chore.Upload:input_type -> chore.UploadReq - 8, // 3: chore.Chore.OssSignature:input_type -> chore.OssSignatureReq - 12, // 4: chore.Chore.Test:input_type -> chore.TestReq - 13, // 5: chore.Chore.DecryptMobile:input_type -> chore.DecryptMobileReq - 14, // 6: chore.Chore.Regions:input_type -> chore.RegionsReq - 18, // 7: chore.Chore.SendSms:input_type -> chore.SendSmsReq - 1, // 8: chore.Chore.AnswerItems:input_type -> chore.EmptyReq - 3, // 9: chore.Chore.AnswerStatus:input_type -> chore.StatusReq - 2, // 10: chore.Chore.AnswerInfo:input_type -> chore.IdReq - 4, // 11: chore.Chore.AnswerCreate:input_type -> chore.EditReq - 4, // 12: chore.Chore.AnswerEdit:input_type -> chore.EditReq - 5, // 13: chore.Chore.SystemEdit:input_type -> chore.SystemEditReq - 3, // 14: chore.Chore.SystemStatus:input_type -> chore.StatusReq - 2, // 15: chore.Chore.SystemInfo:input_type -> chore.IdReq - 1, // 16: chore.Chore.SystemItems:input_type -> chore.EmptyReq - 10, // 17: chore.Chore.InternalUpload:input_type -> chore.InternalUploadReq - 15, // 18: chore.Chore.RegionsByIds:input_type -> chore.RegionsByIdsReq - 19, // 19: chore.Chore.InternalActionApplyLogCreate:input_type -> chore.InternalActionApplyLogCreateReq - 21, // 20: chore.Chore.SendPassword:input_type -> chore.SendPasswordReq - 0, // 21: chore.Chore.Policy:output_type -> chore.Response - 0, // 22: chore.Chore.Upload:output_type -> chore.Response - 0, // 23: chore.Chore.OssSignature:output_type -> chore.Response - 0, // 24: chore.Chore.Test:output_type -> chore.Response - 0, // 25: chore.Chore.DecryptMobile:output_type -> chore.Response - 0, // 26: chore.Chore.Regions:output_type -> chore.Response - 0, // 27: chore.Chore.SendSms:output_type -> chore.Response - 0, // 28: chore.Chore.AnswerItems:output_type -> chore.Response - 0, // 29: chore.Chore.AnswerStatus:output_type -> chore.Response - 0, // 30: chore.Chore.AnswerInfo:output_type -> chore.Response - 0, // 31: chore.Chore.AnswerCreate:output_type -> chore.Response - 0, // 32: chore.Chore.AnswerEdit:output_type -> chore.Response - 0, // 33: chore.Chore.SystemEdit:output_type -> chore.Response - 0, // 34: chore.Chore.SystemStatus:output_type -> chore.Response - 0, // 35: chore.Chore.SystemInfo:output_type -> chore.Response - 0, // 36: chore.Chore.SystemItems:output_type -> chore.Response - 11, // 37: chore.Chore.InternalUpload:output_type -> chore.InternalUploadData - 17, // 38: chore.Chore.RegionsByIds:output_type -> chore.RegionsByIdsData - 20, // 39: chore.Chore.InternalActionApplyLogCreate:output_type -> chore.InternalActionApplyLogCreateData - 22, // 40: chore.Chore.SendPassword:output_type -> chore.SendPasswordResp - 21, // [21:41] is the sub-list for method output_type - 1, // [1:21] is the sub-list for method input_type ->>>>>>> 5a3d66df250ad0fd3567ed512701f43a521951c6 + 10, // 2: chore.Chore.Upload:input_type -> chore.UploadReq + 9, // 3: chore.Chore.OssSignature:input_type -> chore.OssSignatureReq + 13, // 4: chore.Chore.Test:input_type -> chore.TestReq + 14, // 5: chore.Chore.DecryptMobile:input_type -> chore.DecryptMobileReq + 15, // 6: chore.Chore.Regions:input_type -> chore.RegionsReq + 19, // 7: chore.Chore.SendSms:input_type -> chore.SendSmsReq + 6, // 8: chore.Chore.ApiSystemItems:input_type -> chore.ApiSystemReq + 6, // 9: chore.Chore.ApiSystemInfo:input_type -> chore.ApiSystemReq + 1, // 10: chore.Chore.ApiAnswerItems:input_type -> chore.EmptyReq + 1, // 11: chore.Chore.ApiAnswerIProgress:input_type -> chore.EmptyReq + 1, // 12: chore.Chore.ApiAnswerSave:input_type -> chore.EmptyReq + 1, // 13: chore.Chore.AnswerItems:input_type -> chore.EmptyReq + 3, // 14: chore.Chore.AnswerStatus:input_type -> chore.StatusReq + 2, // 15: chore.Chore.AnswerInfo:input_type -> chore.IdReq + 4, // 16: chore.Chore.AnswerCreate:input_type -> chore.EditReq + 4, // 17: chore.Chore.AnswerEdit:input_type -> chore.EditReq + 5, // 18: chore.Chore.SystemEdit:input_type -> chore.SystemEditReq + 3, // 19: chore.Chore.SystemStatus:input_type -> chore.StatusReq + 2, // 20: chore.Chore.SystemInfo:input_type -> chore.IdReq + 1, // 21: chore.Chore.SystemItems:input_type -> chore.EmptyReq + 11, // 22: chore.Chore.InternalUpload:input_type -> chore.InternalUploadReq + 16, // 23: chore.Chore.RegionsByIds:input_type -> chore.RegionsByIdsReq + 20, // 24: chore.Chore.InternalActionApplyLogCreate:input_type -> chore.InternalActionApplyLogCreateReq + 22, // 25: chore.Chore.SendPassword:input_type -> chore.SendPasswordReq + 0, // 26: chore.Chore.Policy:output_type -> chore.Response + 0, // 27: chore.Chore.Upload:output_type -> chore.Response + 0, // 28: chore.Chore.OssSignature:output_type -> chore.Response + 0, // 29: chore.Chore.Test:output_type -> chore.Response + 0, // 30: chore.Chore.DecryptMobile:output_type -> chore.Response + 0, // 31: chore.Chore.Regions:output_type -> chore.Response + 0, // 32: chore.Chore.SendSms:output_type -> chore.Response + 0, // 33: chore.Chore.ApiSystemItems:output_type -> chore.Response + 0, // 34: chore.Chore.ApiSystemInfo:output_type -> chore.Response + 0, // 35: chore.Chore.ApiAnswerItems:output_type -> chore.Response + 0, // 36: chore.Chore.ApiAnswerIProgress:output_type -> chore.Response + 0, // 37: chore.Chore.ApiAnswerSave:output_type -> chore.Response + 0, // 38: chore.Chore.AnswerItems:output_type -> chore.Response + 0, // 39: chore.Chore.AnswerStatus:output_type -> chore.Response + 0, // 40: chore.Chore.AnswerInfo:output_type -> chore.Response + 0, // 41: chore.Chore.AnswerCreate:output_type -> chore.Response + 0, // 42: chore.Chore.AnswerEdit:output_type -> chore.Response + 0, // 43: chore.Chore.SystemEdit:output_type -> chore.Response + 0, // 44: chore.Chore.SystemStatus:output_type -> chore.Response + 0, // 45: chore.Chore.SystemInfo:output_type -> chore.Response + 0, // 46: chore.Chore.SystemItems:output_type -> chore.Response + 12, // 47: chore.Chore.InternalUpload:output_type -> chore.InternalUploadData + 18, // 48: chore.Chore.RegionsByIds:output_type -> chore.RegionsByIdsData + 21, // 49: chore.Chore.InternalActionApplyLogCreate:output_type -> chore.InternalActionApplyLogCreateData + 23, // 50: chore.Chore.SendPassword:output_type -> chore.SendPasswordResp + 26, // [26:51] is the sub-list for method output_type + 1, // [1:26] 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 @@ -1543,7 +1491,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: 23, + NumMessages: 24, NumExtensions: 0, NumServices: 1, }, diff --git a/rpc/chore/pb/chore_grpc.pb.go b/rpc/chore/pb/chore_grpc.pb.go index c760382..229ceea 100644 --- a/rpc/chore/pb/chore_grpc.pb.go +++ b/rpc/chore/pb/chore_grpc.pb.go @@ -52,7 +52,6 @@ const ( type ChoreClient interface { Policy(ctx context.Context, in *PolicyReq, opts ...grpc.CallOption) (*Response, error) Upload(ctx context.Context, in *UploadReq, opts ...grpc.CallOption) (*Response, error) - // 微信小程序直传 OSS 所需的 PostObject V4 签名参数 OssSignature(ctx context.Context, in *OssSignatureReq, opts ...grpc.CallOption) (*Response, error) Test(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*Response, error) DecryptMobile(ctx context.Context, in *DecryptMobileReq, opts ...grpc.CallOption) (*Response, error) @@ -343,7 +342,6 @@ func (c *choreClient) SendPassword(ctx context.Context, in *SendPasswordReq, opt type ChoreServer interface { Policy(context.Context, *PolicyReq) (*Response, error) Upload(context.Context, *UploadReq) (*Response, error) - // 微信小程序直传 OSS 所需的 PostObject V4 签名参数 OssSignature(context.Context, *OssSignatureReq) (*Response, error) Test(context.Context, *TestReq) (*Response, error) DecryptMobile(context.Context, *DecryptMobileReq) (*Response, error) diff --git a/rpc/equipment/equipment.pb b/rpc/equipment/equipment.pb index 82a8a69c6b307b45d57f09a092ca52ff9d277463..79e8cbed199976309d9850665b34d89c7078aadd 100644 GIT binary patch delta 358 zcmdlui}B}l#tmzkm^uOMou9X{{UA%iRbJfB`+r5(a4_ct0~6{ z;bm!N0CfP>`1$*}g4F|chq(rMx<$fueAG;qS;QzJ#P8$k=N{q_9}wi~<{1Gt9%4v= zR@~$(TIvuZH~-Rl&dAQj@q%5T+i!E8E;kd?R;JC>`WlRAK9DrjWMP_Ou-U~_mXmJ= zGnb%aL8fnFakgVh%H$|Vz0EW2;u#sAZvJWS%&5p5#9myIUzF;ZA|%emURs=56rY(Q z!L7ik!5qW};%;_v>}F)Vy!nDt7YAeN-A delta 710 zcmex4opIwV#tmzkn4Tw1Ue9F0bc%8E6DGgzeuml5F`?xmYI_pj}VS8PA!Q~ttd&&E6&W%lhVba%MGZ*1#V7oYKbdM zxzY^Q%}&g!Doks+Cugchvu$Ez=6JzA`G~r~Sizh7+XlE`^I6gB)f>D7{gENQ=B(~YyHjR<-%;tG^&WwDl zLF~oAB$eu!qEyZ$KKY=h_-1*BJVwTooBJHQI2fZROL{p7NHtx4GMNb&bNYz|nfhhM Jn~S~L7y%~(^9}$2 diff --git a/rpc/equipment/equipment.proto b/rpc/equipment/equipment.proto index 426a85a..1381831 100644 --- a/rpc/equipment/equipment.proto +++ b/rpc/equipment/equipment.proto @@ -134,7 +134,7 @@ message ApiBeansAddRequest { int64 id = 2; } message ApiMaskAddRequest { - string face_mask_id = 1; + string facial_mask_id = 1; string produce_time = 2; int64 quality_guarantee_period= 3; int32 is_on_trial = 4; @@ -158,7 +158,8 @@ message ApiMaskUseRequest { string efficiency = 7; string resistance = 8; string score = 9; - int32 store_id = 10; + int64 store_id = 10; + int64 user_id = 11; } message ApiMaskUsedItemsRequest { string facial_mask_id = 1; diff --git a/rpc/equipment/pb/equipment.pb.go b/rpc/equipment/pb/equipment.pb.go index fb5983e..ccc6810 100644 --- a/rpc/equipment/pb/equipment.pb.go +++ b/rpc/equipment/pb/equipment.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: equipment/equipment.proto package equipment @@ -1300,7 +1300,7 @@ func (x *ApiBeansAddRequest) GetId() int64 { type ApiMaskAddRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - FaceMaskId string `protobuf:"bytes,1,opt,name=face_mask_id,json=faceMaskId,proto3" json:"face_mask_id,omitempty"` + FacialMaskId string `protobuf:"bytes,1,opt,name=facial_mask_id,json=facialMaskId,proto3" json:"facial_mask_id,omitempty"` ProduceTime string `protobuf:"bytes,2,opt,name=produce_time,json=produceTime,proto3" json:"produce_time,omitempty"` QualityGuaranteePeriod int64 `protobuf:"varint,3,opt,name=quality_guarantee_period,json=qualityGuaranteePeriod,proto3" json:"quality_guarantee_period,omitempty"` IsOnTrial int32 `protobuf:"varint,4,opt,name=is_on_trial,json=isOnTrial,proto3" json:"is_on_trial,omitempty"` @@ -1346,9 +1346,9 @@ func (*ApiMaskAddRequest) Descriptor() ([]byte, []int) { return file_equipment_equipment_proto_rawDescGZIP(), []int{19} } -func (x *ApiMaskAddRequest) GetFaceMaskId() string { +func (x *ApiMaskAddRequest) GetFacialMaskId() string { if x != nil { - return x.FaceMaskId + return x.FacialMaskId } return "" } @@ -1441,7 +1441,8 @@ type ApiMaskUseRequest struct { Efficiency string `protobuf:"bytes,7,opt,name=efficiency,proto3" json:"efficiency,omitempty"` Resistance string `protobuf:"bytes,8,opt,name=resistance,proto3" json:"resistance,omitempty"` Score string `protobuf:"bytes,9,opt,name=score,proto3" json:"score,omitempty"` - StoreId int32 `protobuf:"varint,10,opt,name=store_id,json=storeId,proto3" json:"store_id,omitempty"` + StoreId int64 `protobuf:"varint,10,opt,name=store_id,json=storeId,proto3" json:"store_id,omitempty"` + UserId int64 `protobuf:"varint,11,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1539,13 +1540,20 @@ func (x *ApiMaskUseRequest) GetScore() string { return "" } -func (x *ApiMaskUseRequest) GetStoreId() int32 { +func (x *ApiMaskUseRequest) GetStoreId() int64 { if x != nil { return x.StoreId } return 0 } +func (x *ApiMaskUseRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + type ApiMaskUsedItemsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` FacialMaskId string `protobuf:"bytes,1,opt,name=facial_mask_id,json=facialMaskId,proto3" json:"facial_mask_id,omitempty"` @@ -1922,10 +1930,9 @@ const file_equipment_equipment_proto_rawDesc = "" + "\x04size\x18\x02 \x01(\x05R\x04size\":\n" + "\x12ApiBeansAddRequest\x12\x14\n" + "\x05image\x18\x01 \x01(\tR\x05image\x12\x0e\n" + - "\x02id\x18\x02 \x01(\x03R\x02id\"\x94\x03\n" + - "\x11ApiMaskAddRequest\x12 \n" + - "\fface_mask_id\x18\x01 \x01(\tR\n" + - "faceMaskId\x12!\n" + + "\x02id\x18\x02 \x01(\x03R\x02id\"\x98\x03\n" + + "\x11ApiMaskAddRequest\x12$\n" + + "\x0efacial_mask_id\x18\x01 \x01(\tR\ffacialMaskId\x12!\n" + "\fproduce_time\x18\x02 \x01(\tR\vproduceTime\x128\n" + "\x18quality_guarantee_period\x18\x03 \x01(\x03R\x16qualityGuaranteePeriod\x12\x1e\n" + "\vis_on_trial\x18\x04 \x01(\x05R\tisOnTrial\x12\x14\n" + @@ -1937,7 +1944,7 @@ const file_equipment_equipment_proto_rawDesc = "" + "\fuse_scenario\x18\n" + " \x01(\x05R\vuseScenario\x12\x16\n" + "\x06effect\x18\v \x01(\x03R\x06effect\x12&\n" + - "\x0fworker_group_id\x18\f \x01(\x03R\rworkerGroupId\"\xcc\x02\n" + + "\x0fworker_group_id\x18\f \x01(\x03R\rworkerGroupId\"\xe5\x02\n" + "\x11ApiMaskUseRequest\x12$\n" + "\x0efacial_mask_id\x18\x01 \x01(\tR\ffacialMaskId\x12\x19\n" + "\buse_time\x18\x02 \x01(\tR\auseTime\x12\x1b\n" + @@ -1953,7 +1960,8 @@ const file_equipment_equipment_proto_rawDesc = "" + "resistance\x12\x14\n" + "\x05score\x18\t \x01(\tR\x05score\x12\x19\n" + "\bstore_id\x18\n" + - " \x01(\x05R\astoreId\"w\n" + + " \x01(\x03R\astoreId\x12\x17\n" + + "\auser_id\x18\v \x01(\x03R\x06userId\"w\n" + "\x17ApiMaskUsedItemsRequest\x12$\n" + "\x0efacial_mask_id\x18\x01 \x01(\tR\ffacialMaskId\x12\x19\n" + "\buse_time\x18\x02 \x01(\tR\auseTime\x12\x1b\n" + @@ -1970,7 +1978,7 @@ const file_equipment_equipment_proto_rawDesc = "" + "\x02id\x18\x01 \x01(\x03R\x02id\"A\n" + "\x11ApiVersionRequest\x12\x12\n" + "\x04type\x18\x01 \x01(\x05R\x04type\x12\x18\n" + - "\aversion\x18\x02 \x01(\tR\aversion2\xc9\x14\n" + + "\aversion\x18\x02 \x01(\tR\aversion2\xd3\x14\n" + "\tEquipment\x12Y\n" + "\x05Items\x12\x17.equipment.ItemsRequest\x1a\x13.equipment.Response\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\x12\x17/admin/v3/version/items\x12T\n" + "\x04Info\x12\x14.equipment.IdRequest\x1a\x13.equipment.Response\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\x12\x16/admin/v3/version/info\x12\\\n" + @@ -1998,9 +2006,9 @@ const file_equipment_equipment_proto_rawDesc = "" + "ApiMaskUse\x12\x1c.equipment.ApiMaskUseRequest\x1a\x13.equipment.Response\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/api/v3/mask/use\x12o\n" + "\x10ApiMaskUsedItems\x12\".equipment.ApiMaskUsedItemsRequest\x1a\x13.equipment.Response\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\"\x17/api/v3/mask/used/items\x12g\n" + "\x0fApiMaskStoreUse\x12\x1c.equipment.ApiMaskUseRequest\x1a\x13.equipment.Response\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/api/v3/mask/store/use\x12y\n" + - "\x14ApiMaskStoreUseItems\x12\".equipment.ApiMaskUsedItemsRequest\x1a\x13.equipment.Response\"(\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/api/v3/mask/store/used/items\x12[\n" + + "\x14ApiMaskStoreUseItems\x12\".equipment.ApiMaskUsedItemsRequest\x1a\x13.equipment.Response\"(\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/api/v3/mask/store/used/items\x12e\n" + "\n" + - "ApiVersion\x12\x1c.equipment.ApiVersionRequest\x1a\x13.equipment.Response\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\x12\x0f/api/v3/version\x12a\n" + + "ApiVersion\x12\x1c.equipment.ApiVersionRequest\x1a\x13.equipment.Response\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\x12\x19/api/v3/equipment/version\x12a\n" + "\vApiBindInfo\x12\x1d.equipment.ApiBindInfoRequest\x1a\x13.equipment.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/api/v3/device/info\x12g\n" + "\rApiBindUpdate\x12\x1f.equipment.ApiBindUpdateRequest\x1a\x13.equipment.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/api/v3/device/update\x12I\n" + "\x0fInternalBindAdd\x12!.equipment.InternalBindAddRequest\x1a\x13.equipment.Response\x12K\n" + diff --git a/rpc/equipment/pb/equipment_grpc.pb.go b/rpc/equipment/pb/equipment_grpc.pb.go index 5b14578..7f42583 100644 --- a/rpc/equipment/pb/equipment_grpc.pb.go +++ b/rpc/equipment/pb/equipment_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: equipment/equipment.proto package equipment diff --git a/services/chore/choreclient/chore.go b/services/chore/choreclient/chore.go index f240511..eaaa6a8 100644 --- a/services/chore/choreclient/chore.go +++ b/services/chore/choreclient/chore.go @@ -42,7 +42,6 @@ type ( Chore interface { Policy(ctx context.Context, in *PolicyReq, opts ...grpc.CallOption) (*Response, error) Upload(ctx context.Context, in *UploadReq, opts ...grpc.CallOption) (*Response, error) - // 微信小程序直传 OSS 所需的 PostObject V4 签名参数 OssSignature(ctx context.Context, in *OssSignatureReq, opts ...grpc.CallOption) (*Response, error) Test(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*Response, error) DecryptMobile(ctx context.Context, in *DecryptMobileReq, opts ...grpc.CallOption) (*Response, error) @@ -90,7 +89,6 @@ func (m *defaultChore) Upload(ctx context.Context, in *UploadReq, opts ...grpc.C return client.Upload(ctx, in, opts...) } -// 微信小程序直传 OSS 所需的 PostObject V4 签名参数 func (m *defaultChore) OssSignature(ctx context.Context, in *OssSignatureReq, opts ...grpc.CallOption) (*Response, error) { client := chore.NewChoreClient(m.cli.Conn()) return client.OssSignature(ctx, in, opts...) diff --git a/services/chore/internal/server/choreServer.go b/services/chore/internal/server/choreServer.go index ada2382..759e2cc 100644 --- a/services/chore/internal/server/choreServer.go +++ b/services/chore/internal/server/choreServer.go @@ -33,7 +33,6 @@ func (s *ChoreServer) Upload(ctx context.Context, in *chore.UploadReq) (*chore.R return l.Upload(in) } -// 微信小程序直传 OSS 所需的 PostObject V4 签名参数 func (s *ChoreServer) OssSignature(ctx context.Context, in *chore.OssSignatureReq) (*chore.Response, error) { l := logic.NewOssSignatureLogic(ctx, s.svcCtx) return l.OssSignature(in) diff --git a/services/equipment/equipmentclient/equipment.go b/services/equipment/equipmentclient/equipment.go index 4b83c29..e061ec2 100644 --- a/services/equipment/equipmentclient/equipment.go +++ b/services/equipment/equipmentclient/equipment.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 +// goctl 1.10.2 // Source: equipment.proto package equipmentClient diff --git a/services/equipment/internal/dao/mask.go b/services/equipment/internal/dao/mask.go index 195ac82..d6a1e94 100644 --- a/services/equipment/internal/dao/mask.go +++ b/services/equipment/internal/dao/mask.go @@ -98,3 +98,11 @@ type MaskUsedInfo struct { UseTime string `gorm:"column:use_time;type:varchar(64);comment:使用的时间;NOT NULL" json:"use_time"` SecondUseTime string `gorm:"column:second_use_time;type:varchar(64);comment:第二次使用的时间,与第一次不能超过半小时" json:"second_use_time"` } + +type UserInfo struct { + Id int64 ` json:"id"` +} + +type StoreInfo struct { + Id int64 ` json:"id"` +} diff --git a/services/equipment/internal/dao/maskUsageRecord.go b/services/equipment/internal/dao/maskUsageRecord.go new file mode 100644 index 0000000..7a3def4 --- /dev/null +++ b/services/equipment/internal/dao/maskUsageRecord.go @@ -0,0 +1,18 @@ +package dao + +import "lone-services/pkg/utils" + +type MaskUsageRecordInfo struct { + Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Userid int `gorm:"column:userid;type:int(11);comment:用户ID;NOT NULL" json:"userid"` + StoreId int `gorm:"column:store_id;type:int(11);comment:美容院ID;NOT NULL" json:"store_id"` + FacialMaskId string `gorm:"column:facial_mask_id;type:varchar(255);comment:面膜ID;NOT NULL" json:"facial_mask_id"` + CreatedAt utils.CustomTime `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP" json:"created_at"` +} + +type MaskUsageRecordCreate struct { + Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Userid int `gorm:"column:userid;type:int(11);comment:用户ID;NOT NULL" json:"userid"` + StoreId int `gorm:"column:store_id;type:int(11);comment:美容院ID;NOT NULL" json:"store_id"` + FacialMaskId string `gorm:"column:facial_mask_id;type:varchar(255);comment:面膜ID;NOT NULL" json:"facial_mask_id"` +} diff --git a/services/equipment/internal/logic/apiBindItemsLogic.go b/services/equipment/internal/logic/apiBindItemsLogic.go index e631c31..60d3255 100644 --- a/services/equipment/internal/logic/apiBindItemsLogic.go +++ b/services/equipment/internal/logic/apiBindItemsLogic.go @@ -2,7 +2,11 @@ package logic import ( "context" + "lone-services/pkg/modelbase" "lone-services/pkg/utils" + "lone-services/services/equipment/internal/dao" + "lone-services/services/equipment/internal/model" + "strconv" "lone-services/rpc/equipment/pb" "lone-services/services/equipment/internal/svc" @@ -30,6 +34,18 @@ func (l *ApiBindItemsLogic) ApiBindItems(in *equipment.EmptyRequest) (*equipment if adminInfo.ID < utils.NumberOne { return l.fail(utils.ErrorNoLoginInfo) } + w := modelbase.Params{ + Eq: map[string]string{ + "user_id": strconv.FormatInt(adminInfo.ID, utils.NumberTen), + "status": utils.StringStatusOk}, + Order: "id desc", + } + var info dao.BindInfo + err := model.BindModel{}.Init().Items(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } - return &equipment.Response{}, nil + return l.ok(info) } diff --git a/services/equipment/internal/logic/apiMaskAddLogic.go b/services/equipment/internal/logic/apiMaskAddLogic.go index 33eff7e..ff1415e 100644 --- a/services/equipment/internal/logic/apiMaskAddLogic.go +++ b/services/equipment/internal/logic/apiMaskAddLogic.go @@ -2,10 +2,13 @@ package logic import ( "context" + "lone-services/pkg/modelbase" "lone-services/pkg/utils" - equipment "lone-services/rpc/equipment/pb" + "lone-services/services/equipment/internal/dao" + "lone-services/services/equipment/internal/model" "lone-services/services/equipment/internal/svc" + "lone-services/services/equipment/validator" "github.com/zeromicro/go-zero/core/logx" ) @@ -25,12 +28,55 @@ func NewApiMaskAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiMas } } -// API +// ApiMaskAdd API func (l *ApiMaskAddLogic) ApiMaskAdd(in *equipment.ApiMaskAddRequest) (*equipment.Response, error) { + var v validator.MaskAddValidator + 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) } - return &equipment.Response{}, nil + var status dao.MaskStatus + w := modelbase.Params{Eq: map[string]string{"facial_mask_id": in.FacialMaskId}} + modelObj := model.MaskModel{}.Init() + err := modelObj.GetOne(w, &status) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + if status.Id > utils.NumberZero { + if status.Status == utils.StatusFail { + status.Status = utils.StatusOk + _, err = modelObj.Edit(w, &status) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.SetError(utils.Fail, "更新状态出错")) + } + } + return l.ok(status.Id) + } + data := dao.MaskCreate{ + FacialMaskId: in.FacialMaskId, + ProduceTime: in.ProduceTime, + QualityGuaranteePeriod: in.QualityGuaranteePeriod, + IsOnTrial: in.IsOnTrial, + IsOnline: in.IsOnline, + WorkerGroupId: adminInfo.ID, + ModelId: in.ModelId, + Model: in.Model, + IsStore: in.IsStore, + UseScenario: in.UseScenario, + Batch: in.Batch, + Effect: int32(in.Effect), + } + err = modelObj.Create(&data) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.SetError(utils.Fail, "添加出错")) + } + return l.ok(data.Id) } diff --git a/services/equipment/internal/logic/apiMaskStoreUseItemsLogic.go b/services/equipment/internal/logic/apiMaskStoreUseItemsLogic.go index a74a747..e731143 100644 --- a/services/equipment/internal/logic/apiMaskStoreUseItemsLogic.go +++ b/services/equipment/internal/logic/apiMaskStoreUseItemsLogic.go @@ -2,6 +2,12 @@ package logic import ( "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/equipment/internal/dao" + "lone-services/services/equipment/internal/model" + "lone-services/services/equipment/validator" + "strconv" "lone-services/rpc/equipment/pb" "lone-services/services/equipment/internal/svc" @@ -13,6 +19,7 @@ type ApiMaskStoreUseItemsLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger + BaseLogic } func NewApiMaskStoreUseItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiMaskStoreUseItemsLogic { @@ -24,7 +31,36 @@ func NewApiMaskStoreUseItemsLogic(ctx context.Context, svcCtx *svc.ServiceContex } func (l *ApiMaskStoreUseItemsLogic) ApiMaskStoreUseItems(in *equipment.ApiMaskUsedItemsRequest) (*equipment.Response, error) { - // todo: add your logic here and delete this line + var v validator.MaskUsedItemsValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } - return &equipment.Response{}, nil + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + + var info []dao.MaskUsedInfo + w := modelbase.Params{Eq: map[string]string{ + "is_use": strconv.Itoa(int(utils.StatusDone)), + "store_id": strconv.Itoa(int(adminInfo.ID)), + }, + Order: "id desc"} + if v.FacialMaskId != utils.StringEmpty { + w.Eq["facial_mask_id"] = v.FacialMaskId + } + if v.UseTime != utils.StringEmpty { + w.Like["use_time LIKE ? "] = "%%" + v.UseTime + "%%" + } + if v.HostCode != utils.StringEmpty { + w.Eq["host_code"] = v.HostCode + } + + err := model.MaskModel{}.Init().Items(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + return l.ok(info) } diff --git a/services/equipment/internal/logic/apiMaskStoreUseLogic.go b/services/equipment/internal/logic/apiMaskStoreUseLogic.go index bf11b90..4f225aa 100644 --- a/services/equipment/internal/logic/apiMaskStoreUseLogic.go +++ b/services/equipment/internal/logic/apiMaskStoreUseLogic.go @@ -2,6 +2,12 @@ package logic import ( "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/equipment/internal/dao" + "lone-services/services/equipment/internal/model" + "lone-services/services/equipment/validator" + "strconv" "lone-services/rpc/equipment/pb" "lone-services/services/equipment/internal/svc" @@ -13,6 +19,7 @@ type ApiMaskStoreUseLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger + BaseLogic } func NewApiMaskStoreUseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiMaskStoreUseLogic { @@ -24,7 +31,111 @@ func NewApiMaskStoreUseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *A } func (l *ApiMaskStoreUseLogic) ApiMaskStoreUse(in *equipment.ApiMaskUseRequest) (*equipment.Response, error) { - // todo: add your logic here and delete this line + var v validator.MaskUseValidator - return &equipment.Response{}, nil + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + + maskInfo, storeInfo, cErr := l.checkStoreUse(in, adminInfo) + if cErr != utils.Ok { + return l.fail(cErr) + } + + two := true + if len(maskInfo.UseTime) < utils.NumberEight { + maskInfo.IsUse = utils.StatusDone + maskInfo.UseTime = in.UseTime + maskInfo.HostCode = in.HostCode + maskInfo.UserId = in.UserId + maskInfo.StoreId = storeInfo.Id + maskInfo.GearPosition = in.GearPosition + maskInfo.Voltage = in.Voltage + maskInfo.ElectricCurrent = in.ElectricCurrent + maskInfo.Efficiency = in.Efficiency + maskInfo.Resistance = in.Resistance + maskInfo.Score = in.Score + two = false + } else { + maskInfo.SecondUseTime = v.UseTime + } + + modelObj := model.MaskModel{}.Init() + modelObj.Begin() + if !two { + record := dao.MaskUsageRecordCreate{ + StoreId: int(storeInfo.Id), + FacialMaskId: maskInfo.FacialMaskId, + } + err := model.MaskUsageRecordModel{}.Init().Create(&record) + if err != nil { + l.Logger.Error(err) + modelObj.Rollback() + return l.fail(utils.SetError(utils.Fail, "添加使用记录失败")) + } + } + + w := modelbase.Params{Eq: map[string]string{"id": strconv.FormatInt(maskInfo.Id, 10)}} + _, err2 := modelObj.Edit(w, &maskInfo) + if err2 != nil { + l.Logger.Error(err2) + modelObj.Rollback() + return l.fail(utils.SetError(utils.Fail, "更新数据失败")) + } + + modelObj.Commit() + + return l.ok(utils.NumberOne) +} + +func (l *ApiMaskStoreUseLogic) checkStoreUse(v *equipment.ApiMaskUseRequest, u utils.UserInfo) (dao.MaskUseInfo, dao.StoreInfo, utils.Status) { + var maskInfo dao.MaskUseInfo + var storeInfo dao.StoreInfo + + maskInfo, err := l.checkMaskUse(v) + if err != utils.Ok { + return maskInfo, storeInfo, err + } + + //校验门店信息(门店登录 token 中 ObjId 为门店ID) + storeInfo = svc.GetStore(v.StoreId, l.svcCtx.StoreSvcName) + if storeInfo.Id < utils.NumberOne { + return maskInfo, storeInfo, utils.SetError(utils.ErrorNotFund, "没有找到门店信息") + } + + return maskInfo, storeInfo, utils.Ok +} + +func (l *ApiMaskStoreUseLogic) checkMaskUse(v *equipment.ApiMaskUseRequest) (dao.MaskUseInfo, utils.Status) { + var maskInfo dao.MaskUseInfo + + //面膜信息校验信息 + maskW := modelbase.Params{Eq: map[string]string{"facial_mask_id": v.FacialMaskId}} + err := model.MaskModel{}.Init().GetOne(maskW, &maskInfo) + if err != nil || maskInfo.Id < utils.NumberOne { + l.Logger.Error(err) + return maskInfo, utils.SetError(utils.ErrorNotFund, "没有找到面膜信息") + } + + //如果使用过 + if maskInfo.IsUse == utils.StatusDone { + //试用与一次性直接返回 + if maskInfo.IsOnTrial == dao.FacialTypeTry || + maskInfo.IsOnTrial == dao.FacialTypeOnce { + return maskInfo, utils.SetError(utils.Fail, "产品已使用过") + } + //普通与通过做过两次返回 + if len(maskInfo.SecondUseTime) > utils.NumberEight { + return maskInfo, utils.SetError(utils.Fail, "产品已使用过二次") + } + //两次间隔不能超过30分 + userTime, err := utils.TimeToUnix(maskInfo.UseTime, "2006-1-2 15:4") + if err != nil && userTime+30*60 < utils.Now().Unix() { + utils.Logger.Error(err) + return maskInfo, utils.SetError(utils.Fail, "超过30分不能继续使用") + } + } + + return maskInfo, utils.Ok } diff --git a/services/equipment/internal/logic/apiMaskUseLogic.go b/services/equipment/internal/logic/apiMaskUseLogic.go index 58d3b1c..bb500c2 100644 --- a/services/equipment/internal/logic/apiMaskUseLogic.go +++ b/services/equipment/internal/logic/apiMaskUseLogic.go @@ -2,6 +2,12 @@ package logic import ( "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/equipment/internal/dao" + "lone-services/services/equipment/internal/model" + "lone-services/services/equipment/validator" + "strconv" "lone-services/rpc/equipment/pb" "lone-services/services/equipment/internal/svc" @@ -13,6 +19,7 @@ type ApiMaskUseLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger + BaseLogic } func NewApiMaskUseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiMaskUseLogic { @@ -24,7 +31,124 @@ func NewApiMaskUseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiMas } func (l *ApiMaskUseLogic) ApiMaskUse(in *equipment.ApiMaskUseRequest) (*equipment.Response, error) { - // todo: add your logic here and delete this line + var v validator.MaskUseValidator + 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) + } + + maskInfo, userInfo, err := l.checkUse(in, adminInfo) + if err != utils.Ok { + return l.fail(err) + } + + two := true + if len(maskInfo.UseTime) < utils.NumberEight { + maskInfo.IsUse = utils.StatusDone + maskInfo.UseTime = in.UseTime + maskInfo.HostCode = in.HostCode + maskInfo.UserId = userInfo.Id + maskInfo.GearPosition = in.GearPosition + maskInfo.Voltage = in.Voltage + maskInfo.ElectricCurrent = in.ElectricCurrent + maskInfo.Efficiency = in.Efficiency + maskInfo.Resistance = in.Resistance + maskInfo.Score = in.Score + two = false + } else { + maskInfo.SecondUseTime = v.UseTime + } + + modelObj := model.MaskModel{}.Init() + modelObj.Begin() + if v.StoreId > utils.NumberZero && !two { + maskInfo.StoreId = in.StoreId + record := dao.MaskUsageRecordCreate{ + Userid: int(userInfo.Id), + StoreId: v.StoreId, + FacialMaskId: maskInfo.FacialMaskId, + } + aErr := model.MaskUsageRecordModel{}.Init().Create(&record) + if aErr != nil { + l.Logger.Error(err) + modelObj.Rollback() + return l.fail(utils.SetError(utils.Fail, "添加使用记录失败")) + } + } + + w := modelbase.Params{Eq: map[string]string{"id": strconv.FormatInt(maskInfo.Id, 10)}} + _, err2 := modelObj.Edit(w, &maskInfo) + if err2 != nil { + l.Logger.Error(err2) + modelObj.Rollback() + return l.fail(utils.SetError(utils.Fail, "更新数据失败")) + } + + modelObj.Commit() return &equipment.Response{}, nil } + +func (l *ApiMaskUseLogic) checkUse(v *equipment.ApiMaskUseRequest, u utils.UserInfo) (dao.MaskUseInfo, dao.UserInfo, utils.Status) { + var maskInfo dao.MaskUseInfo + var userInfo dao.UserInfo + + maskInfo, err := l.checkMaskUse(v) + if err != utils.Ok { + return maskInfo, userInfo, err + } + + //校验用户信息 + userInfo = svc.GetUser(u.ID, l.svcCtx.UserSvcName) + if userInfo.Id < utils.NumberOne { + return maskInfo, userInfo, utils.SetError(utils.ErrorNotFund, "没有找到用户信息") + } + + //如果有门店信息校验信息 + if v.StoreId > utils.NumberZero { + var storeInfo dao.StoreInfo + storeInfo = svc.GetStore(v.StoreId, l.svcCtx.StoreSvcName) + if storeInfo.Id < utils.NumberOne { + return maskInfo, userInfo, utils.SetError(utils.ErrorNotFund, "没有找到门店信息") + } + } + + return maskInfo, userInfo, utils.Ok +} + +func (l *ApiMaskUseLogic) checkMaskUse(v *equipment.ApiMaskUseRequest) (dao.MaskUseInfo, utils.Status) { + var maskInfo dao.MaskUseInfo + + //面膜信息校验信息 + maskW := modelbase.Params{Eq: map[string]string{"facial_mask_id": v.FacialMaskId}} + err := model.MaskModel{}.Init().GetOne(maskW, &maskInfo) + if err != nil || maskInfo.Id < utils.NumberOne { + l.Logger.Error(err) + return maskInfo, utils.SetError(utils.ErrorNotFund, "没有找到面膜信息") + } + + //如果使用过 + if maskInfo.IsUse == utils.StatusDone { + //试用与一次性直接返回 + if maskInfo.IsOnTrial == dao.FacialTypeTry || + maskInfo.IsOnTrial == dao.FacialTypeOnce { + return maskInfo, utils.SetError(utils.Fail, "产品已使用过") + } + //普通与通过做过两次返回 + if len(maskInfo.SecondUseTime) > utils.NumberEight { + return maskInfo, utils.SetError(utils.Fail, "产品已使用过二次") + } + //两次间隔不能超过30分 + userTime, err := utils.TimeToUnix(maskInfo.UseTime, "2006-1-2 15:4") + if err != nil && userTime+30*60 < utils.Now().Unix() { + l.Logger.Error(err) + return maskInfo, utils.SetError(utils.Fail, "超过30分不能继续使用") + } + } + + return maskInfo, utils.Ok +} diff --git a/services/equipment/internal/logic/apiMaskUsedItemsLogic.go b/services/equipment/internal/logic/apiMaskUsedItemsLogic.go index 812a71a..6a6c2b0 100644 --- a/services/equipment/internal/logic/apiMaskUsedItemsLogic.go +++ b/services/equipment/internal/logic/apiMaskUsedItemsLogic.go @@ -2,6 +2,12 @@ package logic import ( "context" + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/services/equipment/internal/dao" + "lone-services/services/equipment/internal/model" + "lone-services/services/equipment/validator" + "strconv" "lone-services/rpc/equipment/pb" "lone-services/services/equipment/internal/svc" @@ -13,6 +19,7 @@ type ApiMaskUsedItemsLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger + BaseLogic } func NewApiMaskUsedItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiMaskUsedItemsLogic { @@ -24,7 +31,35 @@ func NewApiMaskUsedItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) * } func (l *ApiMaskUsedItemsLogic) ApiMaskUsedItems(in *equipment.ApiMaskUsedItemsRequest) (*equipment.Response, error) { - // todo: add your logic here and delete this line + var v validator.MaskUsedItemsValidator + if fail := l.checkParams(in, &v); fail != nil { + return fail, nil + } - return &equipment.Response{}, nil + adminInfo := utils.GetUserFromCtx(l.ctx) + if adminInfo.ID < utils.NumberOne { + return l.fail(utils.ErrorNoLoginInfo) + } + + var info []dao.MaskUsedInfo + w := modelbase.Params{Eq: map[string]string{ + "is_use": strconv.Itoa(utils.StatusDone), "user_id": strconv.Itoa(int(adminInfo.ID))}, + Order: "id desc"} + if v.FacialMaskId != utils.StringEmpty { + w.Eq["facial_mask_id"] = v.FacialMaskId + } + if v.UseTime != utils.StringEmpty { + w.Like["use_time LIKE ? "] = "%%" + v.UseTime + "%%" + } + if v.HostCode != utils.StringEmpty { + w.Eq["host_code"] = v.HostCode + } + + err := model.MaskModel{}.Init().Items(w, &info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + + return l.ok(info) } diff --git a/services/equipment/internal/model/maskUsageRecord.go b/services/equipment/internal/model/maskUsageRecord.go new file mode 100644 index 0000000..00b483a --- /dev/null +++ b/services/equipment/internal/model/maskUsageRecord.go @@ -0,0 +1,23 @@ +package model + +import ( + "lone-services/pkg/modelbase" + "lone-services/services/equipment/internal/dao" +) + +type MaskUsageRecordModel struct { + modelbase.Base +} + +func (m MaskUsageRecordModel) TableName() string { + return modelbase.Prefix() + "mask_usage_record" +} + +func (m MaskUsageRecordModel) Init() MaskUsageRecordModel { + m.Table = m.TableName() + return m +} + +func (m MaskUsageRecordModel) Create(data *dao.MaskUsageRecordCreate) error { + return m.Base.Create(data) +} diff --git a/services/equipment/internal/server/equipmentServer.go b/services/equipment/internal/server/equipmentServer.go index 8a09307..b0045c3 100644 --- a/services/equipment/internal/server/equipmentServer.go +++ b/services/equipment/internal/server/equipmentServer.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 +// goctl 1.10.2 // Source: equipment.proto package server diff --git a/services/equipment/internal/svc/grpcService.go b/services/equipment/internal/svc/grpcService.go new file mode 100644 index 0000000..1e1f32f --- /dev/null +++ b/services/equipment/internal/svc/grpcService.go @@ -0,0 +1,50 @@ +package svc + +import ( + "context" + store "lone-services/rpc/store/pb" + user "lone-services/rpc/user/pb" + "lone-services/services/equipment/internal/dao" + + "github.com/zeromicro/go-zero/core/logx" +) + +func GetUser(id int64, name string) dao.UserInfo { + var userInfo dao.UserInfo + cli, err := GetRpcClient(name) + if err != nil { + logx.Error(err) + return userInfo + } + + client := user.NewUserClient(cli.Conn()) + info, err := client.InternalGetUserInfo(context.Background(), &user.InternalGetUserInfoReq{UserId: id}) + if err != nil { + logx.Errorf("get user err: %v", err) + return userInfo + } + + userInfo.Id = info.Id + + return userInfo +} + +func GetStore(id int64, name string) dao.StoreInfo { + var storeInfo dao.StoreInfo + cli, err := GetRpcClient(name) + if err != nil { + logx.Error(err) + return storeInfo + } + + client := store.NewStoreClient(cli.Conn()) + info, err := client.GetInfoById(context.Background(), &store.IdRequest{Id: id}) + if err != nil { + logx.Errorf("get store err: %v", err) + return storeInfo + } + + storeInfo.Id = info.Id + + return storeInfo +} diff --git a/services/equipment/internal/svc/servicecontext.go b/services/equipment/internal/svc/servicecontext.go index d51e45b..5b2e8d9 100644 --- a/services/equipment/internal/svc/servicecontext.go +++ b/services/equipment/internal/svc/servicecontext.go @@ -1,23 +1,98 @@ package svc import ( + "fmt" + "lone-services/pkg/discovery" "lone-services/pkg/utils" "lone-services/services/equipment/internal/config" + "net" + "strconv" + "sync" + "time" + "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/zrpc" "gorm.io/gorm" ) +type rpcClientCacheEntry struct { + cli zrpc.Client + target string + expireAt time.Time +} + +const rpcClientCacheTTL = 30 * time.Second //缓存过期时间 + +var ( + rpcCacheLock sync.Mutex + rpcCache = make(map[string]*rpcClientCacheEntry) +) + +func GetRpcClient(serviceName string) (zrpc.Client, error) { + if serviceName == utils.StringEmpty { + err := fmt.Errorf("rpc serviceName is empty") + logx.Error(err) + return nil, err + } + + cacheKey := serviceName + + rpcCacheLock.Lock() + entry, ok := rpcCache[cacheKey] + if ok && time.Now().Before(entry.expireAt) { + rpcCacheLock.Unlock() + return entry.cli, nil + } + delete(rpcCache, cacheKey) + rpcCacheLock.Unlock() + + inst, err := discovery.Pick(serviceName) + if err != nil { + err = fmt.Errorf("discovery pick %s failed: %w", serviceName, err) + logx.Error(err) + return nil, err + } + + target := net.JoinHostPort(inst.IP, strconv.FormatUint(inst.Port, utils.NumberTen)) + + cli := zrpc.MustNewClient(zrpc.RpcClientConf{ + Target: target, + Timeout: utils.RpcTimeOut, //rpc调用超时5s + }) + + rpcCacheLock.Lock() + rpcCache[cacheKey] = &rpcClientCacheEntry{ + cli: cli, + target: target, + expireAt: time.Now().Add(rpcClientCacheTTL), + } + rpcCacheLock.Unlock() + + return cli, nil +} + type ServiceContext struct { - Config config.Config - DB *gorm.DB - Prefix string + Config config.Config + DB *gorm.DB + Prefix string + StoreSvcName string + UserSvcName string } func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext { - + storeSvc := utils.GetConfigString("services.store") + if storeSvc == utils.StringEmpty { + logx.Error("config services.store empty") + } + userSvc := utils.GetConfigString("services.user") + if userSvc == utils.StringEmpty { + logx.Error("config services.user empty") + } return &ServiceContext{ - Config: c, - DB: db, - Prefix: utils.GetConfigString("mysql.prefix"), + Config: c, + DB: db, + Prefix: utils.GetConfigString("mysql.prefix"), + StoreSvcName: storeSvc, + UserSvcName: userSvc, } } From 3164fb60a1e145ec26092d17f59502a0c5c76d75 Mon Sep 17 00:00:00 2001 From: gjs Date: Wed, 21 Oct 2026 09:18:07 +0800 Subject: [PATCH 2/6] save --- services/chore/internal/dao/answerUser.go | 3 ++- services/chore/internal/logic/apiAnswerSaveLogic.go | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/services/chore/internal/dao/answerUser.go b/services/chore/internal/dao/answerUser.go index 1d669e2..13cd28a 100644 --- a/services/chore/internal/dao/answerUser.go +++ b/services/chore/internal/dao/answerUser.go @@ -1,6 +1,7 @@ package dao type UserAnswer struct { - Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Id int64 `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"` + UserId int64 `gorm:"column:user_id;type:int(11);comment:用户ID" json:"user_id"` } diff --git a/services/chore/internal/logic/apiAnswerSaveLogic.go b/services/chore/internal/logic/apiAnswerSaveLogic.go index 58b09af..9f59f45 100644 --- a/services/chore/internal/logic/apiAnswerSaveLogic.go +++ b/services/chore/internal/logic/apiAnswerSaveLogic.go @@ -43,7 +43,14 @@ func (l *ApiAnswerSaveLogic) ApiAnswerSave(in *chore.EmptyReq) (*chore.Response, return l.fail(utils.Fail) } if info.Id < utils.NumberOne { - return l.fail(utils.SetError(utils.ErrorNotFund, "用户不存在")) + info.Answer = utils.StatusOk + info.UserId = adminInfo.ID + err = model.AnswerUserModel{}.Init().Create(&info) + if err != nil { + l.Logger.Error(err) + return l.fail(utils.Fail) + } + return l.ok(info.Id) } info.Answer = utils.StatusOk From 1863b784bc109724952a93ef7c4a937b07efaa6d Mon Sep 17 00:00:00 2001 From: gjs Date: Wed, 21 Oct 2026 09:25:00 +0800 Subject: [PATCH 3/6] save --- services/chore/internal/logic/apiAnswerIProgressLogic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/chore/internal/logic/apiAnswerIProgressLogic.go b/services/chore/internal/logic/apiAnswerIProgressLogic.go index 4f1c4ac..8855048 100644 --- a/services/chore/internal/logic/apiAnswerIProgressLogic.go +++ b/services/chore/internal/logic/apiAnswerIProgressLogic.go @@ -34,7 +34,7 @@ func (l *ApiAnswerIProgressLogic) ApiAnswerIProgress(in *chore.EmptyReq) (*chore return l.fail(utils.ErrorNoLoginInfo) } var info dao.UserAnswer - w := modelbase.Params{Eq: map[string]string{"id": strconv.FormatInt(adminInfo.ID, utils.NumberTen)}} + 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 { From 4725649e3324d232e70ce76f0a4bd9ae5a362947 Mon Sep 17 00:00:00 2001 From: gjs Date: Wed, 21 Oct 2026 09:51:48 +0800 Subject: [PATCH 4/6] save --- services/equipment/internal/dao/bind.go | 2 +- services/equipment/internal/logic/apiBindItemsLogic.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/equipment/internal/dao/bind.go b/services/equipment/internal/dao/bind.go index 492db06..bf18312 100644 --- a/services/equipment/internal/dao/bind.go +++ b/services/equipment/internal/dao/bind.go @@ -10,7 +10,7 @@ type BindCreate struct { HostNickname string `gorm:"column:host_nickname;type:varchar(128);comment:主机昵称;NOT NULL" json:"host_nickname"` UserId int64 `gorm:"column:user_id;type:int(11);comment:用户ID;NOT NULL" json:"user_id"` UserNickname string `gorm:"column:user_nickname;type:varchar(128);comment:用户昵称;NOT NULL" json:"user_nickname"` - Type int32 `json:"type" gorm:"type"` // 类型。1为圆屏,2为卵型屏,3为皮肤分析仪,4为经皮湿水仪,5为AI化妆盒,6为软水机,7为制氧机 + Type int32 `json:"type" gorm:"type"` // 类型。1为圆屏,2为卵型屏,3为皮肤分析仪,4为经皮湿水仪,5为AI化妆盒,6为软水机,7为制氧机,8老圆屏,9祛痘,10老圆屏 SkinType int32 `gorm:"column:skin_type" json:"skin_type"` // 1用户 2门店 Image string `gorm:"column:image;type:varchar(128);comment:图片地址;NOT NULL" json:"image"` IsSpeciality int32 `gorm:"column:is_speciality;type:tinyint(1);default:0;comment:1是专业版;NOT NULL" json:"is_speciality"` diff --git a/services/equipment/internal/logic/apiBindItemsLogic.go b/services/equipment/internal/logic/apiBindItemsLogic.go index 60d3255..3f2369d 100644 --- a/services/equipment/internal/logic/apiBindItemsLogic.go +++ b/services/equipment/internal/logic/apiBindItemsLogic.go @@ -40,7 +40,7 @@ func (l *ApiBindItemsLogic) ApiBindItems(in *equipment.EmptyRequest) (*equipment "status": utils.StringStatusOk}, Order: "id desc", } - var info dao.BindInfo + var info []dao.BindInfo err := model.BindModel{}.Init().Items(w, &info) if err != nil { l.Logger.Error(err) From d2b6d82d7858e57209fff457144801f847b8abbd Mon Sep 17 00:00:00 2001 From: gjs Date: Wed, 21 Oct 2026 10:25:09 +0800 Subject: [PATCH 5/6] save --- services/equipment/validator/bind.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/equipment/validator/bind.go b/services/equipment/validator/bind.go index 7ebf7a8..a4f892e 100644 --- a/services/equipment/validator/bind.go +++ b/services/equipment/validator/bind.go @@ -109,12 +109,14 @@ func (p BindValidator) GetMessage() validate.ValidatorMessages { type BindUnbindValidator struct { HostCode string `form:"host_code" json:"host_code" validate:"required"` + Type int32 `form:"type" json:"type" validate:"required"` } // GetMessage 提示消息 func (p BindUnbindValidator) GetMessage() validate.ValidatorMessages { return validate.ValidatorMessages{ "HostCode.required": "缺少设备编码", + "Type.required": "缺少类型", } } From 746bde71de85acfe2863b8f506d3530384156293 Mon Sep 17 00:00:00 2001 From: gjs Date: Wed, 21 Oct 2026 11:05:40 +0800 Subject: [PATCH 6/6] fix --- services/equipment/internal/logic/apiMaskUseLogic.go | 2 +- services/equipment/internal/model/mask.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/equipment/internal/logic/apiMaskUseLogic.go b/services/equipment/internal/logic/apiMaskUseLogic.go index bb500c2..f8942f7 100644 --- a/services/equipment/internal/logic/apiMaskUseLogic.go +++ b/services/equipment/internal/logic/apiMaskUseLogic.go @@ -90,7 +90,7 @@ func (l *ApiMaskUseLogic) ApiMaskUse(in *equipment.ApiMaskUseRequest) (*equipmen modelObj.Commit() - return &equipment.Response{}, nil + return l.ok(utils.NumberOne) } func (l *ApiMaskUseLogic) checkUse(v *equipment.ApiMaskUseRequest, u utils.UserInfo) (dao.MaskUseInfo, dao.UserInfo, utils.Status) { diff --git a/services/equipment/internal/model/mask.go b/services/equipment/internal/model/mask.go index 2abeb9e..f85aeb8 100644 --- a/services/equipment/internal/model/mask.go +++ b/services/equipment/internal/model/mask.go @@ -10,7 +10,7 @@ type MaskModel struct { } func (m MaskModel) TableName() string { - return modelbase.Prefix() + "version" + return modelbase.Prefix() + "mask" } func (m MaskModel) Init() MaskModel {