多笔立减金
This commit is contained in:
parent
25424eec72
commit
10eda78e58
|
|
@ -7,7 +7,6 @@ import (
|
|||
"fmt"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
v1 "voucher/api/v1"
|
||||
"voucher/internal/biz/bo"
|
||||
"voucher/internal/biz/cmb"
|
||||
|
|
@ -149,7 +148,7 @@ func (biz *MultiBiz) run(ctx context.Context, req *bo.WechatVoucherNotifyBo, mnd
|
|||
return fmt.Errorf("创建通知日志错误 error: %v", err)
|
||||
}
|
||||
|
||||
return biz.Request(ctx, mnd, nl)
|
||||
return biz.Request(ctx, mnd, nl, order)
|
||||
}
|
||||
|
||||
func (biz *MultiBiz) mndCreate(ctx context.Context, source string, req *bo.WechatVoucherNotifyBo, order *bo.OrderBo) (*bo.MultiNotifyDataBo, error) {
|
||||
|
|
@ -193,7 +192,7 @@ func (biz *MultiBiz) nlCreate(ctx context.Context, req *bo.WechatVoucherNotifyBo
|
|||
OrderCreateTime: order.CreateTime,
|
||||
CouponCreateTime: &req.PlainText.CreateTime,
|
||||
}
|
||||
request, err := biz.GetRequest(ctx, nl)
|
||||
request, err := biz.GetRequest(ctx, nl, order)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -203,19 +202,20 @@ func (biz *MultiBiz) nlCreate(ctx context.Context, req *bo.WechatVoucherNotifyBo
|
|||
return biz.MultiNotifyLogRepo.Create(ctx, nl)
|
||||
}
|
||||
|
||||
func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo) (string, error) {
|
||||
func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo, order *bo.OrderBo) (string, error) {
|
||||
|
||||
req := &v1.CmbNotifyRequest{ // 待确定
|
||||
Ticket: nl.OrderNo,
|
||||
TransDate: "", // 格式yyyy-mm-dd hh:mm:ss.sss
|
||||
OrgNo: biz.bc.Cmb.OrgNo,
|
||||
//Attach: nl.Attach,
|
||||
Ext: "",
|
||||
Ticket: nl.OrderNo, // 券订单号,lsxd订单号
|
||||
TransDate: "", // 核销时间,验券时间,格式yyyy-mm-dd hh:mm:ss.sss
|
||||
Status: "1", // 状态:1-核销成功
|
||||
OrgNo: biz.bc.Cmb.OrgNo, // cmb固定值
|
||||
Attach: order.Attach, // cmb拓展参数
|
||||
Ext: "",
|
||||
}
|
||||
if nl.ConsumeTime != nil {
|
||||
req.TransDate = nl.ConsumeTime.Format("2006-01-02 15:04:05.000")
|
||||
} else {
|
||||
req.TransDate = time.Now().Format("2006-01-02 15:04:05.000")
|
||||
req.TransDate = nl.CreateTime.Format("2006-01-02 15:04:05.000")
|
||||
}
|
||||
|
||||
bizJsonBytes, err := json.Marshal(req)
|
||||
|
|
@ -226,9 +226,9 @@ func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo) (string, error) {
|
|||
return string(bizJsonBytes), nil
|
||||
}
|
||||
|
||||
func (biz *MultiBiz) GetRequest(ctx context.Context, nl *bo.MultiNotifyLogBo) (*v1.CmbRequest, error) {
|
||||
func (biz *MultiBiz) GetRequest(ctx context.Context, nl *bo.MultiNotifyLogBo, order *bo.OrderBo) (*v1.CmbRequest, error) {
|
||||
|
||||
bizContent, err := biz.bizContent(nl)
|
||||
bizContent, err := biz.bizContent(nl, order)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ func (biz *MultiBiz) GetRequest(ctx context.Context, nl *bo.MultiNotifyLogBo) (*
|
|||
return request, nil
|
||||
}
|
||||
|
||||
func (biz *MultiBiz) Request(ctx context.Context, mmd *bo.MultiNotifyDataBo, nl *bo.MultiNotifyLogBo) error {
|
||||
func (biz *MultiBiz) Request(ctx context.Context, mmd *bo.MultiNotifyDataBo, nl *bo.MultiNotifyLogBo, order *bo.OrderBo) error {
|
||||
|
||||
if nl.RequestURL == "" {
|
||||
if err := biz.notifyFail(ctx, nl, "回调通知招行地址为空,不做通知"); err != nil {
|
||||
|
|
@ -254,7 +254,7 @@ func (biz *MultiBiz) Request(ctx context.Context, mmd *bo.MultiNotifyDataBo, nl
|
|||
return nil
|
||||
}
|
||||
|
||||
request, err := biz.GetRequest(ctx, nl)
|
||||
request, err := biz.GetRequest(ctx, nl, order)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue