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.
66 lines
2.0 KiB
66 lines
2.0 KiB
|
3 years ago
|
package jixiaokaohe
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
|
||
|
|
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
|
||
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||
|
|
"github.com/flipped-aurora/gin-vue-admin/server/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)
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|