fix:优化订单自动取消
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"fusenapi/constants"
|
||||
"fusenapi/service/repositories"
|
||||
"fusenapi/utils/auth"
|
||||
@@ -68,6 +69,22 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq, userinfo *auth
|
||||
// })
|
||||
// }, []interface{}{res.OrderSn})
|
||||
|
||||
// 延时任务
|
||||
time.AfterFunc(time.Minute*1, func() {
|
||||
orderSn := res.OrderSn
|
||||
fmt.Println("延时任务: OrderSn--", orderSn)
|
||||
ctx := context.Background()
|
||||
|
||||
svcCtx := svc.ServiceContext{
|
||||
Config: l.svcCtx.Config,
|
||||
Repositories: l.svcCtx.Repositories,
|
||||
}
|
||||
svcCtx.Repositories.NewOrder.Close(ctx, &repositories.CloseReq{
|
||||
OrderSn: orderSn,
|
||||
Type: 1,
|
||||
})
|
||||
})
|
||||
|
||||
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
|
||||
"order_sn": res.OrderSn,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user