|
@@ -1,14 +1,15 @@
|
|
package middleware
|
|
package middleware
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "fmt"
|
|
|
|
+ "strings"
|
|
|
|
+
|
|
. "bp.jydev.jianyu360.cn/BaseService/gateway/common/gatecode"
|
|
. "bp.jydev.jianyu360.cn/BaseService/gateway/common/gatecode"
|
|
"bp.jydev.jianyu360.cn/BaseService/gateway/core/proxy/rpc"
|
|
"bp.jydev.jianyu360.cn/BaseService/gateway/core/proxy/rpc"
|
|
"bp.jydev.jianyu360.cn/BaseService/gateway/core/router"
|
|
"bp.jydev.jianyu360.cn/BaseService/gateway/core/router"
|
|
- "fmt"
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
- "strings"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
// filterBefore 前置拦截处理
|
|
// filterBefore 前置拦截处理
|
|
@@ -40,20 +41,18 @@ func filterBefore(r *ghttp.Request) error {
|
|
var useCount, surplusCount int64
|
|
var useCount, surplusCount int64
|
|
//校验权益
|
|
//校验权益
|
|
if rule.PowerCheck == 1 {
|
|
if rule.PowerCheck == 1 {
|
|
- if rule.PowerType == 0 {
|
|
|
|
- var err error
|
|
|
|
- useCount, surplusCount, err = rpc.CheckResourcePower(ctx.Sess.EntId, ctx.Sess.NewUid, rule.FuncCode, r.GetHeader("functionCode"), rule.AppId)
|
|
|
|
- if err != nil {
|
|
|
|
- return err
|
|
|
|
- }
|
|
|
|
|
|
+ var err error
|
|
|
|
+ useCount, surplusCount, err = rpc.CheckResourcePower(ctx.Sess.EntId, ctx.Sess.NewUid, rule.FuncCode, r.GetHeader("functionCode"), rule.AppId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return err
|
|
}
|
|
}
|
|
- if rule.PowerType > 0 {
|
|
|
|
- if err := rpc.CheckUserPower(ctx.Sess.UserId, ctx.Sess.Phone, rule.PowerType); err != nil {
|
|
|
|
- return err
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ //老剑鱼用户身份判断
|
|
|
|
+ if rule.PowerType > 0 {
|
|
|
|
+ if err := rpc.CheckUserPower(ctx.Sess.UserId, ctx.Sess.Phone, rule.PowerType); err != nil {
|
|
|
|
+ return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
//注入用户身份
|
|
//注入用户身份
|
|
infusionIdentity(r, ctx.Sess, useCount, surplusCount, rule.AppId)
|
|
infusionIdentity(r, ctx.Sess, useCount, surplusCount, rule.AppId)
|
|
|
|
|