修改路由
This commit is contained in:
parent
7565212b5c
commit
d72f27d7fa
@ -18,7 +18,7 @@ import (
|
|||||||
// Auth Auth认证
|
// Auth Auth认证
|
||||||
func Auth() gin.HandlerFunc {
|
func Auth() gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
appId := c.Request.Header.Get("app_id")
|
appId := c.Request.Header.Get("appId")
|
||||||
if appId == "" {
|
if appId == "" {
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{
|
c.JSON(http.StatusUnauthorized, gin.H{
|
||||||
"message": "请求未授权",
|
"message": "请求未授权",
|
||||||
@ -44,13 +44,13 @@ func Auth() gin.HandlerFunc {
|
|||||||
openKeyDao := dao.OpenKeyDao{}
|
openKeyDao := dao.OpenKeyDao{}
|
||||||
openKey, err := openKeyDao.GetOpenKeyByDoctorId(appId)
|
openKey, err := openKeyDao.GetOpenKeyByDoctorId(appId)
|
||||||
if err != nil || openKey == nil {
|
if err != nil || openKey == nil {
|
||||||
responses.FailWithMessage("非法app_id", c)
|
responses.FailWithMessage("非法appId", c)
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if openKey.Status != 1 {
|
if openKey.Status != 1 {
|
||||||
responses.FailWithMessage("非法app_id", c)
|
responses.FailWithMessage("非法appId", c)
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ func Auth() gin.HandlerFunc {
|
|||||||
paramsRaw, ok := c.Get("params")
|
paramsRaw, ok := c.Get("params")
|
||||||
if !ok {
|
if !ok {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
"message": "Invalid params type1",
|
"message": "Invalid params type",
|
||||||
"code": consts.ServerError,
|
"code": consts.ServerError,
|
||||||
"data": "",
|
"data": "",
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user