增加领取成功时间
This commit is contained in:
parent
fbd8d0c413
commit
87e3b7a4ca
|
|
@ -23,6 +23,7 @@ type OrderBo struct {
|
|||
Channel vo.Channel
|
||||
Attach string
|
||||
Remark string
|
||||
ReceiveSuccessTime *time.Time
|
||||
LastUseTime *time.Time
|
||||
CreateTime *time.Time
|
||||
UpdateTime *time.Time
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ type Order struct {
|
|||
Channel uint8 `gorm:"column:channel;not null;comment:1:微信 2:支付宝" json:"channel"` // 1:微信 2:支付宝
|
||||
Remark string `gorm:"column:remark;not null;comment:remark" json:"remark"`
|
||||
Attach string `gorm:"column:attach;not null;comment:attach" json:"attach"`
|
||||
ReceiveSuccessTime *time.Time `gorm:"column:receive_success_time" json:"receive_success_time"`
|
||||
LastUseTime *time.Time `gorm:"column:last_use_time" json:"last_use_time"`
|
||||
CreateTime *time.Time `gorm:"column:create_time" json:"create_time"`
|
||||
UpdateTime *time.Time `gorm:"column:update_time" json:"update_time"`
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ func (p *OrderRepoImpl) FindInBatches(ctx context.Context, w *bo.FindInBatchesUs
|
|||
var results = make([]*model.Order, 0)
|
||||
|
||||
result := p.db.DB(ctx).
|
||||
Where("last_use_time BETWEEN ? AND ?", w.StartTime, w.EndTime).
|
||||
Where("receive_success_time BETWEEN ? AND ?", w.StartTime, w.EndTime).
|
||||
Where("type = ?", w.Type).
|
||||
Where("status = ?", vo.OrderStatusUse).
|
||||
Where("status IN (?)", []uint8{vo.OrderStatusSuccess.GetValue(), vo.OrderStatusUse.GetValue()}).
|
||||
FindInBatches(&results, 100, func(tx *gorm.DB, batch int) error {
|
||||
// tx.RowsAffected 提供当前批处理中记录的计数(the count of records in the current batch)
|
||||
// 'batch' 变量表示当前批号(the current batch number)
|
||||
|
|
@ -174,6 +174,7 @@ func (p *OrderRepoImpl) Success(ctx context.Context, id uint64, voucherNo string
|
|||
Updates(model.Order{
|
||||
Status: vo.OrderStatusSuccess.GetValue(),
|
||||
VoucherNo: voucherNo,
|
||||
ReceiveSuccessTime: &now,
|
||||
UpdateTime: &now,
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,13 @@ func (s *VoucherService) OrderNotice(ctx context.Context) error {
|
|||
|
||||
start := time.Now()
|
||||
|
||||
err := s.VoucherBiz.OrderNotice(ctx)
|
||||
if err := s.VoucherBiz.OrderNotice(ctx); err != nil {
|
||||
log.Error("订单定时通知,执行失败,err: %v", err)
|
||||
}
|
||||
|
||||
end := time.Now()
|
||||
elapsed := end.Sub(start)
|
||||
log.Warnf("订单定时通知,开始执行时间%s,执行结束时间%s,代码块执行耗时: %s", start.Format(time.DateTime), end.Format(time.DateTime), elapsed)
|
||||
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue