Updata:移动余量更新定时任务至客户端

This commit is contained in:
jiaji.H 2026-01-12 13:37:30 +08:00
parent 68de32f89d
commit 4c8db9bec8
4 changed files with 3504 additions and 3333 deletions

File diff suppressed because it is too large Load Diff

View File

@ -365,6 +365,12 @@ func (this *BatchGetValueAddServiceLangResponse) Validate() error {
}
return nil
}
func (this *UpdateBundleBalanceReq) Validate() error {
return nil
}
func (this *UpdateBundleBalanceResp) Validate() error {
return nil
}
func (this *BundleExtendRequest) Validate() error {
return nil
}

View File

@ -64,6 +64,7 @@ type BundleClient interface {
BatchGetValueAddServiceLang(ctx context.Context, in *BatchGetValueAddServiceLangRequest, opts ...grpc_go.CallOption) (*BatchGetValueAddServiceLangResponse, common.ErrorWithAttachment)
DeleteValueAddService(ctx context.Context, in *DeleteValueAddServiceRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
// 余量管理
UpdateBundleBalance(ctx context.Context, in *UpdateBundleBalanceReq, opts ...grpc_go.CallOption) (*UpdateBundleBalanceResp, 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)
GetBundleBalanceList(ctx context.Context, in *GetBundleBalanceListReq, opts ...grpc_go.CallOption) (*GetBundleBalanceListResp, common.ErrorWithAttachment)
@ -159,6 +160,7 @@ type BundleClientImpl struct {
CalculatePrice func(ctx context.Context, in *CalculatePriceRequest) (*CalculatePriceResponse, error)
BatchGetValueAddServiceLang func(ctx context.Context, in *BatchGetValueAddServiceLangRequest) (*BatchGetValueAddServiceLangResponse, error)
DeleteValueAddService func(ctx context.Context, in *DeleteValueAddServiceRequest) (*CommonResponse, error)
UpdateBundleBalance func(ctx context.Context, in *UpdateBundleBalanceReq) (*UpdateBundleBalanceResp, error)
BundleExtend func(ctx context.Context, in *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList func(ctx context.Context, in *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
GetBundleBalanceList func(ctx context.Context, in *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
@ -421,6 +423,12 @@ func (c *bundleClient) DeleteValueAddService(ctx context.Context, in *DeleteValu
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/DeleteValueAddService", in, out)
}
func (c *bundleClient) UpdateBundleBalance(ctx context.Context, in *UpdateBundleBalanceReq, opts ...grpc_go.CallOption) (*UpdateBundleBalanceResp, common.ErrorWithAttachment) {
out := new(UpdateBundleBalanceResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateBundleBalance", in, out)
}
func (c *bundleClient) BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment) {
out := new(BundleExtendResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -761,6 +769,7 @@ type BundleServer interface {
BatchGetValueAddServiceLang(context.Context, *BatchGetValueAddServiceLangRequest) (*BatchGetValueAddServiceLangResponse, error)
DeleteValueAddService(context.Context, *DeleteValueAddServiceRequest) (*CommonResponse, error)
// 余量管理
UpdateBundleBalance(context.Context, *UpdateBundleBalanceReq) (*UpdateBundleBalanceResp, error)
BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
GetBundleBalanceList(context.Context, *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
@ -923,6 +932,9 @@ func (UnimplementedBundleServer) BatchGetValueAddServiceLang(context.Context, *B
func (UnimplementedBundleServer) DeleteValueAddService(context.Context, *DeleteValueAddServiceRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteValueAddService not implemented")
}
func (UnimplementedBundleServer) UpdateBundleBalance(context.Context, *UpdateBundleBalanceReq) (*UpdateBundleBalanceResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateBundleBalance not implemented")
}
func (UnimplementedBundleServer) BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BundleExtend not implemented")
}
@ -2058,6 +2070,35 @@ func _Bundle_DeleteValueAddService_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _Bundle_UpdateBundleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateBundleBalanceReq)
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("UpdateBundleBalance", 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_BundleExtend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BundleExtendRequest)
if err := dec(in); err != nil {
@ -3647,6 +3688,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "DeleteValueAddService",
Handler: _Bundle_DeleteValueAddService_Handler,
},
{
MethodName: "UpdateBundleBalance",
Handler: _Bundle_UpdateBundleBalance_Handler,
},
{
MethodName: "BundleExtend",
Handler: _Bundle_BundleExtend_Handler,

View File

@ -34,6 +34,9 @@ func InitTasks() error {
err = cm.AddTask("refreshWorkAnalysisApprovalStatus", "0 */1 * * * *", RefreshWorkAnalysisApprovalStatusTask)
err = cm.AddTask("refreshArtistOrder", "0 */30 * * * *", RefreshArtistOrderTask)
//余量表每月1号更新定时任务
err = cm.AddTask("updateBundleBalance", "0 0 0 1 * *", UpdateBundleBalance)
// 每天 00:30 和 12:30 执行 Ayrshare 指标采集任务
// err = cm.AddTask("ayrshareMetricsCollector", "0 30 0,12 * * *", AyrshareMetricsCollectorTask)
err = cm.AddTask("ayrshareMetricsCollector", "0 30 0 * * *", AyrshareMetricsCollectorTask)
@ -500,6 +503,10 @@ func ArtistAutoConfirmAnalysisTask() {
}
}
func UpdateBundleBalance() {
service.BundleProvider.UpdateBundleBalance(context.Background(), &bundle.UpdateBundleBalanceReq{})
}
// AyrshareMetricsCollectorTask Ayrshare 指标采集定时任务(每天 00:30 和 12:30 执行)
func AyrshareMetricsCollectorTask() {
serverCast.ExecuteAyrshareMetricsCollector()