This commit is contained in:
ziming 2025-05-21 10:51:57 +08:00
parent 01ac62f2bc
commit f4872bfe74
4 changed files with 25 additions and 24 deletions

View File

@ -11,6 +11,6 @@ type UseLogBo struct {
OrderNo string
Amount int64
Type vo.UseLogType
UseTime *time.Time
OperateTime *time.Time
CreateTime *time.Time
}

View File

@ -35,13 +35,14 @@ func (v *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
}
if req.PlainText.ConsumeInformation.ConsumeTime != "" {
inputFormat := time.RFC3339
useTime, err2 := time.Parse(inputFormat, req.PlainText.ConsumeInformation.ConsumeTime)
useTime, err2 := time.Parse(time.RFC3339, req.PlainText.ConsumeInformation.ConsumeTime)
if err2 != nil {
return err2
}
useLog, err2 := v.UseLogRepo.GetByUseTimeOrder(ctx, order.OrderNo, &useTime)
if err2 != nil && !errors.Is(err2, gorm.ErrRecordNotFound) {
return err2
}
@ -51,7 +52,7 @@ func (v *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
OrderNo: order.OrderNo,
Amount: req.PlainText.ConsumeInformation.ConsumeAmount,
Type: vo.UseLogTypeUsed,
UseTime: &useTime,
OperateTime: &useTime,
})
if err != nil {
return err

View File

@ -16,7 +16,7 @@ type UseLog struct {
OrderNo string `gorm:"column:order_no;not null" json:"order_no"`
Amount int64 `gorm:"column:amount;not null;comment:核销金额" json:"amount"`
Type uint8 `gorm:"column:type;not null;comment:1:核销 2:退款" json:"type"`
UseTime *time.Time `gorm:"column:use_time;not null" json:"use_time"`
OperateTime *time.Time `gorm:"column:operate_time;not null" json:"operate_time"`
CreateTime *time.Time `gorm:"column:create_time;not null" json:"create_time"`
}

View File

@ -32,7 +32,7 @@ func (this *UseLogRepoImpl) Create(ctx context.Context, req *bo.UseLogBo) (*bo.U
OrderNo: req.OrderNo,
Type: req.Type.GetValue(),
Amount: req.Amount,
UseTime: req.UseTime,
OperateTime: req.OperateTime,
CreateTime: &now,
}
@ -62,7 +62,7 @@ func (this *UseLogRepoImpl) GetByID(ctx context.Context, id uint64) (*bo.UseLogB
func (this *UseLogRepoImpl) GetByUseTimeOrder(ctx context.Context, orderNo string, useTime *time.Time) (*bo.UseLogBo, error) {
var item model.UseLog
tx := this.DB(ctx).Where(model.UseLog{OrderNo: orderNo, UseTime: useTime}).First(&item)
tx := this.DB(ctx).Where(model.UseLog{OrderNo: orderNo, OperateTime: useTime}).First(&item)
if tx.Error != nil {
return nil, tx.Error