From 7c54d3ce309dd7d5a7242d53c54c0e9c7874f453 Mon Sep 17 00:00:00 2001 From: daiyb <570956418@qq.com> Date: Thu, 12 Jun 2025 15:20:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/cast/cast.pb.go | 342 +++++++++++++++++++++++++---------- api/cast/cast.pb.validate.go | 110 +++++++++++ api/cast/cast_triple.pb.go | 45 +++++ pkg/router/media.go | 1 + pkg/service/cast/work.go | 16 ++ 5 files changed, 423 insertions(+), 91 deletions(-) diff --git a/api/cast/cast.pb.go b/api/cast/cast.pb.go index b44639a..386c824 100644 --- a/api/cast/cast.pb.go +++ b/api/cast/cast.pb.go @@ -76,6 +76,61 @@ func (PlatformIDENUM) EnumDescriptor() ([]byte, []int) { return file_pb_fiee_cast_proto_rawDescGZIP(), []int{0} } +type WorkActionENUM int32 + +const ( + WorkActionENUM_NO_ACTION WorkActionENUM = 0 + WorkActionENUM_CONFIRM WorkActionENUM = 1 // 确认 + WorkActionENUM_APPROVAL WorkActionENUM = 2 // 审批 + WorkActionENUM_APPROVAL_PASS WorkActionENUM = 3 // 审批通过 + WorkActionENUM_APPROVAL_REJECT WorkActionENUM = 4 // 审批驳回 +) + +// Enum value maps for WorkActionENUM. +var ( + WorkActionENUM_name = map[int32]string{ + 0: "NO_ACTION", + 1: "CONFIRM", + 2: "APPROVAL", + 3: "APPROVAL_PASS", + 4: "APPROVAL_REJECT", + } + WorkActionENUM_value = map[string]int32{ + "NO_ACTION": 0, + "CONFIRM": 1, + "APPROVAL": 2, + "APPROVAL_PASS": 3, + "APPROVAL_REJECT": 4, + } +) + +func (x WorkActionENUM) Enum() *WorkActionENUM { + p := new(WorkActionENUM) + *p = x + return p +} + +func (x WorkActionENUM) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WorkActionENUM) Descriptor() protoreflect.EnumDescriptor { + return file_pb_fiee_cast_proto_enumTypes[1].Descriptor() +} + +func (WorkActionENUM) Type() protoreflect.EnumType { + return &file_pb_fiee_cast_proto_enumTypes[1] +} + +func (x WorkActionENUM) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use WorkActionENUM.Descriptor instead. +func (WorkActionENUM) EnumDescriptor() ([]byte, []int) { + return file_pb_fiee_cast_proto_rawDescGZIP(), []int{1} +} + type MediaUserListReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1282,6 +1337,83 @@ func (x *WorkDetailResp) GetApprovalID() string { return "" } +type UpdateStatusReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WorkAction WorkActionENUM `protobuf:"varint,1,opt,name=workAction,proto3,enum=Cast.WorkActionENUM" json:"workAction"` + WorkUuid string `protobuf:"bytes,2,opt,name=workUuid,proto3" json:"workUuid"` + ApprovalID string `protobuf:"bytes,3,opt,name=approvalID,proto3" json:"approvalID"` + ConfirmRemark string `protobuf:"bytes,4,opt,name=confirmRemark,proto3" json:"confirmRemark"` + ConfirmStatus uint32 `protobuf:"varint,5,opt,name=confirmStatus,proto3" json:"confirmStatus"` +} + +func (x *UpdateStatusReq) Reset() { + *x = UpdateStatusReq{} + mi := &file_pb_fiee_cast_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateStatusReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateStatusReq) ProtoMessage() {} + +func (x *UpdateStatusReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_fiee_cast_proto_msgTypes[15] + 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 UpdateStatusReq.ProtoReflect.Descriptor instead. +func (*UpdateStatusReq) Descriptor() ([]byte, []int) { + return file_pb_fiee_cast_proto_rawDescGZIP(), []int{15} +} + +func (x *UpdateStatusReq) GetWorkAction() WorkActionENUM { + if x != nil { + return x.WorkAction + } + return WorkActionENUM_NO_ACTION +} + +func (x *UpdateStatusReq) GetWorkUuid() string { + if x != nil { + return x.WorkUuid + } + return "" +} + +func (x *UpdateStatusReq) GetApprovalID() string { + if x != nil { + return x.ApprovalID + } + return "" +} + +func (x *UpdateStatusReq) GetConfirmRemark() string { + if x != nil { + return x.ConfirmRemark + } + return "" +} + +func (x *UpdateStatusReq) GetConfirmStatus() uint32 { + if x != nil { + return x.ConfirmStatus + } + return 0 +} + type MediaUserListResp_Info struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1298,7 +1430,7 @@ type MediaUserListResp_Info struct { func (x *MediaUserListResp_Info) Reset() { *x = MediaUserListResp_Info{} - mi := &file_pb_fiee_cast_proto_msgTypes[15] + mi := &file_pb_fiee_cast_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1310,7 +1442,7 @@ func (x *MediaUserListResp_Info) String() string { func (*MediaUserListResp_Info) ProtoMessage() {} func (x *MediaUserListResp_Info) ProtoReflect() protoreflect.Message { - mi := &file_pb_fiee_cast_proto_msgTypes[15] + mi := &file_pb_fiee_cast_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1396,7 +1528,7 @@ type WorkListResp_Info struct { func (x *WorkListResp_Info) Reset() { *x = WorkListResp_Info{} - mi := &file_pb_fiee_cast_proto_msgTypes[16] + mi := &file_pb_fiee_cast_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1408,7 +1540,7 @@ func (x *WorkListResp_Info) String() string { func (*WorkListResp_Info) ProtoMessage() {} func (x *WorkListResp_Info) ProtoReflect() protoreflect.Message { - mi := &file_pb_fiee_cast_proto_msgTypes[16] + mi := &file_pb_fiee_cast_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1761,47 +1893,70 @@ var file_pb_fiee_cast_proto_rawDesc = []byte{ 0x6f, 0x76, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x70, - 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x49, 0x44, 0x2a, 0x3f, 0x0a, 0x0e, 0x50, 0x6c, 0x61, 0x74, 0x66, - 0x6f, 0x72, 0x6d, 0x49, 0x44, 0x45, 0x4e, 0x55, 0x4d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x54, 0x49, 0x4b, 0x54, 0x4f, 0x4b, - 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x59, 0x4f, 0x55, 0x54, 0x55, 0x42, 0x45, 0x10, 0x02, 0x12, - 0x07, 0x0a, 0x03, 0x49, 0x4e, 0x53, 0x10, 0x03, 0x32, 0xa3, 0x04, 0x0a, 0x04, 0x43, 0x61, 0x73, - 0x74, 0x12, 0x42, 0x0a, 0x0d, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, - 0x73, 0x74, 0x12, 0x16, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x55, - 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x43, 0x61, 0x73, - 0x74, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x43, 0x61, - 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x41, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0d, 0x55, 0x6e, 0x62, 0x69, - 0x6e, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x43, 0x61, 0x73, 0x74, - 0x2e, 0x55, 0x6e, 0x62, 0x69, 0x6e, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0b, 0x42, - 0x69, 0x6e, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x14, 0x2e, 0x43, 0x61, 0x73, - 0x74, 0x2e, 0x42, 0x69, 0x6e, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x0f, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x18, 0x2e, + 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x49, 0x44, 0x22, 0xcf, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x12, 0x34, 0x0a, 0x0a, 0x77, + 0x6f, 0x72, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x14, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x45, 0x4e, 0x55, 0x4d, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x55, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x55, 0x75, 0x69, 0x64, 0x12, 0x1e, 0x0a, + 0x0a, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x49, 0x44, 0x12, 0x24, 0x0a, + 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x52, 0x65, 0x6d, + 0x61, 0x72, 0x6b, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 0x3f, 0x0a, 0x0e, 0x50, 0x6c, 0x61, + 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x49, 0x44, 0x45, 0x4e, 0x55, 0x4d, 0x12, 0x0b, 0x0a, 0x07, 0x55, + 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x54, 0x49, 0x4b, 0x54, + 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x59, 0x4f, 0x55, 0x54, 0x55, 0x42, 0x45, 0x10, + 0x02, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x4e, 0x53, 0x10, 0x03, 0x2a, 0x62, 0x0a, 0x0e, 0x57, 0x6f, + 0x72, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x4e, 0x55, 0x4d, 0x12, 0x0d, 0x0a, 0x09, + 0x4e, 0x4f, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, + 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x50, 0x50, 0x52, + 0x4f, 0x56, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, + 0x41, 0x4c, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x50, 0x50, + 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x5f, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x04, 0x32, 0xe4, + 0x04, 0x0a, 0x04, 0x43, 0x61, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x0d, 0x4d, 0x65, 0x64, 0x69, 0x61, + 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, + 0x4d, 0x65, 0x64, 0x69, 0x61, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x1a, 0x17, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x55, 0x73, 0x65, + 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x12, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x1b, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, + 0x65, 0x64, 0x69, 0x61, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1c, + 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x64, 0x69, + 0x61, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x41, + 0x0a, 0x0d, 0x55, 0x6e, 0x62, 0x69, 0x6e, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, + 0x16, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, 0x6e, 0x62, 0x69, 0x6e, 0x64, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, + 0x00, 0x12, 0x3d, 0x0a, 0x0b, 0x42, 0x69, 0x6e, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x12, 0x14, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x42, 0x69, 0x6e, 0x64, 0x4d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, + 0x12, 0x48, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x49, 0x6d, + 0x61, 0x67, 0x65, 0x12, 0x18, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x49, - 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, - 0x72, 0x6b, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x18, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, + 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x0f, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x18, 0x2e, + 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x56, + 0x69, 0x64, 0x65, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, 0x65, - 0x71, 0x1a, 0x19, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, - 0x6f, 0x72, 0x6b, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x33, - 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x43, 0x61, 0x73, - 0x74, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, - 0x43, 0x61, 0x73, 0x74, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0a, 0x57, 0x6f, 0x72, 0x6b, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x12, 0x13, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x44, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x57, 0x6f, - 0x72, 0x6b, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x0d, - 0x5a, 0x0b, 0x2e, 0x2f, 0x63, 0x61, 0x73, 0x74, 0x3b, 0x63, 0x61, 0x73, 0x74, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x70, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, + 0x12, 0x11, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0a, 0x57, 0x6f, 0x72, + 0x6b, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x13, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x57, + 0x6f, 0x72, 0x6b, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x43, + 0x61, 0x73, 0x74, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, + 0x73, 0x70, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x15, 0x2e, 0x43, 0x61, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x63, 0x61, 0x73, 0x74, 0x3b, + 0x63, 0x61, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1816,60 +1971,65 @@ func file_pb_fiee_cast_proto_rawDescGZIP() []byte { return file_pb_fiee_cast_proto_rawDescData } -var file_pb_fiee_cast_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_pb_fiee_cast_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_pb_fiee_cast_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_pb_fiee_cast_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_pb_fiee_cast_proto_goTypes = []any{ (PlatformIDENUM)(0), // 0: Cast.PlatformIDENUM - (*MediaUserListReq)(nil), // 1: Cast.MediaUserListReq - (*MediaUserListResp)(nil), // 2: Cast.MediaUserListResp - (*UpdateMediaAccountReq)(nil), // 3: Cast.UpdateMediaAccountReq - (*UpdateMediaAccountResp)(nil), // 4: Cast.UpdateMediaAccountResp - (*UnbindManagerReq)(nil), // 5: Cast.UnbindManagerReq - (*BindManagerReq)(nil), // 6: Cast.BindManagerReq - (*UpdateWorkImageReq)(nil), // 7: Cast.UpdateWorkImageReq - (*UpdateWorkImageResp)(nil), // 8: Cast.UpdateWorkImageResp - (*PublishConfig)(nil), // 9: Cast.PublishConfig - (*UpdateWorkVideoReq)(nil), // 10: Cast.UpdateWorkVideoReq - (*UpdateWorkVideoResp)(nil), // 11: Cast.UpdateWorkVideoResp - (*WorkListReq)(nil), // 12: Cast.WorkListReq - (*WorkListResp)(nil), // 13: Cast.WorkListResp - (*WorkDetailReq)(nil), // 14: Cast.WorkDetailReq - (*WorkDetailResp)(nil), // 15: Cast.WorkDetailResp - (*MediaUserListResp_Info)(nil), // 16: Cast.MediaUserListResp.Info - (*WorkListResp_Info)(nil), // 17: Cast.WorkListResp.Info - (*emptypb.Empty)(nil), // 18: google.protobuf.Empty + (WorkActionENUM)(0), // 1: Cast.WorkActionENUM + (*MediaUserListReq)(nil), // 2: Cast.MediaUserListReq + (*MediaUserListResp)(nil), // 3: Cast.MediaUserListResp + (*UpdateMediaAccountReq)(nil), // 4: Cast.UpdateMediaAccountReq + (*UpdateMediaAccountResp)(nil), // 5: Cast.UpdateMediaAccountResp + (*UnbindManagerReq)(nil), // 6: Cast.UnbindManagerReq + (*BindManagerReq)(nil), // 7: Cast.BindManagerReq + (*UpdateWorkImageReq)(nil), // 8: Cast.UpdateWorkImageReq + (*UpdateWorkImageResp)(nil), // 9: Cast.UpdateWorkImageResp + (*PublishConfig)(nil), // 10: Cast.PublishConfig + (*UpdateWorkVideoReq)(nil), // 11: Cast.UpdateWorkVideoReq + (*UpdateWorkVideoResp)(nil), // 12: Cast.UpdateWorkVideoResp + (*WorkListReq)(nil), // 13: Cast.WorkListReq + (*WorkListResp)(nil), // 14: Cast.WorkListResp + (*WorkDetailReq)(nil), // 15: Cast.WorkDetailReq + (*WorkDetailResp)(nil), // 16: Cast.WorkDetailResp + (*UpdateStatusReq)(nil), // 17: Cast.UpdateStatusReq + (*MediaUserListResp_Info)(nil), // 18: Cast.MediaUserListResp.Info + (*WorkListResp_Info)(nil), // 19: Cast.WorkListResp.Info + (*emptypb.Empty)(nil), // 20: google.protobuf.Empty } var file_pb_fiee_cast_proto_depIdxs = []int32{ 0, // 0: Cast.MediaUserListReq.platformID:type_name -> Cast.PlatformIDENUM - 16, // 1: Cast.MediaUserListResp.data:type_name -> Cast.MediaUserListResp.Info + 18, // 1: Cast.MediaUserListResp.data:type_name -> Cast.MediaUserListResp.Info 0, // 2: Cast.UpdateMediaAccountReq.platformID:type_name -> Cast.PlatformIDENUM 0, // 3: Cast.UpdateWorkImageReq.platformIDs:type_name -> Cast.PlatformIDENUM - 9, // 4: Cast.UpdateWorkImageReq.publishConfig:type_name -> Cast.PublishConfig + 10, // 4: Cast.UpdateWorkImageReq.publishConfig:type_name -> Cast.PublishConfig 0, // 5: Cast.UpdateWorkVideoReq.platformIDs:type_name -> Cast.PlatformIDENUM - 9, // 6: Cast.UpdateWorkVideoReq.publishConfig:type_name -> Cast.PublishConfig - 17, // 7: Cast.WorkListResp.data:type_name -> Cast.WorkListResp.Info - 9, // 8: Cast.WorkDetailResp.publishConfig:type_name -> Cast.PublishConfig - 1, // 9: Cast.Cast.MediaUserList:input_type -> Cast.MediaUserListReq - 3, // 10: Cast.Cast.UpdateMediaAccount:input_type -> Cast.UpdateMediaAccountReq - 5, // 11: Cast.Cast.UnbindManager:input_type -> Cast.UnbindManagerReq - 6, // 12: Cast.Cast.BindManager:input_type -> Cast.BindManagerReq - 7, // 13: Cast.Cast.UpdateWorkImage:input_type -> Cast.UpdateWorkImageReq - 10, // 14: Cast.Cast.UpdateWorkVideo:input_type -> Cast.UpdateWorkVideoReq - 12, // 15: Cast.Cast.WorkList:input_type -> Cast.WorkListReq - 14, // 16: Cast.Cast.WorkDetail:input_type -> Cast.WorkDetailReq - 2, // 17: Cast.Cast.MediaUserList:output_type -> Cast.MediaUserListResp - 4, // 18: Cast.Cast.UpdateMediaAccount:output_type -> Cast.UpdateMediaAccountResp - 18, // 19: Cast.Cast.UnbindManager:output_type -> google.protobuf.Empty - 18, // 20: Cast.Cast.BindManager:output_type -> google.protobuf.Empty - 8, // 21: Cast.Cast.UpdateWorkImage:output_type -> Cast.UpdateWorkImageResp - 11, // 22: Cast.Cast.UpdateWorkVideo:output_type -> Cast.UpdateWorkVideoResp - 13, // 23: Cast.Cast.WorkList:output_type -> Cast.WorkListResp - 15, // 24: Cast.Cast.WorkDetail:output_type -> Cast.WorkDetailResp - 17, // [17:25] is the sub-list for method output_type - 9, // [9:17] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 10, // 6: Cast.UpdateWorkVideoReq.publishConfig:type_name -> Cast.PublishConfig + 19, // 7: Cast.WorkListResp.data:type_name -> Cast.WorkListResp.Info + 10, // 8: Cast.WorkDetailResp.publishConfig:type_name -> Cast.PublishConfig + 1, // 9: Cast.UpdateStatusReq.workAction:type_name -> Cast.WorkActionENUM + 2, // 10: Cast.Cast.MediaUserList:input_type -> Cast.MediaUserListReq + 4, // 11: Cast.Cast.UpdateMediaAccount:input_type -> Cast.UpdateMediaAccountReq + 6, // 12: Cast.Cast.UnbindManager:input_type -> Cast.UnbindManagerReq + 7, // 13: Cast.Cast.BindManager:input_type -> Cast.BindManagerReq + 8, // 14: Cast.Cast.UpdateWorkImage:input_type -> Cast.UpdateWorkImageReq + 11, // 15: Cast.Cast.UpdateWorkVideo:input_type -> Cast.UpdateWorkVideoReq + 13, // 16: Cast.Cast.WorkList:input_type -> Cast.WorkListReq + 15, // 17: Cast.Cast.WorkDetail:input_type -> Cast.WorkDetailReq + 17, // 18: Cast.Cast.UpdateStatus:input_type -> Cast.UpdateStatusReq + 3, // 19: Cast.Cast.MediaUserList:output_type -> Cast.MediaUserListResp + 5, // 20: Cast.Cast.UpdateMediaAccount:output_type -> Cast.UpdateMediaAccountResp + 20, // 21: Cast.Cast.UnbindManager:output_type -> google.protobuf.Empty + 20, // 22: Cast.Cast.BindManager:output_type -> google.protobuf.Empty + 9, // 23: Cast.Cast.UpdateWorkImage:output_type -> Cast.UpdateWorkImageResp + 12, // 24: Cast.Cast.UpdateWorkVideo:output_type -> Cast.UpdateWorkVideoResp + 14, // 25: Cast.Cast.WorkList:output_type -> Cast.WorkListResp + 16, // 26: Cast.Cast.WorkDetail:output_type -> Cast.WorkDetailResp + 20, // 27: Cast.Cast.UpdateStatus:output_type -> google.protobuf.Empty + 19, // [19:28] is the sub-list for method output_type + 10, // [10:19] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_pb_fiee_cast_proto_init() } @@ -1882,8 +2042,8 @@ func file_pb_fiee_cast_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pb_fiee_cast_proto_rawDesc, - NumEnums: 1, - NumMessages: 17, + NumEnums: 2, + NumMessages: 18, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cast/cast.pb.validate.go b/api/cast/cast.pb.validate.go index 386f90f..60ea0ee 100644 --- a/api/cast/cast.pb.validate.go +++ b/api/cast/cast.pb.validate.go @@ -1832,6 +1832,116 @@ var _ interface { ErrorName() string } = WorkDetailRespValidationError{} +// Validate checks the field values on UpdateStatusReq with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *UpdateStatusReq) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateStatusReq with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UpdateStatusReqMultiError, or nil if none found. +func (m *UpdateStatusReq) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateStatusReq) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for WorkAction + + // no validation rules for WorkUuid + + // no validation rules for ApprovalID + + // no validation rules for ConfirmRemark + + // no validation rules for ConfirmStatus + + if len(errors) > 0 { + return UpdateStatusReqMultiError(errors) + } + + return nil +} + +// UpdateStatusReqMultiError is an error wrapping multiple validation errors +// returned by UpdateStatusReq.ValidateAll() if the designated constraints +// aren't met. +type UpdateStatusReqMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateStatusReqMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UpdateStatusReqMultiError) AllErrors() []error { return m } + +// UpdateStatusReqValidationError is the validation error returned by +// UpdateStatusReq.Validate if the designated constraints aren't met. +type UpdateStatusReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateStatusReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateStatusReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateStatusReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateStatusReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateStatusReqValidationError) ErrorName() string { return "UpdateStatusReqValidationError" } + +// Error satisfies the builtin error interface +func (e UpdateStatusReqValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpdateStatusReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateStatusReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateStatusReqValidationError{} + // Validate checks the field values on MediaUserListResp_Info with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. diff --git a/api/cast/cast_triple.pb.go b/api/cast/cast_triple.pb.go index b9f7c34..787b81f 100644 --- a/api/cast/cast_triple.pb.go +++ b/api/cast/cast_triple.pb.go @@ -37,6 +37,7 @@ type CastClient interface { UpdateWorkVideo(ctx context.Context, in *UpdateWorkVideoReq, opts ...grpc_go.CallOption) (*UpdateWorkVideoResp, common.ErrorWithAttachment) WorkList(ctx context.Context, in *WorkListReq, opts ...grpc_go.CallOption) (*WorkListResp, common.ErrorWithAttachment) WorkDetail(ctx context.Context, in *WorkDetailReq, opts ...grpc_go.CallOption) (*WorkDetailResp, common.ErrorWithAttachment) + UpdateStatus(ctx context.Context, in *UpdateStatusReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) } type castClient struct { @@ -52,6 +53,7 @@ type CastClientImpl struct { UpdateWorkVideo func(ctx context.Context, in *UpdateWorkVideoReq) (*UpdateWorkVideoResp, error) WorkList func(ctx context.Context, in *WorkListReq) (*WorkListResp, error) WorkDetail func(ctx context.Context, in *WorkDetailReq) (*WorkDetailResp, error) + UpdateStatus func(ctx context.Context, in *UpdateStatusReq) (*emptypb.Empty, error) } func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient { @@ -114,6 +116,12 @@ func (c *castClient) WorkDetail(ctx context.Context, in *WorkDetailReq, opts ... return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkDetail", in, out) } +func (c *castClient) UpdateStatus(ctx context.Context, in *UpdateStatusReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) { + out := new(emptypb.Empty) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateStatus", in, out) +} + // CastServer is the server API for Cast service. // All implementations must embed UnimplementedCastServer // for forward compatibility @@ -126,6 +134,7 @@ type CastServer interface { UpdateWorkVideo(context.Context, *UpdateWorkVideoReq) (*UpdateWorkVideoResp, error) WorkList(context.Context, *WorkListReq) (*WorkListResp, error) WorkDetail(context.Context, *WorkDetailReq) (*WorkDetailResp, error) + UpdateStatus(context.Context, *UpdateStatusReq) (*emptypb.Empty, error) mustEmbedUnimplementedCastServer() } @@ -158,6 +167,9 @@ func (UnimplementedCastServer) WorkList(context.Context, *WorkListReq) (*WorkLis func (UnimplementedCastServer) WorkDetail(context.Context, *WorkDetailReq) (*WorkDetailResp, error) { return nil, status.Errorf(codes.Unimplemented, "method WorkDetail not implemented") } +func (UnimplementedCastServer) UpdateStatus(context.Context, *UpdateStatusReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateStatus not implemented") +} func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) { s.proxyImpl = impl } @@ -418,6 +430,35 @@ func _Cast_WorkDetail_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Cast_UpdateStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateStatusReq) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("UpdateStatus", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + // Cast_ServiceDesc is the grpc_go.ServiceDesc for Cast service. // It's only intended for direct use with grpc_go.RegisterService, // and not to be introspected or modified (even as a copy) @@ -457,6 +498,10 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{ MethodName: "WorkDetail", Handler: _Cast_WorkDetail_Handler, }, + { + MethodName: "UpdateStatus", + Handler: _Cast_UpdateStatus_Handler, + }, }, Streams: []grpc_go.StreamDesc{}, Metadata: "pb/fiee/cast.proto", diff --git a/pkg/router/media.go b/pkg/router/media.go index 124e8a4..a79e5ce 100644 --- a/pkg/router/media.go +++ b/pkg/router/media.go @@ -23,6 +23,7 @@ func MediaRouter(r *gin.RouterGroup) { { work.POST("update-work-image", serviceCast.UpdateWorkImage) work.POST("update-work-video", serviceCast.UpdateWorkVideo) + work.POST("update-approval", serviceCast.UpdateApproval) work.POST("list", serviceCast.WorkList) work.POST("detail", serviceCast.WorkDetail) } diff --git a/pkg/service/cast/work.go b/pkg/service/cast/work.go index 85cebfb..eddb1a9 100644 --- a/pkg/service/cast/work.go +++ b/pkg/service/cast/work.go @@ -80,6 +80,22 @@ func UpdateWorkVideo(ctx *gin.Context) { return } +func UpdateApproval(ctx *gin.Context) { + var req *cast.UpdateApprovalReq + var err error + if err = ctx.ShouldBind(&req); err != nil { + service.Error(ctx, err) + return + } + resp, err := service.CastProvider.UpdateApproval(ctx, req) + if err != nil { + service.Error(ctx, err) + return + } + service.Success(ctx, resp) + return +} + func WorkList(ctx *gin.Context) { var ( req *cast.WorkListReq From 129d3fafa1d5eedf93467424338b57622f636d86 Mon Sep 17 00:00:00 2001 From: daiyb <570956418@qq.com> Date: Fri, 13 Jun 2025 19:00:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=A1=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/config/config.go | 1 + docs/dev/conf.ini | 2 +- docs/prod/conf.ini | 2 +- docs/test/conf.ini | 2 +- pkg/model/cast/approval.go | 24 ++++++++++++++++++++++ pkg/service/cast/approval.go | 39 ++++++++++++++++++++++++++++++++++++ pkg/service/cast/work.go | 5 +++-- pkg/utils/http.go | 34 +++++++++++++++++++++++++++++++ 8 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 pkg/model/cast/approval.go create mode 100644 pkg/service/cast/approval.go create mode 100644 pkg/utils/http.go diff --git a/cmd/config/config.go b/cmd/config/config.go index 11d4629..16daf68 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -114,6 +114,7 @@ type System struct { HttpPort string Host string RedirectUri string + ErpHost string } type Oss struct { AccessKeyId string diff --git a/docs/dev/conf.ini b/docs/dev/conf.ini index 0761869..6e076bd 100644 --- a/docs/dev/conf.ini +++ b/docs/dev/conf.ini @@ -4,7 +4,7 @@ AppMode = "dev" HttpPort = ":8085" Host = "https://common.szjixun.cn" RedirectUri = "/api/redirect/url" - +ErpHost = "http://114.218.158.24:9020" [bos] Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe" Sk = "d2ecaa9d75114d3b9f42b99014198306" diff --git a/docs/prod/conf.ini b/docs/prod/conf.ini index bd00c95..0a9e81d 100644 --- a/docs/prod/conf.ini +++ b/docs/prod/conf.ini @@ -4,7 +4,7 @@ AppMode = "prod" HttpPort = ":8085" Host = "https://common.szjixun.cn" RedirectUri = "/api/redirect/url" - +ErpHost = "https://erpapi.fontree.cn" [bos] Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe" Sk = "d2ecaa9d75114d3b9f42b99014198306" diff --git a/docs/test/conf.ini b/docs/test/conf.ini index b6d7bc9..5fbd9bb 100644 --- a/docs/test/conf.ini +++ b/docs/test/conf.ini @@ -4,7 +4,7 @@ AppMode = "test" HttpPort = ":8085" Host = "https://common.szjixun.cn" RedirectUri = "/api/redirect/url" - +ErpHost = "http://114.218.158.24:9020" [bos] Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe" Sk = "d2ecaa9d75114d3b9f42b99014198306" diff --git a/pkg/model/cast/approval.go b/pkg/model/cast/approval.go new file mode 100644 index 0000000..3539ac4 --- /dev/null +++ b/pkg/model/cast/approval.go @@ -0,0 +1,24 @@ +package cast + +type ApprovalDetailResponse struct { + Status int `json:"status"` + Data Data `json:"data"` + Msg string `json:"msg"` + Code int `json:"code"` + Error *string `json:"error"` + Err string `json:"err"` + Keys []string `json:"keys"` + Positions *interface{} `json:"positions"` +} + +type Data struct { + Count int `json:"Count"` + Data []Item `json:"data"` + Status int `json:"Status"` +} + +type Item struct { + ID int `json:"ID"` + Domain string `json:"Domain"` + Status int `json:"Status"` +} diff --git a/pkg/service/cast/approval.go b/pkg/service/cast/approval.go new file mode 100644 index 0000000..06e3705 --- /dev/null +++ b/pkg/service/cast/approval.go @@ -0,0 +1,39 @@ +package cast + +import ( + "encoding/json" + "errors" + "fmt" + "fonchain-fiee/cmd/config" + "fonchain-fiee/pkg/e" + "fonchain-fiee/pkg/utils" + modelCast "fonchain-fiee/pkg/model/cast" +) + +type CastService struct { +} + +func (c *CastService) ApprovalDetail(approvalIds []int) (data map[int]int, err error) { + idsBytes, _ := json.Marshal(approvalIds) + var respBody string + url := fmt.Sprintf(config.AppConfig.System.ErpHost + "/approval/list/ex") + respBody, err = utils.Post(url, string(idsBytes)) + if err != nil { + return + } + var respDetail modelCast.ApprovalDetailResponse + if err = json.Unmarshal([]byte(respBody), &respDetail); err != nil { + err = errors.New(e.GetMsg(e.JsonUnmarshal)) + return + } + if respDetail.Status == 0 && len(respDetail.Data.Data) > 0 { + data = make(map[int]int, len(respDetail.Data.Data)) + for _, v := range respDetail.Data.Data { + data[v.ID] = v.Status + } + } else { + err = errors.New(e.GetMsg(e.ErrorHttp)) + return + } + return +} diff --git a/pkg/service/cast/work.go b/pkg/service/cast/work.go index eddb1a9..d6bca84 100644 --- a/pkg/service/cast/work.go +++ b/pkg/service/cast/work.go @@ -81,13 +81,14 @@ func UpdateWorkVideo(ctx *gin.Context) { } func UpdateApproval(ctx *gin.Context) { - var req *cast.UpdateApprovalReq + var req *cast.UpdateStatusReq var err error if err = ctx.ShouldBind(&req); err != nil { service.Error(ctx, err) return } - resp, err := service.CastProvider.UpdateApproval(ctx, req) + req.WorkAction = cast.WorkActionENUM_APPROVAL + resp, err := service.CastProvider.UpdateStatus(ctx, req) if err != nil { service.Error(ctx, err) return diff --git a/pkg/utils/http.go b/pkg/utils/http.go new file mode 100644 index 0000000..0ab8e10 --- /dev/null +++ b/pkg/utils/http.go @@ -0,0 +1,34 @@ +package utils + +import ( + "bytes" + "io/ioutil" + "net/http" +) + +func Post(url, data string) (string, error) { + reader := bytes.NewReader([]byte(data)) + + request, err := http.NewRequest("POST", url, reader) + if err != nil { + return "", err + } + defer request.Body.Close() //程序在使用完回复后必须关闭回复的主体 + request.Header.Set("Content-Type", "application/json;charset=UTF-8") + //必须设定该参数,POST参数才能正常提交,意思是以json串提交数据 + + client := http.Client{} + resp, err := client.Do(request) //Do 方法发送请求,返回 HTTP 回复 + if err != nil { + return "", err + } + + respBytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return "", err + } + + //byte数组直接转成string,优化内存 + // str := (*string)(unsafe.Pointer(&respBytes)) + return string(respBytes), nil +}