|
@@ -8,9 +8,12 @@ package api
|
|
|
|
|
|
import (
|
|
import (
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "strconv"
|
|
|
|
|
|
"github.com/dgrijalva/jwt-go"
|
|
"github.com/dgrijalva/jwt-go"
|
|
"github.com/kataras/iris/v12"
|
|
"github.com/kataras/iris/v12"
|
|
|
|
+ "go.mod/comm"
|
|
|
|
+ "go.mod/conf"
|
|
"go.mod/services"
|
|
"go.mod/services"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -37,20 +40,22 @@ func (c *ProjectAccountApi) Get() {
|
|
// }
|
|
// }
|
|
|
|
|
|
userInfo := c.Ctx.Values().Get("jwt").(*jwt.Token).Claims.(jwt.MapClaims)
|
|
userInfo := c.Ctx.Values().Get("jwt").(*jwt.Token).Claims.(jwt.MapClaims)
|
|
- fmt.Println(userInfo)
|
|
|
|
|
|
+ accountId := userInfo["identity"].(string)
|
|
|
|
+ aid, err := comm.AesDecrypt(accountId, conf.CookieSecret)
|
|
|
|
+ id, err := strconv.Atoi(aid)
|
|
// 获得项目ID
|
|
// 获得项目ID
|
|
// projectIdInt, err := utils.GetProjectId(c.Ctx)
|
|
// projectIdInt, err := utils.GetProjectId(c.Ctx)
|
|
- // if err != nil {
|
|
|
|
- // c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
|
|
|
|
- // return
|
|
|
|
- // }
|
|
|
|
|
|
+ if err != nil {
|
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
|
|
// 获得登陆用户
|
|
// 获得登陆用户
|
|
- // AccountData := c.ServiceProjectAccount.Get(projectAccountIdInt)
|
|
|
|
|
|
+ AccountData := c.ServiceProjectAccount.Get(id)
|
|
|
|
|
|
c.Ctx.JSON(iris.Map{
|
|
c.Ctx.JSON(iris.Map{
|
|
"code": 0,
|
|
"code": 0,
|
|
"msg": "",
|
|
"msg": "",
|
|
- // "data": AccountData,
|
|
|
|
|
|
+ "data": AccountData,
|
|
})
|
|
})
|
|
}
|
|
}
|