You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.9 KiB
65 lines
1.9 KiB
package jixiaokaohe
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"gin_server_admin/commonus"
|
|
"gin_server_admin/global"
|
|
"gin_server_admin/model/common/response"
|
|
"gin_server_admin/model/hrsystem"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// 获取个人信息
|
|
func (a *ApiGroup) MyContent(c *gin.Context) {
|
|
isTrue, userCont := commonus.ClientIdentity()
|
|
if isTrue != true {
|
|
response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
|
|
return
|
|
}
|
|
fmt.Printf("userment----------->%v\n", userCont.Key)
|
|
if userCont.Key != "" {
|
|
var myInfo hrsystem.ManCont
|
|
err := global.GVA_DB_HrDataBase.Where("`key` = ?", userCont.Key).First(&myInfo).Error
|
|
if err != nil {
|
|
response.Result(102, err, "没有获取到数据!", c)
|
|
return
|
|
}
|
|
response.Result(0, myInfo, "获取成功!", c)
|
|
} else {
|
|
var myInfo hrsystem.ManCont
|
|
err := global.GVA_DB_HrDataBase.Where("`number` = ?", userCont.Number).First(&myInfo).Error
|
|
if err != nil {
|
|
response.Result(102, err, "没有获取到数据!", c)
|
|
return
|
|
}
|
|
response.Result(0, myInfo, "获取成功!", c)
|
|
}
|
|
|
|
}
|
|
func (a *ApiGroup) MyContentOld(c *gin.Context) {
|
|
isTrue, userCont := commonus.ClientIdentity()
|
|
if isTrue != true {
|
|
response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
|
|
return
|
|
}
|
|
fmt.Printf("userment----------->%v\n", userCont.Key)
|
|
if userCont.Key != "" {
|
|
var myInfo hrsystem.Personnel
|
|
err := global.GVA_DB_HrDataBase.Where("`key` = ?", userCont.Key).First(&myInfo).Error
|
|
if err != nil {
|
|
response.Result(102, err, "没有获取到数据!", c)
|
|
return
|
|
}
|
|
response.Result(0, myInfo, "获取成功!", c)
|
|
} else {
|
|
var myInfo hrsystem.Personnel
|
|
err := global.GVA_DB_HrDataBase.Where("`number` = ?", userCont.Number).First(&myInfo).Error
|
|
if err != nil {
|
|
response.Result(102, err, "没有获取到数据!", c)
|
|
return
|
|
}
|
|
response.Result(0, myInfo, "获取成功!", c)
|
|
}
|
|
|
|
}
|
|
|