添加作品记录和详情接口

This commit is contained in:
lzh 2025-06-14 13:52:51 +08:00
parent bef40ad0f1
commit ae7b87aa17
5 changed files with 1518 additions and 288 deletions

File diff suppressed because it is too large Load Diff

View File

@ -743,7 +743,34 @@ func (m *UpdateWorkImageReq) validate(all bool) error {
// no validation rules for Content
// no validation rules for ForbidComment
if all {
switch v := interface{}(m.GetPublishConfig()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, UpdateWorkImageReqValidationError{
field: "PublishConfig",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, UpdateWorkImageReqValidationError{
field: "PublishConfig",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetPublishConfig()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return UpdateWorkImageReqValidationError{
field: "PublishConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
// no validation rules for Action
@ -753,6 +780,8 @@ func (m *UpdateWorkImageReq) validate(all bool) error {
// no validation rules for ArtistPhone
// no validation rules for ArtistName
if len(errors) > 0 {
return UpdateWorkImageReqMultiError(errors)
}
@ -937,6 +966,118 @@ var _ interface {
ErrorName() string
} = UpdateWorkImageRespValidationError{}
// Validate checks the field values on PublishConfig 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 *PublishConfig) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on PublishConfig 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 PublishConfigMultiError, or
// nil if none found.
func (m *PublishConfig) ValidateAll() error {
return m.validate(true)
}
func (m *PublishConfig) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for ForbidComment
// no validation rules for PublicType
// no validation rules for CanJoin
// no validation rules for CanQuote
// no validation rules for CanComment
// no validation rules for IsAI
if len(errors) > 0 {
return PublishConfigMultiError(errors)
}
return nil
}
// PublishConfigMultiError is an error wrapping multiple validation errors
// returned by PublishConfig.ValidateAll() if the designated constraints
// aren't met.
type PublishConfigMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PublishConfigMultiError) 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 PublishConfigMultiError) AllErrors() []error { return m }
// PublishConfigValidationError is the validation error returned by
// PublishConfig.Validate if the designated constraints aren't met.
type PublishConfigValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PublishConfigValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PublishConfigValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PublishConfigValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PublishConfigValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PublishConfigValidationError) ErrorName() string { return "PublishConfigValidationError" }
// Error satisfies the builtin error interface
func (e PublishConfigValidationError) 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 %sPublishConfig.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PublishConfigValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PublishConfigValidationError{}
// Validate checks the field values on UpdateWorkVideoReq 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.
@ -967,7 +1108,34 @@ func (m *UpdateWorkVideoReq) validate(all bool) error {
// no validation rules for CoverUrl
// no validation rules for PublicConfig
if all {
switch v := interface{}(m.GetPublishConfig()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, UpdateWorkVideoReqValidationError{
field: "PublishConfig",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, UpdateWorkVideoReqValidationError{
field: "PublishConfig",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetPublishConfig()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return UpdateWorkVideoReqValidationError{
field: "PublishConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
// no validation rules for Action
@ -977,6 +1145,8 @@ func (m *UpdateWorkVideoReq) validate(all bool) error {
// no validation rules for ArtistPhone
// no validation rules for ArtistName
if len(errors) > 0 {
return UpdateWorkVideoReqMultiError(errors)
}
@ -1187,6 +1357,20 @@ func (m *WorkListReq) validate(all bool) error {
// no validation rules for PlatformID
// no validation rules for WorkCategory
// no validation rules for SubmitStartTime
// no validation rules for SubmitEndTime
// no validation rules for StatusUpdateTimeStart
// no validation rules for StatusUpdateTimeEnd
// no validation rules for Title
// no validation rules for WorkStatus
// no validation rules for Page
// no validation rules for PageSize
@ -1403,6 +1587,361 @@ var _ interface {
ErrorName() string
} = WorkListRespValidationError{}
// Validate checks the field values on WorkDetailReq 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 *WorkDetailReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on WorkDetailReq 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 WorkDetailReqMultiError, or
// nil if none found.
func (m *WorkDetailReq) ValidateAll() error {
return m.validate(true)
}
func (m *WorkDetailReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for WorkUuid
if len(errors) > 0 {
return WorkDetailReqMultiError(errors)
}
return nil
}
// WorkDetailReqMultiError is an error wrapping multiple validation errors
// returned by WorkDetailReq.ValidateAll() if the designated constraints
// aren't met.
type WorkDetailReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m WorkDetailReqMultiError) 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 WorkDetailReqMultiError) AllErrors() []error { return m }
// WorkDetailReqValidationError is the validation error returned by
// WorkDetailReq.Validate if the designated constraints aren't met.
type WorkDetailReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e WorkDetailReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e WorkDetailReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e WorkDetailReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e WorkDetailReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e WorkDetailReqValidationError) ErrorName() string { return "WorkDetailReqValidationError" }
// Error satisfies the builtin error interface
func (e WorkDetailReqValidationError) 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 %sWorkDetailReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = WorkDetailReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = WorkDetailReqValidationError{}
// Validate checks the field values on WorkDetailResp 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 *WorkDetailResp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on WorkDetailResp 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 WorkDetailRespMultiError,
// or nil if none found.
func (m *WorkDetailResp) ValidateAll() error {
return m.validate(true)
}
func (m *WorkDetailResp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for WorkUuid
// no validation rules for Title
// no validation rules for Content
// no validation rules for WorkStatus
if all {
switch v := interface{}(m.GetPublishConfig()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, WorkDetailRespValidationError{
field: "PublishConfig",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, WorkDetailRespValidationError{
field: "PublishConfig",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetPublishConfig()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WorkDetailRespValidationError{
field: "PublishConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
// no validation rules for VideoUrl
// no validation rules for CoverUrl
// no validation rules for ApprovalID
if len(errors) > 0 {
return WorkDetailRespMultiError(errors)
}
return nil
}
// WorkDetailRespMultiError is an error wrapping multiple validation errors
// returned by WorkDetailResp.ValidateAll() if the designated constraints
// aren't met.
type WorkDetailRespMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m WorkDetailRespMultiError) 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 WorkDetailRespMultiError) AllErrors() []error { return m }
// WorkDetailRespValidationError is the validation error returned by
// WorkDetailResp.Validate if the designated constraints aren't met.
type WorkDetailRespValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e WorkDetailRespValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e WorkDetailRespValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e WorkDetailRespValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e WorkDetailRespValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e WorkDetailRespValidationError) ErrorName() string { return "WorkDetailRespValidationError" }
// Error satisfies the builtin error interface
func (e WorkDetailRespValidationError) 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 %sWorkDetailResp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = WorkDetailRespValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
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.
@ -1543,26 +2082,20 @@ func (m *WorkListResp_Info) validate(all bool) error {
// no validation rules for WorkUuid
// no validation rules for ArtistName
// no validation rules for ArtistPhone
// no validation rules for Title
// no validation rules for Content
// no validation rules for WorkCategory
// no validation rules for WorkUrl
// no validation rules for WorkCover
// no validation rules for WorkStatus
// no validation rules for SubmitTime
// no validation rules for StatusUpdateTime
// no validation rules for ArtistName
// no validation rules for ArtistPhone
if len(errors) > 0 {
return WorkListResp_InfoMultiError(errors)
}

View File

@ -36,6 +36,8 @@ type CastClient interface {
UpdateWorkImage(ctx context.Context, in *UpdateWorkImageReq, opts ...grpc_go.CallOption) (*UpdateWorkImageResp, common.ErrorWithAttachment)
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 {
@ -50,6 +52,8 @@ type CastClientImpl struct {
UpdateWorkImage func(ctx context.Context, in *UpdateWorkImageReq) (*UpdateWorkImageResp, error)
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 {
@ -106,6 +110,18 @@ func (c *castClient) WorkList(ctx context.Context, in *WorkListReq, opts ...grpc
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkList", in, out)
}
func (c *castClient) WorkDetail(ctx context.Context, in *WorkDetailReq, opts ...grpc_go.CallOption) (*WorkDetailResp, common.ErrorWithAttachment) {
out := new(WorkDetailResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
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
@ -117,6 +133,8 @@ type CastServer interface {
UpdateWorkImage(context.Context, *UpdateWorkImageReq) (*UpdateWorkImageResp, error)
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()
}
@ -146,6 +164,12 @@ func (UnimplementedCastServer) UpdateWorkVideo(context.Context, *UpdateWorkVideo
func (UnimplementedCastServer) WorkList(context.Context, *WorkListReq) (*WorkListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method WorkList not implemented")
}
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
}
@ -377,6 +401,64 @@ func _Cast_WorkList_Handler(srv interface{}, ctx context.Context, dec func(inter
return interceptor(ctx, in, info, handler)
}
func _Cast_WorkDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(WorkDetailReq)
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("WorkDetail", 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)
}
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)
@ -412,6 +494,14 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "WorkList",
Handler: _Cast_WorkList_Handler,
},
{
MethodName: "WorkDetail",
Handler: _Cast_WorkDetail_Handler,
},
{
MethodName: "UpdateStatus",
Handler: _Cast_UpdateStatus_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "pb/fiee/cast.proto",

View File

@ -34,8 +34,11 @@ func BundleRouter(r *gin.RouterGroup) {
bundleExtend.POST("list", bundle.BundleExtendRecordsList)
}
bundleBalance := bundleRoute.Group("balance")
bundleBalance.POST("", bundle.GetBundleBalance)
bundleBalance.POST("used-record", bundle.GetUsedRecordList)
{
bundleBalance.POST("", bundle.GetBundleBalance)
bundleBalance.POST("used-record", bundle.GetUsedRecordList)
bundleBalance.POST("image-detail", bundle.GetWorkDetail)
}
}

View File

@ -3,6 +3,7 @@ package bundle
import (
"context"
"fonchain-fiee/api/bundle"
"fonchain-fiee/api/cast"
"fonchain-fiee/pkg/service"
"github.com/gin-gonic/gin"
@ -64,3 +65,16 @@ func GetUsedRecordList(c *gin.Context) {
service.Success(c, res)
}
func GetWorkDetail(c *gin.Context) {
var req cast.WorkDetailReq
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, err)
return
}
res, err := service.CastProvider.WorkDetail(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
}