32 lines
552 B
Go
32 lines
552 B
Go
package apis
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"gitlink.org.cn/JointCloud/pcm-openi/common"
|
|
"gitlink.org.cn/JointCloud/pcm-openi/model"
|
|
)
|
|
|
|
func GetUserInfo(ctx *gin.Context) {
|
|
token := ctx.Query(common.ACCESSTOKEN)
|
|
|
|
reqUrl := common.OPENIPREFIX + common.USERINFO
|
|
|
|
resp := &model.UserInfo{}
|
|
|
|
req := common.GetRestyRequest(common.TIMEOUT)
|
|
_, err := req.
|
|
SetQueryParam(common.ACCESSTOKEN, token).
|
|
SetResult(resp).
|
|
Get(reqUrl)
|
|
|
|
if err != nil {
|
|
ctx.JSON(500, model.Error{
|
|
Error: err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
ctx.JSON(200, resp)
|
|
|
|
}
|