fix
This commit is contained in:
@@ -31,9 +31,14 @@ func NewDeleteCartLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
||||
// }
|
||||
|
||||
func (l *DeleteCartLogic) DeleteCart(req *types.DeleteCartReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||
// userinfo 传入值时, 一定不为null
|
||||
|
||||
if !userinfo.IsUser() {
|
||||
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in")
|
||||
}
|
||||
//删除购物车
|
||||
if err := l.svcCtx.AllModels.FsShoppingCart.Delete(l.ctx, userinfo.UserId, req.Id); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to delete shopping cart")
|
||||
}
|
||||
return resp.SetStatus(basic.CodeOK)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user