添加待确认作品详情查看

This commit is contained in:
lzh 2025-06-14 17:13:30 +08:00
parent 625ed25b67
commit f2277fa337
5 changed files with 769 additions and 591 deletions

File diff suppressed because it is too large Load Diff

View File

@ -302,16 +302,6 @@ func (this *GetBundleBalanceReq) Validate() error {
func (this *BundleBalanceItem) Validate() error { func (this *BundleBalanceItem) Validate() error {
return nil return nil
} }
func (this *GetBundleBalanceResp) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}
func (this *GetBundleBalanceListResp) Validate() error { func (this *GetBundleBalanceListResp) Validate() error {
for _, item := range this.Data { for _, item := range this.Data {
if item != nil { if item != nil {
@ -365,6 +355,19 @@ func (this *GetVedioeWorkDetailResp) Validate() error {
func (this *ToBeComfirmedWorksReq) Validate() error { func (this *ToBeComfirmedWorksReq) Validate() error {
return nil return nil
} }
func (this *ToBeComfirmedWorksResp) Validate() error { func (this *WorkItem) Validate() error {
return nil
}
func (this *ToBeComfirmedWorksResp) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}
func (this *GetBundleBalanceByUserIdReq) Validate() error {
return nil return nil
} }

View File

@ -60,6 +60,7 @@ type BundleClient interface {
BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment) BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment)
BundleExtendRecordsList(ctx context.Context, in *BundleExtendRecordsListRequest, opts ...grpc_go.CallOption) (*BundleExtendRecordsListResponse, common.ErrorWithAttachment) BundleExtendRecordsList(ctx context.Context, in *BundleExtendRecordsListRequest, opts ...grpc_go.CallOption) (*BundleExtendRecordsListResponse, common.ErrorWithAttachment)
GetBundleBalanceList(ctx context.Context, in *GetBundleBalanceListReq, opts ...grpc_go.CallOption) (*GetBundleBalanceListResp, common.ErrorWithAttachment) GetBundleBalanceList(ctx context.Context, in *GetBundleBalanceListReq, opts ...grpc_go.CallOption) (*GetBundleBalanceListResp, common.ErrorWithAttachment)
GetBundleBalanceByUserId(ctx context.Context, in *GetBundleBalanceByUserIdReq, opts ...grpc_go.CallOption) (*BundleBalanceItem, common.ErrorWithAttachment)
CreateBundleBalance(ctx context.Context, in *CreateBundleBalanceReq, opts ...grpc_go.CallOption) (*CreateBundleBalanceResp, common.ErrorWithAttachment) CreateBundleBalance(ctx context.Context, in *CreateBundleBalanceReq, opts ...grpc_go.CallOption) (*CreateBundleBalanceResp, common.ErrorWithAttachment)
AddBundleBalance(ctx context.Context, in *AddBundleBalanceReq, opts ...grpc_go.CallOption) (*AddBundleBalanceResp, common.ErrorWithAttachment) AddBundleBalance(ctx context.Context, in *AddBundleBalanceReq, opts ...grpc_go.CallOption) (*AddBundleBalanceResp, common.ErrorWithAttachment)
// 使用记录 // 使用记录
@ -103,6 +104,7 @@ type BundleClientImpl struct {
BundleExtend func(ctx context.Context, in *BundleExtendRequest) (*BundleExtendResponse, error) BundleExtend func(ctx context.Context, in *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList func(ctx context.Context, in *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error) BundleExtendRecordsList func(ctx context.Context, in *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
GetBundleBalanceList func(ctx context.Context, in *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error) GetBundleBalanceList func(ctx context.Context, in *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
GetBundleBalanceByUserId func(ctx context.Context, in *GetBundleBalanceByUserIdReq) (*BundleBalanceItem, error)
CreateBundleBalance func(ctx context.Context, in *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error) CreateBundleBalance func(ctx context.Context, in *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
AddBundleBalance func(ctx context.Context, in *AddBundleBalanceReq) (*AddBundleBalanceResp, error) AddBundleBalance func(ctx context.Context, in *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
GetUsedRecordList func(ctx context.Context, in *GetUsedRecordListReq) (*GetUsedRecordListResp, error) GetUsedRecordList func(ctx context.Context, in *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
@ -297,6 +299,12 @@ func (c *bundleClient) GetBundleBalanceList(ctx context.Context, in *GetBundleBa
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetBundleBalanceList", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetBundleBalanceList", in, out)
} }
func (c *bundleClient) GetBundleBalanceByUserId(ctx context.Context, in *GetBundleBalanceByUserIdReq, opts ...grpc_go.CallOption) (*BundleBalanceItem, common.ErrorWithAttachment) {
out := new(BundleBalanceItem)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetBundleBalanceByUserId", in, out)
}
func (c *bundleClient) CreateBundleBalance(ctx context.Context, in *CreateBundleBalanceReq, opts ...grpc_go.CallOption) (*CreateBundleBalanceResp, common.ErrorWithAttachment) { func (c *bundleClient) CreateBundleBalance(ctx context.Context, in *CreateBundleBalanceReq, opts ...grpc_go.CallOption) (*CreateBundleBalanceResp, common.ErrorWithAttachment) {
out := new(CreateBundleBalanceResp) out := new(CreateBundleBalanceResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string) interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -369,6 +377,7 @@ type BundleServer interface {
BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error) BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error) BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
GetBundleBalanceList(context.Context, *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error) GetBundleBalanceList(context.Context, *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
GetBundleBalanceByUserId(context.Context, *GetBundleBalanceByUserIdReq) (*BundleBalanceItem, error)
CreateBundleBalance(context.Context, *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error) CreateBundleBalance(context.Context, *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
AddBundleBalance(context.Context, *AddBundleBalanceReq) (*AddBundleBalanceResp, error) AddBundleBalance(context.Context, *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
// 使用记录 // 使用记录
@ -471,6 +480,9 @@ func (UnimplementedBundleServer) BundleExtendRecordsList(context.Context, *Bundl
func (UnimplementedBundleServer) GetBundleBalanceList(context.Context, *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error) { func (UnimplementedBundleServer) GetBundleBalanceList(context.Context, *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBundleBalanceList not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetBundleBalanceList not implemented")
} }
func (UnimplementedBundleServer) GetBundleBalanceByUserId(context.Context, *GetBundleBalanceByUserIdReq) (*BundleBalanceItem, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBundleBalanceByUserId not implemented")
}
func (UnimplementedBundleServer) CreateBundleBalance(context.Context, *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error) { func (UnimplementedBundleServer) CreateBundleBalance(context.Context, *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateBundleBalance not implemented") return nil, status.Errorf(codes.Unimplemented, "method CreateBundleBalance not implemented")
} }
@ -1358,6 +1370,35 @@ func _Bundle_GetBundleBalanceList_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Bundle_GetBundleBalanceByUserId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBundleBalanceByUserIdReq)
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("GetBundleBalanceByUserId", 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 _Bundle_CreateBundleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { func _Bundle_CreateBundleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateBundleBalanceReq) in := new(CreateBundleBalanceReq)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -1655,6 +1696,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "GetBundleBalanceList", MethodName: "GetBundleBalanceList",
Handler: _Bundle_GetBundleBalanceList_Handler, Handler: _Bundle_GetBundleBalanceList_Handler,
}, },
{
MethodName: "GetBundleBalanceByUserId",
Handler: _Bundle_GetBundleBalanceByUserId_Handler,
},
{ {
MethodName: "CreateBundleBalance", MethodName: "CreateBundleBalance",
Handler: _Bundle_CreateBundleBalance_Handler, Handler: _Bundle_CreateBundleBalance_Handler,

View File

@ -37,9 +37,10 @@ func BundleRouter(r *gin.RouterGroup) {
{ {
bundleBalance.POST("", bundle.GetBundleBalance) bundleBalance.POST("", bundle.GetBundleBalance)
bundleBalance.POST("used-record", bundle.GetUsedRecordList) bundleBalance.POST("used-record", bundle.GetUsedRecordList)
bundleBalance.POST("image-detail", bundle.GetWorkDetail)
} }
bundleAppRoute.POST("pending-confirmation", bundle.GetToBeComfirmedWorks)
bundleAppRoute.POST("confirm", bundle.GetToBeComfirmedWorks)
bundleAppRoute.POST("confirm/work-detail", bundle.GetWorkDetail)
} }
} }

View File

@ -4,7 +4,9 @@ import (
"context" "context"
"fonchain-fiee/api/bundle" "fonchain-fiee/api/bundle"
"fonchain-fiee/api/cast" "fonchain-fiee/api/cast"
"fonchain-fiee/pkg/model/login"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -71,7 +73,54 @@ func GetWorkDetail(c *gin.Context) {
service.Error(c, err) service.Error(c, err)
return return
} }
res, err := service.CastProvider.WorkDetail(context.Background(), &req) userInfo := login.GetUserInfoFromC(c)
res, err := service.BundleProvider.GetBundleBalanceByUserId(context.TODO(), &bundle.GetBundleBalanceByUserIdReq{
UserId: int32(userInfo.ID),
})
if err != nil {
service.Error(c, err)
return
}
if res.ExpiredTime <= time.Now().UnixMilli() {
service.Success(c, gin.H{
"status": 1,
"message": "套餐过期请重新购买",
})
return
}
workRes, err := service.CastProvider.WorkDetail(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
if len(workRes.Images) > 0 && res.ImageConsumptionNumber >= res.ImageNumber { // 图片用尽
service.Success(c, gin.H{
"status": 2,
"message": "增值服务已用尽",
})
return
} else {
if res.VideoConsumptionNumber >= res.VideoNumber { // 视频用尽
service.Success(c, gin.H{
"status": 2,
"message": "增值服务已用尽",
})
return
}
}
service.Success(c, workRes)
}
func GetToBeComfirmedWorks(c *gin.Context) {
var req bundle.ToBeComfirmedWorksReq
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, err)
return
}
res, err := service.BundleProvider.ToBeComfirmedWorks(context.Background(), &req)
if err != nil { if err != nil {
service.Error(c, err) service.Error(c, err)
return return