master
huanghai 5 years ago
parent 7c711e54b5
commit 80fbcb0af4

@ -81,8 +81,6 @@ func getCaptcha(c *gin.Context) {
// @X-LengthLimit [{"captchaId":"20,20"}]
func getCaptchaPng(c *gin.Context) {
ControllerRecaptcha.ServeHTTP(c.Writer, c.Request)
var captchaId=c.Query("captchaId")
ControllerRecaptcha.Serve(c.Writer,c.Request,captchaId,400,200)
}
/**
@ -210,15 +208,11 @@ func accessToken(context *gin.Context) {
k := ConfigUtil.OAuth2RedisKeyPrefix + ":refresh_token_vs_person:" + refreshToken
RedisUtil.SET(k, personStr, time.Hour*24*30) //30天的有效期
//扩展一下bureau_id旧版本专用
var bureauId =ServiceLoginPerson.GetPersonBureauById(identityId, personId)
//返回json数据
context.JSON(http.StatusOK,
gin.H{
"access_token": accessToken, "expires_in": expiresIn, "refresh_token": refreshToken,
"token_type": tokenType, "identity_id": identityIdInt, "person_id": personId, "bureau_id": bureauId,
})
"token_type": tokenType, "identity_id": identityIdInt, "person_id": personId})
return
} else {
//刷新token
@ -257,14 +251,11 @@ func accessToken(context *gin.Context) {
personIdInt, _ := strconv.Atoi(personId)
//删除旧的refresh_token
RedisUtil.DEL(key)
//扩展一下bureau_id旧版本专用
var bureauId =ServiceLoginPerson.GetPersonBureauById(identityId, personId)
//返回json数据
context.JSON(http.StatusOK,
gin.H{
"access_token": accessToken, "expires_in": expiresIn, "refresh_token": refreshToken,
"token_type": tokenType, "identity_id": identityIdInt, "person_id": personIdInt, "bureau_id": bureauId,
})
"token_type": tokenType, "identity_id": identityIdInt, "person_id": personIdInt})
return
}
}

@ -88,18 +88,3 @@ func WriteLoginLog(identityId string, personId string, ip string, loginState int
db.SQL(sql, identityId, personId, ip, list[0]["province_code"].(string),
list[0]["city_code"].(string), list[0]["district_code"].(string), list[0]["bureau_id"].(string), loginState, loginName).Execute()
}
/**
ID
2020-04-27
*/
func GetPersonInfoById(identityId string, personId string) map[string]interface{} {
sql := "select bureau_id from t_sys_loginperson where identity_id=? and person_id=?"
list, _ := db.SQL(sql, identityId, personId).Query().List()
if len(list) > 0 {
return list[0]
} else {
return nil
}
}

@ -15,25 +15,4 @@ func Login(username string, password string,ip string) (bool, string, string, st
return result, identityId, personId, personName
}
/**
ID
2020-04-27
*/
func GetPersonInfoById(identityId string, personId string) map[string]interface{} {
return DaoSysLoginPerson.GetPersonInfoById(identityId, personId)
}
/**
2020-02-05
*/
func GetPersonBureauById(identityId string, personId string) string{
var bureauId = "0"
p := DaoSysLoginPerson.GetPersonInfoById(identityId, personId)
if p != nil {
bureauId = p["bureau_id"].(string)
}
return bureauId
}

Loading…
Cancel
Save