Update:解决冲突
This commit is contained in:
commit
0ed48e789d
@ -93,11 +93,16 @@ func (b *BundleProvider) BundleActivate(_ context.Context, req *bundle.BundleAct
|
||||
return nil, logic.BundleActivate(req)
|
||||
}
|
||||
|
||||
// 套餐余额导出
|
||||
// 普通套餐余额导出
|
||||
func (b *BundleProvider) BundleBalanceExport(_ context.Context, req *bundle.BundleBalanceExportReq) (*bundle.BundleBalanceExportResp, error) {
|
||||
return logic.BundleBalanceExport(req)
|
||||
}
|
||||
|
||||
// 先用后付套餐余额导出
|
||||
func (b *BundleProvider) PayLaterBundleBalanceExport(_ context.Context, req *bundle.BundleBalanceExportReq) (*bundle.PayLaterBundleBalanceExportResp, error) {
|
||||
return logic.PayLaterBundleBalanceExport(req)
|
||||
}
|
||||
|
||||
func (b *BundleProvider) GetBundleBalanceLayout(_ context.Context, req *bundle.GetBundleBalanceLayoutReq) (*bundle.GetBundleBalanceLayoutResp, error) {
|
||||
return logic.GetBundleBalanceLayout(req)
|
||||
}
|
||||
|
||||
@ -226,6 +226,18 @@ func GetPayLaterBundleBalanceList(req *bundle.GetPayLaterBundleBalanceListReq) (
|
||||
if req.ExpiredTimeStart != 0 {
|
||||
session = session.Where("lb.expired_at >= ?", time.UnixMilli(req.ExpiredTimeStart))
|
||||
}
|
||||
if req.StartTimeStart != 0 {
|
||||
session = session.Where("bor.created_at >= ?", time.UnixMilli(req.StartTimeStart))
|
||||
}
|
||||
if req.StartTimeEnd != 0 {
|
||||
session = session.Where("bor.created_at <= ?", time.UnixMilli(req.StartTimeEnd))
|
||||
}
|
||||
if len(req.Month) == 0 {
|
||||
newestMonthQuery := app.ModuleClients.BundleDB.Model(&model.BundleBalance{}).Select("max(month) as month,user_id").Group("user_id")
|
||||
session.Joins("LEFT JOIN (?) as newest_month on newest_month.user_id = bb.user_id", newestMonthQuery).Where("")
|
||||
} else {
|
||||
session = session.Where("bb.month in (?)", req.Month)
|
||||
}
|
||||
err = session.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
@ -765,6 +765,24 @@ func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBala
|
||||
return &bundle.BundleBalanceExportResp{Total: int64(len(items)), Data: items}, nil
|
||||
}
|
||||
|
||||
func PayLaterBundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.PayLaterBundleBalanceExportResp, error) {
|
||||
data, err := GetPayLaterBundleBalanceList(&bundle.GetPayLaterBundleBalanceListReq{
|
||||
Month: req.Month,
|
||||
UserName: req.UserName,
|
||||
ExpiredTimeStart: int64(req.ExpiredTimeStart),
|
||||
ExpiredTimeEnd: int64(req.ExpiredTimeEnd),
|
||||
Page: 1,
|
||||
PageSize: 99999,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.New("先用后付套餐余量导出失败")
|
||||
}
|
||||
return &bundle.PayLaterBundleBalanceExportResp{
|
||||
Total: data.Total,
|
||||
Data: data.Data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func GetBundleBalanceLayout(req *bundle.GetBundleBalanceLayoutReq) (*bundle.GetBundleBalanceLayoutResp, error) {
|
||||
data, err := dao.GetBundleBalanceLayout(req)
|
||||
if err != nil { // 返回默认值
|
||||
|
||||
@ -75,7 +75,8 @@ service Bundle {
|
||||
rpc CreateBundleBalance(CreateBundleBalanceReq) returns (CreateBundleBalanceResp) {} // 创建新的余量信息
|
||||
rpc AddBundleBalance(AddBundleBalanceReq) returns (AddBundleBalanceResp) {} // 修改余量信息
|
||||
rpc BundleActivate(BundleActivateReq) returns (BundleActivateResp) {} // 用户套餐激活
|
||||
rpc BundleBalanceExport(BundleBalanceExportReq) returns (BundleBalanceExportResp) {} // 套餐余量导出
|
||||
rpc BundleBalanceExport(BundleBalanceExportReq) returns (BundleBalanceExportResp) {} // 普通套餐余量导出
|
||||
rpc PayLaterBundleBalanceExport(BundleBalanceExportReq) returns (PayLaterBundleBalanceExportResp) {} // 先用后付套餐余量导出
|
||||
rpc GetBundleBalanceLayout(GetBundleBalanceLayoutReq) returns (GetBundleBalanceLayoutResp) {} // 余量布局
|
||||
rpc SetBundleBalanceLayout(SetBundleBalanceLayoutReq) returns (SetBundleBalanceLayoutResp) {} // 余量布局
|
||||
|
||||
@ -1167,6 +1168,7 @@ message BundleBalanceExportReq{
|
||||
uint64 expiredTimeStart = 3;
|
||||
uint64 expiredTimeEnd = 4;
|
||||
uint32 status = 5;
|
||||
uint32 bundleType = 6;
|
||||
}
|
||||
|
||||
message BundleBalanceExportResp{
|
||||
@ -1174,6 +1176,11 @@ message BundleBalanceExportResp{
|
||||
repeated BundleBalanceExportItem data =2;
|
||||
}
|
||||
|
||||
message PayLaterBundleBalanceExportResp{
|
||||
int64 total = 1;
|
||||
repeated PayLaterBundleBalanceItem data =2;
|
||||
}
|
||||
|
||||
|
||||
message GetBundleBalanceListResp{
|
||||
int64 total = 1;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -461,6 +461,16 @@ func (this *BundleBalanceExportResp) Validate() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *PayLaterBundleBalanceExportResp) 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 {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
|
||||
@ -82,6 +82,7 @@ type BundleClient interface {
|
||||
AddBundleBalance(ctx context.Context, in *AddBundleBalanceReq, opts ...grpc_go.CallOption) (*AddBundleBalanceResp, common.ErrorWithAttachment)
|
||||
BundleActivate(ctx context.Context, in *BundleActivateReq, opts ...grpc_go.CallOption) (*BundleActivateResp, common.ErrorWithAttachment)
|
||||
BundleBalanceExport(ctx context.Context, in *BundleBalanceExportReq, opts ...grpc_go.CallOption) (*BundleBalanceExportResp, common.ErrorWithAttachment)
|
||||
PayLaterBundleBalanceExport(ctx context.Context, in *BundleBalanceExportReq, opts ...grpc_go.CallOption) (*PayLaterBundleBalanceExportResp, common.ErrorWithAttachment)
|
||||
GetBundleBalanceLayout(ctx context.Context, in *GetBundleBalanceLayoutReq, opts ...grpc_go.CallOption) (*GetBundleBalanceLayoutResp, common.ErrorWithAttachment)
|
||||
SetBundleBalanceLayout(ctx context.Context, in *SetBundleBalanceLayoutReq, opts ...grpc_go.CallOption) (*SetBundleBalanceLayoutResp, common.ErrorWithAttachment)
|
||||
// 使用记录
|
||||
@ -218,6 +219,7 @@ type BundleClientImpl struct {
|
||||
AddBundleBalance func(ctx context.Context, in *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
|
||||
BundleActivate func(ctx context.Context, in *BundleActivateReq) (*BundleActivateResp, error)
|
||||
BundleBalanceExport func(ctx context.Context, in *BundleBalanceExportReq) (*BundleBalanceExportResp, error)
|
||||
PayLaterBundleBalanceExport func(ctx context.Context, in *BundleBalanceExportReq) (*PayLaterBundleBalanceExportResp, error)
|
||||
GetBundleBalanceLayout func(ctx context.Context, in *GetBundleBalanceLayoutReq) (*GetBundleBalanceLayoutResp, error)
|
||||
SetBundleBalanceLayout func(ctx context.Context, in *SetBundleBalanceLayoutReq) (*SetBundleBalanceLayoutResp, error)
|
||||
GetUsedRecordList func(ctx context.Context, in *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
|
||||
@ -606,6 +608,12 @@ func (c *bundleClient) BundleBalanceExport(ctx context.Context, in *BundleBalanc
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleBalanceExport", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) PayLaterBundleBalanceExport(ctx context.Context, in *BundleBalanceExportReq, opts ...grpc_go.CallOption) (*PayLaterBundleBalanceExportResp, common.ErrorWithAttachment) {
|
||||
out := new(PayLaterBundleBalanceExportResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/PayLaterBundleBalanceExport", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetBundleBalanceLayout(ctx context.Context, in *GetBundleBalanceLayoutReq, opts ...grpc_go.CallOption) (*GetBundleBalanceLayoutResp, common.ErrorWithAttachment) {
|
||||
out := new(GetBundleBalanceLayoutResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -1072,6 +1080,7 @@ type BundleServer interface {
|
||||
AddBundleBalance(context.Context, *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
|
||||
BundleActivate(context.Context, *BundleActivateReq) (*BundleActivateResp, error)
|
||||
BundleBalanceExport(context.Context, *BundleBalanceExportReq) (*BundleBalanceExportResp, error)
|
||||
PayLaterBundleBalanceExport(context.Context, *BundleBalanceExportReq) (*PayLaterBundleBalanceExportResp, error)
|
||||
GetBundleBalanceLayout(context.Context, *GetBundleBalanceLayoutReq) (*GetBundleBalanceLayoutResp, error)
|
||||
SetBundleBalanceLayout(context.Context, *SetBundleBalanceLayoutReq) (*SetBundleBalanceLayoutResp, error)
|
||||
// 使用记录
|
||||
@ -1311,6 +1320,9 @@ func (UnimplementedBundleServer) BundleActivate(context.Context, *BundleActivate
|
||||
func (UnimplementedBundleServer) BundleBalanceExport(context.Context, *BundleBalanceExportReq) (*BundleBalanceExportResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleBalanceExport not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) PayLaterBundleBalanceExport(context.Context, *BundleBalanceExportReq) (*PayLaterBundleBalanceExportResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PayLaterBundleBalanceExport not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetBundleBalanceLayout(context.Context, *GetBundleBalanceLayoutReq) (*GetBundleBalanceLayoutResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetBundleBalanceLayout not implemented")
|
||||
}
|
||||
@ -3022,6 +3034,35 @@ func _Bundle_BundleBalanceExport_Handler(srv interface{}, ctx context.Context, d
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_PayLaterBundleBalanceExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BundleBalanceExportReq)
|
||||
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("PayLaterBundleBalanceExport", 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_GetBundleBalanceLayout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetBundleBalanceLayoutReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -5205,6 +5246,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "BundleBalanceExport",
|
||||
Handler: _Bundle_BundleBalanceExport_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "PayLaterBundleBalanceExport",
|
||||
Handler: _Bundle_PayLaterBundleBalanceExport_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetBundleBalanceLayout",
|
||||
Handler: _Bundle_GetBundleBalanceLayout_Handler,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user