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