2025-02-20 11:43:50 +00:00
|
|
|
package login
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
type WxUser struct {
|
|
|
|
OpenID string `json:"openID"`
|
|
|
|
GHID string `json:"gHID"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Info struct {
|
2025-02-21 09:49:13 +00:00
|
|
|
ID uint64 `json:"ID"`
|
|
|
|
Status int32 `json:"status"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Sex int32 `json:"sex"`
|
|
|
|
Nationality string `json:"nationality"`
|
|
|
|
DocumentType int32 `json:"documentType"`
|
|
|
|
CertificatePicture string `json:"certificatePicture"`
|
|
|
|
Validity string `json:"validity"`
|
|
|
|
PlaceOfResidence string `json:"placeOfResidence"`
|
|
|
|
GroupPhoto string `json:"groupPhoto"`
|
|
|
|
Attachment string `json:"attachment"`
|
|
|
|
SubNum string `json:"subNum"`
|
|
|
|
NotPassRemarks string `json:"notPassRemarks"`
|
|
|
|
Domain string `json:"domain"`
|
2025-02-20 11:43:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetUserInfoFromC(c *gin.Context) Info {
|
|
|
|
userInfoAny, _ := c.Get("jwtInfo")
|
|
|
|
userInfo := userInfoAny.(Info)
|
|
|
|
return userInfo
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetUserInfoFromCtx(c *gin.Context) (Info, error) {
|
|
|
|
userInfoAny, _ := c.Get("jwtInfo")
|
|
|
|
if userInfoAny != nil {
|
|
|
|
userInfo := userInfoAny.(Info)
|
|
|
|
return userInfo, nil
|
|
|
|
} else {
|
|
|
|
return Info{}, errors.New("not login")
|
|
|
|
}
|
|
|
|
}
|