作者 yangfu

fix: 去掉注释代码

... ... @@ -2,6 +2,7 @@ package main
import (
"github.com/astaxie/beego"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/event"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
_ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
_ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg"
... ... @@ -20,7 +21,7 @@ func main() {
//ginsvr.Run()
//注册事件
//event.InitEventCenter()
event.InitEventCenter()
beego.Run()
}
... ...
... ... @@ -2,8 +2,10 @@ package middleware
import (
"github.com/astaxie/beego/context"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/userAuth"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
"strconv"
"strings"
)
... ... @@ -38,15 +40,15 @@ func CheckJWTToken(ctx *context.Context) {
ctx.Input.SetData("UserId", u.UserId)
// valid token
//userPhone, _ := strconv.Atoi(u.Phone)
//tokenAuth := userAuth.NewRedisUserAuth(userAuth.WithUserId(int64(userPhone)))
//err := tokenAuth.Check(
// userAuth.NewOptions(userAuth.WithAccessToken(token)),
//)
//if err != nil {
// msg = protocol.NewMesage(4141)
// return
//}
userPhone, _ := strconv.Atoi(u.Phone)
tokenAuth := userAuth.NewRedisUserAuth(userAuth.WithUserId(int64(userPhone)))
err := tokenAuth.Check(
userAuth.NewOptions(userAuth.WithAccessToken(token)),
)
if err != nil {
msg = protocol.NewMesage(4141)
return
}
}
return
}
... ...