|
@@ -12,6 +12,7 @@ import (
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
|
|
|
+ "github.com/iris-contrib/middleware/jwt"
|
|
|
"github.com/kataras/iris/v12"
|
|
|
"go.mod/comm"
|
|
|
"go.mod/conf"
|
|
@@ -64,11 +65,15 @@ func GetProjectId(ctx iris.Context) (int, error) {
|
|
|
// 获得项目账号ID
|
|
|
func GetProjectAccountId(ctx iris.Context) (int, error) {
|
|
|
|
|
|
- identityIdInt, err := ctx.Values().GetInt("accountId")
|
|
|
+ userInfo := ctx.Values().Get("jwt").(*jwt.Token).Claims.(jwt.MapClaims)
|
|
|
+ accountId := userInfo["identity"].(string)
|
|
|
+
|
|
|
+ uid, err := GetDecryptId(accountId)
|
|
|
+ // identityIdInt, err := ctx.Values().GetInt("accountId")
|
|
|
if err != nil {
|
|
|
return 0, errors.New("项目账号不存在")
|
|
|
}
|
|
|
- return identityIdInt, nil
|
|
|
+ return uid, nil
|
|
|
}
|
|
|
|
|
|
// 获得解密后的ID
|