fix:购物车下单
This commit is contained in:
@@ -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 必须重新处理
|
||||
|
||||
7
server/shopping-cart/shopping-cart_test.go
Normal file
7
server/shopping-cart/shopping-cart_test.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestMain(t *testing.T) {
|
||||
main()
|
||||
}
|
||||
Reference in New Issue
Block a user