Updata:调整余量更新定时任务至客户端

This commit is contained in:
jiaji.H 2026-01-12 13:28:47 +08:00
parent 7ac61c197c
commit c4ec01846f
6 changed files with 3521 additions and 3335 deletions

View File

@ -2,6 +2,7 @@ package controller
import (
"context"
"errors"
"micro-bundle/internal/logic"
"micro-bundle/pb/bundle"
)
@ -84,3 +85,13 @@ func (b *BundleProvider) GetBundleBalanceLayout(_ context.Context, req *bundle.G
func (b *BundleProvider) SetBundleBalanceLayout(_ context.Context, req *bundle.SetBundleBalanceLayoutReq) (*bundle.SetBundleBalanceLayoutResp, error) {
return logic.SetBundleBalanceLayout(req)
}
// 更新余量表数据
func (b *BundleProvider) UpdateBundleBalance(_ context.Context, req *bundle.UpdateBundleBalanceReq) (*bundle.UpdateBundleBalanceResp, error) {
var resp bundle.UpdateBundleBalanceResp
err := logic.UpdateBundleBalance()
if err != nil {
return nil, errors.New("更新余量表数据失败")
}
return &resp, nil
}

View File

@ -485,8 +485,12 @@ func BundleActivate(req *bundle.BundleActivateReq) error {
return dao.BundleActivate(req.Ids)
}
func UpdateBundleBalance() {
dao.UpdateBundleBalance()
func UpdateBundleBalance() error {
err := dao.UpdateBundleBalance()
if err != nil {
return err
}
return nil
}
func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBalanceExportResp, error) {

View File

@ -55,6 +55,7 @@ service Bundle {
//
rpc UpdateBundleBalance(UpdateBundleBalanceReq) returns (UpdateBundleBalanceResp) {} // ()
rpc BundleExtend(BundleExtendRequest) returns (BundleExtendResponse) {} //
rpc BundleExtendRecordsList(BundleExtendRecordsListRequest) returns (BundleExtendRecordsListResponse) {} //
rpc GetBundleBalanceList(GetBundleBalanceListReq) returns (GetBundleBalanceListResp) {} //
@ -664,6 +665,12 @@ message BatchGetValueAddServiceLangResponse{
}
//*********************************-over******************************************
message UpdateBundleBalanceReq{
}
message UpdateBundleBalanceResp{
}
message BundleExtendRequest{
int64 userId = 1;
uint32 accountAdditional = 2;

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,