This commit is contained in:
parent
01ac62f2bc
commit
f4872bfe74
|
|
@ -11,6 +11,6 @@ type UseLogBo struct {
|
||||||
OrderNo string
|
OrderNo string
|
||||||
Amount int64
|
Amount int64
|
||||||
Type vo.UseLogType
|
Type vo.UseLogType
|
||||||
UseTime *time.Time
|
OperateTime *time.Time
|
||||||
CreateTime *time.Time
|
CreateTime *time.Time
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,14 @@ func (v *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.PlainText.ConsumeInformation.ConsumeTime != "" {
|
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 {
|
if err2 != nil {
|
||||||
return err2
|
return err2
|
||||||
}
|
}
|
||||||
|
|
||||||
useLog, err2 := v.UseLogRepo.GetByUseTimeOrder(ctx, order.OrderNo, &useTime)
|
useLog, err2 := v.UseLogRepo.GetByUseTimeOrder(ctx, order.OrderNo, &useTime)
|
||||||
|
|
||||||
if err2 != nil && !errors.Is(err2, gorm.ErrRecordNotFound) {
|
if err2 != nil && !errors.Is(err2, gorm.ErrRecordNotFound) {
|
||||||
return err2
|
return err2
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +52,7 @@ func (v *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
|
||||||
OrderNo: order.OrderNo,
|
OrderNo: order.OrderNo,
|
||||||
Amount: req.PlainText.ConsumeInformation.ConsumeAmount,
|
Amount: req.PlainText.ConsumeInformation.ConsumeAmount,
|
||||||
Type: vo.UseLogTypeUsed,
|
Type: vo.UseLogTypeUsed,
|
||||||
UseTime: &useTime,
|
OperateTime: &useTime,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ type UseLog struct {
|
||||||
OrderNo string `gorm:"column:order_no;not null" json:"order_no"`
|
OrderNo string `gorm:"column:order_no;not null" json:"order_no"`
|
||||||
Amount int64 `gorm:"column:amount;not null;comment:核销金额" json:"amount"`
|
Amount int64 `gorm:"column:amount;not null;comment:核销金额" json:"amount"`
|
||||||
Type uint8 `gorm:"column:type;not null;comment:1:核销 2:退款" json:"type"`
|
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"`
|
CreateTime *time.Time `gorm:"column:create_time;not null" json:"create_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ func (this *UseLogRepoImpl) Create(ctx context.Context, req *bo.UseLogBo) (*bo.U
|
||||||
OrderNo: req.OrderNo,
|
OrderNo: req.OrderNo,
|
||||||
Type: req.Type.GetValue(),
|
Type: req.Type.GetValue(),
|
||||||
Amount: req.Amount,
|
Amount: req.Amount,
|
||||||
UseTime: req.UseTime,
|
OperateTime: req.OperateTime,
|
||||||
CreateTime: &now,
|
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) {
|
func (this *UseLogRepoImpl) GetByUseTimeOrder(ctx context.Context, orderNo string, useTime *time.Time) (*bo.UseLogBo, error) {
|
||||||
var item model.UseLog
|
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 {
|
if tx.Error != nil {
|
||||||
return nil, tx.Error
|
return nil, tx.Error
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue