fix:购物车下单

This commit is contained in:
momo
2023-09-20 18:04:33 +08:00
parent 4d3f1512ac
commit 137919a4d7
7 changed files with 61 additions and 52 deletions

View File

@@ -36,7 +36,7 @@ func NewCreateOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Creat
func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
if userinfo.IsUser() {
if !userinfo.IsUser() {
// 如果是,返回未授权的错误码
return resp.SetStatus(basic.CodeUnAuth)
}
@@ -54,7 +54,9 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq, userinfo *auth
return resp.SetStatus(&res.ErrorCode)
}
return resp.SetStatus(basic.CodeOK)
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
"order_sn": res.OrderSn,
})
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理