添加user2/GetSelfInfo

This commit is contained in:
gazebo
2019-11-06 10:00:36 +08:00
parent 8d7671f34d
commit 49a4b7b069
3 changed files with 30 additions and 0 deletions

View File

@@ -702,3 +702,11 @@ func LoadUserCart(ctx *jxcontext.Context, userID string, storeIDs []int) (cartIt
err = dao.GetRows(dao.GetDB(), &cartItems, sql, userID, storeIDs)
return cartItems, err
}
func GetSelfInfo(ctx *jxcontext.Context) (user *model.User, err error) {
tokenInfo, err := auth2.GetTokenInfo(ctx.GetToken())
if err == nil {
user, err = dao.GetUserByID(dao.GetDB(), "user_id", tokenInfo.GetID())
}
return user, err
}