Updata:更新增加获取

This commit is contained in:
jiaji.H 2025-12-16 15:59:45 +08:00
parent 28f5055895
commit e08bdb3937
6 changed files with 2357 additions and 2029 deletions

View File

@ -501,23 +501,26 @@ func ToBeComfirmedWorks(req *bundle.ToBeComfirmedWorksReq) (data []model.CastWor
unConfirmSubQuery := app.ModuleClients.BundleDB.
Table("cast_work_log").
Select("work_uuid, MAX(update_time) AS max_update_time").
Where("cast_work_log.deleted_at = 0").
Group("work_uuid").Where("work_status = ?", 4)
err = app.ModuleClients.BundleDB.
Table("cast_work_log AS cwl").
Joins("INNER JOIN (?) AS t ON cwl.work_uuid = t.work_uuid AND cwl.update_time = t.max_update_time", unConfirmSubQuery).
Where("artist_uuid = ?", req.ArtistUuid).Where("confirmed_at = ?", 0).Count(&unconfirmed).Error
Where("artist_uuid = ?", req.ArtistUuid).Where("cwl.deleted_at = 0").Where("confirmed_at = ?", 0).Count(&unconfirmed).Error
if err != nil {
return
}
subQuery := app.ModuleClients.BundleDB.
Table("cast_work_log").
Select("work_uuid, MAX(update_time) AS max_update_time").
Group("work_uuid").Where("work_status in ?", []int{4, 5, 6, 7})
Where("cast_work_log.deleted_at = 0").
Group("work_uuid").Where("work_status in ?", []int{4, 5, 6, 7, 9})
session := app.ModuleClients.BundleDB.
Table("cast_work_log AS cwl").
Joins("INNER JOIN (?) AS t ON cwl.work_uuid = t.work_uuid AND cwl.update_time = t.max_update_time", subQuery).
Where("artist_uuid = ?", req.ArtistUuid)
Where("artist_uuid = ?", req.ArtistUuid).
Where("cwl.deleted_at = 0")
err = session.Count(&total).Error
if err != nil {
return
@ -533,6 +536,15 @@ func ConfirmWork(req *bundle.ConfirmWorkReq) error {
return app.ModuleClients.BundleDB.Model(&model.CastWorkLog{}).Where(&model.CastWorkLog{WorkUuid: req.WorkUuid}).Update("confirmed_at", time.Now().Unix()).Error
}
func GetWaitConfirmWorkList() (data []model.CastWork, err error) {
err = app.ModuleClients.BundleDB.Model(&model.CastWork{}).
Where("deleted_at = 0").
Where("status = ?", 4).
Order("submit_time desc").
Find(&data).Error
return
}
func BundleActivate(ids []uint32) error {
for _, v := range ids {
app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {

View File

@ -447,6 +447,24 @@ func ConfirmWork(req *bundle.ConfirmWorkReq) (*bundle.ConfirmWorkResp, error) {
return nil, dao.ConfirmWork(req)
}
func GetWaitConfirmWorkList() (*bundle.GetWaitConfirmWorkListResp, error) {
data, err := dao.GetWaitConfirmWorkList()
if err != nil {
logger.Error(err)
return nil, errors.New("查询失败")
}
result := &bundle.GetWaitConfirmWorkListResp{}
result.Data = lo.Map(data, func(m model.CastWork, _ int) *bundle.ConfirmWorkItem {
return &bundle.ConfirmWorkItem{
WorkUuid: m.Uuid,
WorkCategory: int32(m.WorkCategory),
ArtistName: m.ArtistName,
ArtistUuid: m.ArtistUuid,
}
})
return result, nil
}
func BundleActivate(req *bundle.BundleActivateReq) error {
return dao.BundleActivate(req.Ids)
}

View File

@ -72,6 +72,7 @@ service Bundle {
rpc ToBeComfirmedWorks(ToBeComfirmedWorksReq) returns (ToBeComfirmedWorksResp) {} //
rpc ConfirmWork(ConfirmWorkReq) returns (ConfirmWorkResp) {} //
rpc GetWaitConfirmWorkList(GetWaitConfirmWorkListReq) returns (GetWaitConfirmWorkListResp) {} //
//
rpc GetReconciliationList(GetReconciliationListReq) returns (GetReconciliationListResp) {} //
@ -1035,6 +1036,8 @@ message ToBeComfirmedWorksResp{
repeated workItem data = 3;
}
message GetBundleBalanceByUserIdReq{
int32 userId = 1;
}
@ -1093,6 +1096,20 @@ message ConfirmWorkResp{
}
message ConfirmWorkItem{
string workUuid = 1;
string artistName = 2;
string artistUuid = 3;
int32 workCategory = 4;
}
message GetWaitConfirmWorkListReq{}
message GetWaitConfirmWorkListResp{
repeated ConfirmWorkItem data = 1;
}
message AutoCreateUserAndOrderRequest {
int32 num = 1; //
}

File diff suppressed because it is too large Load Diff

View File

@ -483,6 +483,22 @@ func (this *ConfirmWorkReq) Validate() error {
func (this *ConfirmWorkResp) Validate() error {
return nil
}
func (this *ConfirmWorkItem) Validate() error {
return nil
}
func (this *GetWaitConfirmWorkListReq) Validate() error {
return nil
}
func (this *GetWaitConfirmWorkListResp) 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 *AutoCreateUserAndOrderRequest) Validate() error {
return nil
}

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.21.1
// - protoc-gen-go-triple v1.0.5
// - protoc v5.26.0
// source: pb/bundle.proto
package bundle
@ -79,6 +79,7 @@ type BundleClient interface {
GetVedioWorkDetail(ctx context.Context, in *GetVedioWorkDetailReq, opts ...grpc_go.CallOption) (*GetVedioeWorkDetailResp, common.ErrorWithAttachment)
ToBeComfirmedWorks(ctx context.Context, in *ToBeComfirmedWorksReq, opts ...grpc_go.CallOption) (*ToBeComfirmedWorksResp, common.ErrorWithAttachment)
ConfirmWork(ctx context.Context, in *ConfirmWorkReq, opts ...grpc_go.CallOption) (*ConfirmWorkResp, common.ErrorWithAttachment)
GetWaitConfirmWorkList(ctx context.Context, in *GetWaitConfirmWorkListReq, opts ...grpc_go.CallOption) (*GetWaitConfirmWorkListResp, common.ErrorWithAttachment)
// 对账单
GetReconciliationList(ctx context.Context, in *GetReconciliationListReq, opts ...grpc_go.CallOption) (*GetReconciliationListResp, common.ErrorWithAttachment)
CreateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
@ -169,6 +170,7 @@ type BundleClientImpl struct {
GetVedioWorkDetail func(ctx context.Context, in *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
ToBeComfirmedWorks func(ctx context.Context, in *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
ConfirmWork func(ctx context.Context, in *ConfirmWorkReq) (*ConfirmWorkResp, error)
GetWaitConfirmWorkList func(ctx context.Context, in *GetWaitConfirmWorkListReq) (*GetWaitConfirmWorkListResp, error)
GetReconciliationList func(ctx context.Context, in *GetReconciliationListReq) (*GetReconciliationListResp, error)
CreateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
@ -497,6 +499,12 @@ func (c *bundleClient) ConfirmWork(ctx context.Context, in *ConfirmWorkReq, opts
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ConfirmWork", in, out)
}
func (c *bundleClient) GetWaitConfirmWorkList(ctx context.Context, in *GetWaitConfirmWorkListReq, opts ...grpc_go.CallOption) (*GetWaitConfirmWorkListResp, common.ErrorWithAttachment) {
out := new(GetWaitConfirmWorkListResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetWaitConfirmWorkList", in, out)
}
func (c *bundleClient) GetReconciliationList(ctx context.Context, in *GetReconciliationListReq, opts ...grpc_go.CallOption) (*GetReconciliationListResp, common.ErrorWithAttachment) {
out := new(GetReconciliationListResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -744,6 +752,7 @@ type BundleServer interface {
GetVedioWorkDetail(context.Context, *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
ToBeComfirmedWorks(context.Context, *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
ConfirmWork(context.Context, *ConfirmWorkReq) (*ConfirmWorkResp, error)
GetWaitConfirmWorkList(context.Context, *GetWaitConfirmWorkListReq) (*GetWaitConfirmWorkListResp, error)
// 对账单
GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error)
CreateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
@ -929,6 +938,9 @@ func (UnimplementedBundleServer) ToBeComfirmedWorks(context.Context, *ToBeComfir
func (UnimplementedBundleServer) ConfirmWork(context.Context, *ConfirmWorkReq) (*ConfirmWorkResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ConfirmWork not implemented")
}
func (UnimplementedBundleServer) GetWaitConfirmWorkList(context.Context, *GetWaitConfirmWorkListReq) (*GetWaitConfirmWorkListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetWaitConfirmWorkList not implemented")
}
func (UnimplementedBundleServer) GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetReconciliationList not implemented")
}
@ -2416,6 +2428,35 @@ func _Bundle_ConfirmWork_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler)
}
func _Bundle_GetWaitConfirmWorkList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWaitConfirmWorkListReq)
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("GetWaitConfirmWorkList", 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_GetReconciliationList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetReconciliationListReq)
if err := dec(in); err != nil {
@ -3539,6 +3580,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "ConfirmWork",
Handler: _Bundle_ConfirmWork_Handler,
},
{
MethodName: "GetWaitConfirmWorkList",
Handler: _Bundle_GetWaitConfirmWorkList_Handler,
},
{
MethodName: "GetReconciliationList",
Handler: _Bundle_GetReconciliationList_Handler,