fix:支付

This commit is contained in:
momo 2023-09-28 18:04:35 +08:00
parent e991ee3966
commit 821c2063c9
2 changed files with 13 additions and 11 deletions

View File

@ -34,7 +34,7 @@ func main() {
ctx := svc.NewServiceContext(c)
handler.RegisterHandlers(server, ctx)
go ctx.Repositories.NewOrder.CloseList(context.Background(), &repositories.CloseListReq{})
go ctx.Repositories.NewOrder.CloseList(context.Background(), &repositories.CloseListReq{Type: 1})
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
server.Start()

View File

@ -217,16 +217,18 @@ func (d *defaultOrder) CloseList(ctx context.Context, in *CloseListReq) (res *Cl
} else {
dtime = time.Now().Add(time.Second * time.Duration(math.Abs(float64(dd))))
}
// 延时任务
d.DelayQueue.AddTask(dtime, constants.QUEUE_NAME_ORDER, func(args ...interface{}) {
ctx := context.Background()
orderSn := args[0].(string)
logc.Infof(ctx, "order close, orderSn: %s", orderSn)
d.Close(ctx, &CloseReq{
OrderSn: orderSn,
Type: 1,
})
}, []interface{}{*orderInfo.OrderSn})
if in.Type == 1 {
// 延时任务
d.DelayQueue.AddTask(dtime, constants.QUEUE_NAME_ORDER, func(args ...interface{}) {
ctx := context.Background()
orderSn := args[0].(string)
logc.Infof(ctx, "order close, orderSn: %s", orderSn)
d.Close(ctx, &CloseReq{
OrderSn: orderSn,
Type: 1,
})
}, []interface{}{*orderInfo.OrderSn})
}
}
return nil, nil
}