多笔立减金
This commit is contained in:
parent
2edd4fd8cb
commit
9493648272
|
|
@ -7,6 +7,7 @@ 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"
|
||||||
|
|
@ -178,6 +179,11 @@ func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo) (string, error) {
|
||||||
//Attach: nl.Attach,
|
//Attach: nl.Attach,
|
||||||
Ext: "",
|
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")
|
||||||
|
}
|
||||||
|
|
||||||
bizJsonBytes, err := json.Marshal(req)
|
bizJsonBytes, err := json.Marshal(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -208,7 +214,11 @@ func (biz *MultiBiz) GetRequest(ctx context.Context, nl *bo.MultiNotifyLogBo) (*
|
||||||
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) error {
|
||||||
|
|
||||||
if nl.RequestURL == "" {
|
if nl.RequestURL == "" {
|
||||||
return biz.notifyFail(ctx, nl, "回调通知招行地址为空")
|
if err := biz.notifyFail(ctx, nl, "回调通知招行地址为空"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// 回调通知地址为空,不反回错误,不做再次通知处理
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
request, err := biz.GetRequest(ctx, nl)
|
request, err := biz.GetRequest(ctx, nl)
|
||||||
|
|
@ -225,7 +235,7 @@ func (biz *MultiBiz) Request(ctx context.Context, mmd *bo.MultiNotifyDataBo, nl
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = biz.CmbMixRepo.VerifyResponse(ctx, reply); err != nil {
|
if err = biz.CmbMixRepo.VerifyResponse(ctx, reply); err != nil {
|
||||||
errMsg := fmt.Sprintf("回调通知招行返回验证结果发生错误,rep:%+v error:%s", reply, err.Error())
|
errMsg := fmt.Sprintf("回调通知招行返回验证结果发生错误,resp:%+v error:%s", reply, err.Error())
|
||||||
if err2 := biz.notifyFail(ctx, nl, errMsg); err2 != nil {
|
if err2 := biz.notifyFail(ctx, nl, errMsg); err2 != nil {
|
||||||
return err2
|
return err2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ func (this *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, re
|
||||||
} else if req.PlainText.Status.IsExpired() {
|
} else if req.PlainText.Status.IsExpired() {
|
||||||
|
|
||||||
return this.expired(ctx, order)
|
return this.expired(ctx, order)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("未知通知类型:%s", req.PlainText.Status.GetText())
|
return fmt.Errorf("未知通知类型:%s", req.PlainText.Status.GetText())
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,7 @@ func (p *MultiNotifyDataRepoImpl) AddNoticeNum(ctx context.Context, id int64) er
|
||||||
"update_time": &now,
|
"update_time": &now,
|
||||||
}
|
}
|
||||||
|
|
||||||
tx := p.DB(ctx).
|
tx := p.DB(ctx).Where("id = ?", id).Updates(u)
|
||||||
Where("id = ?", id).
|
|
||||||
Updates(u)
|
|
||||||
|
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
return tx.Error
|
return tx.Error
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
"voucher/internal/biz/do"
|
"voucher/internal/biz/bo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHashMod(t *testing.T) {
|
func TestHashMod(t *testing.T) {
|
||||||
|
|
@ -82,7 +82,7 @@ func TestLength(t *testing.T) {
|
||||||
s := len(jsonStr)
|
s := len(jsonStr)
|
||||||
t.Log(s)
|
t.Log(s)
|
||||||
|
|
||||||
var notify do.CouponNotification
|
var notify bo.WechatVoucherNotifyBo
|
||||||
err := json.Unmarshal([]byte(jsonStr), ¬ify)
|
err := json.Unmarshal([]byte(jsonStr), ¬ify)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ func NewHTTPServer(
|
||||||
return ctx.String(http2.StatusOK, "pong")
|
return ctx.String(http2.StatusOK, "pong")
|
||||||
})
|
})
|
||||||
|
|
||||||
// 启星 /voucher/qiXing/v1/notify
|
// 启星(启星-蓝色兄弟立减金代配) /voucher/qiXing/v1/notify
|
||||||
srv.Route("/voucher/").POST("qiXing/v1/notify", tripartiteService.QiXingNotify)
|
srv.Route("/voucher/").POST("qiXing/v1/notify", tripartiteService.QiXingNotify)
|
||||||
|
|
||||||
// 订单通知重试 -- 不健全
|
// 订单通知重试 -- 不健全
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue