|
@@ -2,8 +2,10 @@ package middleware |
|
@@ -2,8 +2,10 @@ package middleware |
|
2
|
|
2
|
|
|
3
|
import (
|
3
|
import (
|
|
4
|
"github.com/astaxie/beego/context"
|
4
|
"github.com/astaxie/beego/context"
|
|
|
|
5
|
+ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/userAuth"
|
|
5
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
|
6
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
|
|
6
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
|
7
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
|
|
|
|
8
|
+ "strconv"
|
|
7
|
"strings"
|
9
|
"strings"
|
|
8
|
)
|
10
|
)
|
|
9
|
|
11
|
|
|
@@ -38,15 +40,15 @@ func CheckJWTToken(ctx *context.Context) { |
|
@@ -38,15 +40,15 @@ func CheckJWTToken(ctx *context.Context) { |
|
38
|
ctx.Input.SetData("UserId", u.UserId)
|
40
|
ctx.Input.SetData("UserId", u.UserId)
|
|
39
|
|
41
|
|
|
40
|
// valid token
|
42
|
// valid token
|
|
41
|
- //userPhone, _ := strconv.Atoi(u.Phone)
|
|
|
|
42
|
- //tokenAuth := userAuth.NewRedisUserAuth(userAuth.WithUserId(int64(userPhone)))
|
|
|
|
43
|
- //err := tokenAuth.Check(
|
|
|
|
44
|
- // userAuth.NewOptions(userAuth.WithAccessToken(token)),
|
|
|
|
45
|
- //)
|
|
|
|
46
|
- //if err != nil {
|
|
|
|
47
|
- // msg = protocol.NewMesage(4141)
|
|
|
|
48
|
- // return
|
|
|
|
49
|
- //}
|
43
|
+ userPhone, _ := strconv.Atoi(u.Phone)
|
|
|
|
44
|
+ tokenAuth := userAuth.NewRedisUserAuth(userAuth.WithUserId(int64(userPhone)))
|
|
|
|
45
|
+ err := tokenAuth.Check(
|
|
|
|
46
|
+ userAuth.NewOptions(userAuth.WithAccessToken(token)),
|
|
|
|
47
|
+ )
|
|
|
|
48
|
+ if err != nil {
|
|
|
|
49
|
+ msg = protocol.NewMesage(4141)
|
|
|
|
50
|
+ return
|
|
|
|
51
|
+ }
|
|
50
|
}
|
52
|
}
|
|
51
|
return
|
53
|
return
|
|
52
|
} |
54
|
} |