添加user2/GetSelfInfo
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -361,3 +361,16 @@ func (c *User2Controller) SaveMyCart() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 得到用户自己的信息
|
||||
// @Description 得到用户自己的信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetSelfInfo [get]
|
||||
func (c *User2Controller) GetSelfInfo() {
|
||||
c.callGetSelfInfo(func(params *tUser2GetSelfInfoParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.GetSelfInfo(params.Ctx)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1890,6 +1890,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetSelfInfo",
|
||||
Router: `/GetSelfInfo`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetStoreRoleList",
|
||||
|
||||
Reference in New Issue
Block a user