xuzhiheng 2 лет назад
Родитель
Сommit
27a13e423f

+ 7 - 4
core/proxy/middleware/filterFuncs.go

@@ -45,11 +45,11 @@ func filterBefore(r *ghttp.Request) error {
 	//校验权益
 	var powerErr error
 	if rule.PowerCheck == 1 {
-		useCount, surplusCount, powerErr = rpc.CheckResourcePower(ctx.Sess.EntId, ctx.Sess.NewUid, rule.FuncCode, r.GetHeader("functionCode"), rule.AppId)
+		useCount, surplusCount, powerErr = rpc.CheckResourcePower(ctx.Sess.AccountId, ctx.Sess.EntAccountId, ctx.Sess.EntId, ctx.Sess.EntUserId, rule.FuncCode, r.GetHeader("functionCode"), rule.AppId)
 	}
 	//老剑鱼用户身份判断
 	if powerErr == nil && rule.PowerType > 0 {
-		powerErr = rpc.CheckUserPower(ctx.Sess.UserId, ctx.Sess.Phone, rule.PowerType)
+		powerErr = rpc.CheckUserPower(rule.PowerType, rule.AppId, ctx.Sess.MgoUserId, ctx.Sess.NewUid, ctx.Sess.AccountId, ctx.Sess.EntId, ctx.Sess.PositionType, ctx.Sess.PositionId)
 	}
 	if rule.NoPowerUrl == "" && powerErr != nil {
 		return powerErr
@@ -100,12 +100,12 @@ func filterAfter(r *ghttp.Request) (err error) {
 		if deductNum > 0 { //资源接口异常
 			if rule.Deduct > 0 { //扣减
 				fmt.Println("扣减", deductNum, ids)
-				if err = rpc.ResourcePowerDeduct(ctx.Sess.EntId, ctx.Sess.NewUid, rule.FuncCode, rule.AppId, deductNum, ids); err != nil {
+				if err = rpc.ResourcePowerDeduct(ctx.Sess.AccountId, ctx.Sess.EntAccountId, rule.FuncCode, rule.AppId, deductNum, ids); err != nil {
 					return err
 				}
 			} else { //充值
 				fmt.Println("充值", deductNum, ids)
-				if err = rpc.ResourcePowerRecharge(ctx.Sess.EntId, ctx.Sess.NewUid, rule.FuncCode, rule.AppId, deductNum, ids); err != nil {
+				if err = rpc.ResourcePowerRecharge(ctx.Sess.AccountId, ctx.Sess.EntAccountId, rule.FuncCode, rule.AppId, deductNum, ids); err != nil {
 					return err
 				}
 			}
@@ -197,6 +197,9 @@ func infusionIdentity(r *ghttp.Request, sess *router.JySession, useCount, surplu
 	if sess.PositionType > 0 {
 		r.Header.Set("positionType", gconv.String(sess.PositionType))
 	}
+	if sess.MgoUserId != "" {
+		r.Header.Set("mgoUserId", gconv.String(sess.MgoUserId))
+	}
 	if sess.UserName != "" {
 		reg := regexp.MustCompile("[^ -~\u2E80-\u2FDF\u3040-\u318F\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7FF\u3002\u00a5\uff1f\uff01\uff0c\u3001\uff1b\uff1a\u201c\u201d\u2018\u2019\uff08\uff09\u300a\u300b\u3008\u3009\u3010\u3011\u300e\u300f\u300c\u300d\ufe43\ufe44\u3014\u3015\u2026\u2014\uff5e\ufe4f\uffe5\u00a5]+")
 		userName := strings.TrimSpace(reg.ReplaceAllString(sess.UserName, ""))

+ 5 - 2
core/proxy/middleware/spiderPolyHandler.go

@@ -1,6 +1,7 @@
 package middleware
 
 import (
+	"app.yhyue.com/moapp/jybase/common"
 	. "bp.jydev.jianyu360.cn/BaseService/gateway/common/gatecode"
 	"bp.jydev.jianyu360.cn/BaseService/gateway/common/httpUtil"
 	"bp.jydev.jianyu360.cn/BaseService/gateway/core/proxy/filterPoly"
@@ -27,8 +28,10 @@ func FilterPolyHandler(r *ghttp.Request) {
 	//获取策略
 	poly := filterPolyManager.GetRule(gCtx.RouterRule.LimitPloy)
 	status, key := func() (int, string) {
+		//用户身份切换
+		userFlag, _ := common.If(gCtx.Sess.MgoUserId != "", gCtx.Sess.MgoUserId, gCtx.Sess.UserId).(string)
 		if gCtx.Sess.UserId != "" && poly.Rule.BCheckId { //id请求频率校验
-			return poly.IdFilter(ctx, gCtx.Sess.UserId)
+			return poly.IdFilter(ctx, userFlag)
 		} else { //ip请求频率校验
 			return poly.IpFilter(ctx, r.GetClientIp())
 		}
@@ -57,7 +60,7 @@ func FilterPolyHandler(r *ghttp.Request) {
 	r.Middleware.Next()
 }
 
-//getVerifyPage 获取验证码页面路径
+// getVerifyPage 获取验证码页面路径
 func getVerifyPage(page string) string {
 	if page != "" {
 		if strings.HasSuffix(page, ".html") {

+ 0 - 78
core/proxy/rpc/checkPower.go

@@ -1,78 +0,0 @@
-package rpc
-
-import (
-	"encoding/json"
-	"fmt"
-
-	"app.yhyue.com/moapp/jybase/redis"
-	"bp.jydev.jianyu360.cn/BaseService/gateway/common/db"
-	. "bp.jydev.jianyu360.cn/BaseService/gateway/common/gatecode"
-	"github.com/gogf/gf/v2/util/gconv"
-)
-
-var PowerCacheDb = "other"
-var PowerCacheKey = "bigmember_power_3_%s"
-
-//大会员状态redis缓存
-type BigVipBaseMsg struct {
-	Status         int `json:"status"`          //大会员状态
-	VipStatus      int `json:"vip_status"`      //超级订阅状态
-	EntnicheStatus int `json:"entniche_status"` //商机管理状态
-}
-
-/// CheckUserPower 校验账户是否有对应权益
-// userId 老用户id (mongodb里的objectid)
-// power_type 权益判断
-func CheckUserPower(userid, phone string, power_type int) error {
-	cacheKey := fmt.Sprintf(PowerCacheKey, userid)
-	userPower := BigVipBaseMsg{}
-	//判断权益
-	if bytes, err := redis.GetBytes(PowerCacheDb, cacheKey); err == nil && bytes != nil {
-		if err := json.Unmarshal(*bytes, &userPower); err != nil {
-			return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_FAIL, fmt.Sprintf("校验异常"))
-		}
-	} else {
-		//未找到缓存
-		data, ok := db.MgoJy.FindById("user", userid, `{"i_member_status":1,"i_vip_status":1}`)
-		if ok && *data != nil && len(*data) > 0 {
-			userPower.Status = gconv.Int((*data)["i_member_status"])
-			userPower.VipStatus = gconv.Int((*data)["i_vip_status"])
-		}
-	}
-	userPower.EntnicheStatus = 0
-	if count := db.JyMysql.CountBySql(`SELECT count(1) FROM entniche_user u LEFT JOIN entniche_info i
-								ON u.ent_id=i.id
-								WHERE u.phone=? and u.power=1 and i.status=1`, phone); count > 0 {
-		userPower.EntnicheStatus = 1
-	}
-	/*
-		权益判断方式、0走资源中台
-		1前置代理判断,是否是付费用户
-		2前置代理判断,是否是超级订阅
-		3前置代理判断,是否是大会员
-		4前置代理判断,是否是商机管理
-	*/
-	switch power_type {
-	case 1:
-		if userPower.VipStatus <= 0 && userPower.Status <= 0 && userPower.EntnicheStatus <= 0 {
-			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非付费用户"))
-		}
-	case 2:
-		if userPower.VipStatus <= 0 {
-			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非超级订阅用户"))
-		}
-	case 3:
-		if userPower.Status <= 0 {
-			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非大会员用户"))
-		}
-	case 4:
-		if userPower.EntnicheStatus <= 0 {
-			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非商机管理用户"))
-		}
-	case 22: //临时加大会员专家版、商机版判断
-		if !(userPower.Status == 1 || userPower.Status == 2 || userPower.Status == 6 || userPower.Status == 7) {
-			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非大会员专家版、商机版用户"))
-		}
-	}
-	return nil
-}

+ 69 - 0
core/proxy/rpc/powerCheckCenter.go

@@ -0,0 +1,69 @@
+package rpc
+
+import (
+	"fmt"
+
+	. "bp.jydev.jianyu360.cn/BaseService/gateway/common/gatecode"
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
+	"github.com/gogf/gf/v2/os/gcfg"
+	"github.com/gogf/gf/v2/os/gctx"
+	"github.com/zeromicro/go-zero/core/discov"
+	"github.com/zeromicro/go-zero/zrpc"
+)
+
+var PowerCheckCenterRpc powercheck.PowerCheck
+
+func initPowerCheckCenterRpcRpc() {
+	PowerCheckCenterRpc = powercheck.NewPowerCheck(zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Key:   gcfg.Instance().MustGet(gctx.New(), "etcd.baseserver.powerCheckCenter.key", nil).String(),
+			Hosts: gcfg.Instance().MustGet(gctx.New(), "etcd.baseserver.powerCheckCenter.address", nil).Strings(),
+		},
+	}))
+}
+
+func CheckUserPower(power_type int, appid, userId string, baseUserId, accountId, entId, positionType, positionId int64) error {
+	res, err := PowerCheckCenterRpc.Check(gctx.New(), &pb.CheckReq{
+		Appid:        appid,
+		Userid:       userId,
+		BaseUserId:   baseUserId,
+		AccountId:    accountId,
+		EntId:        entId,
+		PositionType: positionType,
+		PositionId:   positionId,
+	})
+	if err != nil {
+		return err
+	}
+	/*
+		权益判断方式、0走资源中台
+		1前置代理判断,是否是付费用户
+		2前置代理判断,是否是超级订阅
+		3前置代理判断,是否是大会员
+		4前置代理判断,是否是商机管理
+	*/
+	switch power_type {
+	case 1:
+		if res.Vip.Status <= 0 && res.Member.Status <= 0 && res.Entniche.Status <= 0 {
+			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非付费用户"))
+		}
+	case 2:
+		if res.Vip.Status <= 0 {
+			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非超级订阅用户"))
+		}
+	case 3:
+		if res.Member.Status <= 0 {
+			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非大会员用户"))
+		}
+	case 4:
+		if res.Entniche.Status <= 0 {
+			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非商机管理用户"))
+		}
+	case 22: //临时加大会员专家版、商机版判断
+		if !(res.Member.Status == 1 || res.Member.Status == 2 || res.Member.Status == 6 || res.Member.Status == 7) {
+			return NewErrorWithCode(GLOBAL_ERR_NOPOWER, fmt.Sprintf("该用户非大会员专家版、商机版用户"))
+		}
+	}
+	return nil
+}

+ 36 - 31
core/proxy/rpc/resourceCenter.go

@@ -1,15 +1,16 @@
 package rpc
 
 import (
+	"fmt"
+	"strings"
+
 	. "bp.jydev.jianyu360.cn/BaseService/gateway/common/gatecode"
 	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
 	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/resource"
-	"fmt"
 	"github.com/gogf/gf/v2/os/gcfg"
 	"github.com/gogf/gf/v2/os/gctx"
 	"github.com/zeromicro/go-zero/core/discov"
 	"github.com/zeromicro/go-zero/zrpc"
-	"strings"
 )
 
 var ResourceCenterRpc resource.Resource
@@ -24,12 +25,14 @@ func initResourceCenterRpc() {
 }
 
 // CheckResourcePower 校验账户是否有对应权益
-// eid 企业id
-// uId 新用户id;非mongodb中user表id
+// accountId 账户id
+// entAccountId 企业账户id
+// entId 企业id
+// entUserId 企业员工id
 // funcCode 业务代码
 // reqFuncCode 	 通用结构&&需要校验权限则先判断此接口是否有此functionCode的方法
 // appid 平台标识
-func CheckResourcePower(eId, uId int64, funcCodeRule, reqFuncCode, Appid string) (UseCount, SurplusCount int64, err error) {
+func CheckResourcePower(accountId, entAccountId, entId, entUserId int64, funcCodeRule, reqFuncCode, Appid string) (UseCount, SurplusCount int64, err error) {
 	funcCode := funcCodeRule
 	funcCodeArr := strings.Split(funcCodeRule, ",")
 	if reqFuncCode != "" || len(funcCodeArr) > 1 {
@@ -41,7 +44,7 @@ func CheckResourcePower(eId, uId int64, funcCodeRule, reqFuncCode, Appid string)
 			}
 		}
 		if !checkPass {
-			err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_POWERCODE_ERR, fmt.Sprintf("账户 eId:%d,uId:%d 无效funccode:%s req:%s权限", eId, uId, funcCodeRule, reqFuncCode))
+			err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_POWERCODE_ERR, fmt.Sprintf("账户 accountId:%d entAccountId:%d entId:%d entUserId:%d 无效funccode:%s req:%s权限", accountId, entAccountId, entId, entUserId, funcCodeRule, reqFuncCode))
 			return
 		}
 		funcCode = reqFuncCode
@@ -50,8 +53,10 @@ func CheckResourcePower(eId, uId int64, funcCodeRule, reqFuncCode, Appid string)
 	res, err := ResourceCenterRpc.CheckPower(gctx.New(), &pb.CheckPowerReq{
 		Appid:        Appid,
 		FunctionCode: funcCode,
-		EntId:        eId,
-		UserId:       uId,
+		AccountId:    accountId,
+		EntAccountId: entAccountId,
+		EntId:        entId,
+		EntUserId:    entUserId,
 	})
 
 	if err != nil {
@@ -61,32 +66,32 @@ func CheckResourcePower(eId, uId int64, funcCodeRule, reqFuncCode, Appid string)
 	//0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权
 	switch res.Status {
 	case 0:
-		err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_FAIL, fmt.Sprintf("账户 eId:%d,uId:%d 无业务%s权限", eId, uId, funcCode))
+		err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_FAIL, fmt.Sprintf("账户 accountId:%d entAccountId:%d entId:%d entUserId:%d 无业务%s权限", accountId, entAccountId, entId, entUserId, funcCode))
 		return
 	case -1:
-		err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_EXPIRED, fmt.Sprintf("账户 eId:%d,uId:%d 业务%s权限已过期", eId, uId, funcCode))
+		err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_EXPIRED, fmt.Sprintf("账户 accountId:%d entAccountId:%d entId:%d entUserId:%d 业务%s权限已过期", accountId, entAccountId, entId, entUserId, funcCode))
 		return
 	case -2:
-		err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTENOUGH, fmt.Sprintf("账户 eId:%d,uId:%d 业务%s权限余额不足", eId, uId, funcCode))
+		err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTENOUGH, fmt.Sprintf("账户 accountId:%d entAccountId:%d entId:%d entUserId:%d 业务%s权限余额不足", accountId, entAccountId, entId, entUserId, funcCode))
 		return
 	case -3:
-		err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTHAS, fmt.Sprintf("账户 eId:%d,uId:%d 业务%s权限无授权", eId, uId, funcCode))
+		err = NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTHAS, fmt.Sprintf("账户 accountId:%d entAccountId:%d entId:%d entUserId:%d 业务%s权限无授权", accountId, entAccountId, entId, entUserId, funcCode))
 		return
 	}
 	return res.UseCount, res.SurplusCount, nil
 }
 
 // ResourcePowerDeduct 资源中心消费
-// eid 企业id
-// uId 新用户id;非mongodb中user表id
+// accountId 账户id
+// entAccountId 企业账户id
 // funcCode 业务代码
 // deductNum 扣除数量
 // ids 扣除详情id;例如数据导出信息id等数据
-func ResourcePowerDeduct(eId, uId int64, funcCode, appId string, deductNum int64, ids []string) error {
+func ResourcePowerDeduct(accountId, entAccountId int64, funcCode, appId string, deductNum int64, ids []string) error {
 	res, err := ResourceCenterRpc.Deduction(gctx.New(), &pb.DeductionReq{
 		Appid:        appId,
-		EntId:        eId,
-		UserId:       uId,
+		AccountId:    accountId,
+		EntAccountId: entAccountId,
 		FunctionCode: funcCode,
 		Count:        deductNum,
 		Ids:          ids,
@@ -97,28 +102,28 @@ func ResourcePowerDeduct(eId, uId int64, funcCode, appId string, deductNum int64
 	//0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权
 	switch res.Status {
 	case 0:
-		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_FAIL, fmt.Sprintf("账户 eId:%d,uId:%d 扣除业务%s权限失败", eId, uId, funcCode))
+		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_FAIL, fmt.Sprintf("账户 accountId:%d entAccountId:%d 扣除业务%s权限失败", accountId, entAccountId, funcCode))
 	case -1:
-		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_EXPIRED, fmt.Sprintf("账户 eId:%d,uId:%d 扣除业务%s权限失败,权限已过期", eId, uId, funcCode))
+		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_EXPIRED, fmt.Sprintf("账户 accountId:%d entAccountId:%d 扣除业务%s权限失败,权限已过期", accountId, entAccountId, funcCode))
 	case -2:
-		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTENOUGH, fmt.Sprintf("账户 eId:%d,uId:%d 扣除业务%s权限失败,余额不足", eId, uId, funcCode))
+		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTENOUGH, fmt.Sprintf("账户 accountId:%d entAccountId:%d 扣除业务%s权限失败,余额不足", accountId, entAccountId, funcCode))
 	case -3:
-		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTHAS, fmt.Sprintf("账户 eId:%d,uId:%d 扣除业务%s权限失败", eId, uId, funcCode))
+		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTHAS, fmt.Sprintf("账户 accountId:%d entAccountId:%d 扣除业务%s权限失败", accountId, entAccountId, funcCode))
 	}
 	return nil
 }
 
 // ResourcePowerRecharge 资源中心充值
-// eid 企业id
-// uId 新用户id;非mongodb中user表id
+// accountId 账户id
+// entAccountId 企业账户id
 // funcCode 业务代码
 // deductNum 扣除数量
 // ids 扣除详情id;例如数据导出信息id等数据
-func ResourcePowerRecharge(eId, uId int64, funcCode, appId string, deductNum int64, ids []string) error {
+func ResourcePowerRecharge(accountId, entAccountId int64, funcCode, appId string, deductNum int64, ids []string) error {
 	res, err := ResourceCenterRpc.Recharge(gctx.New(), &pb.RechargeReq{
 		Appid:        appId,
-		EntId:        eId,
-		UserId:       uId,
+		AccountId:    accountId,
+		EntAccountId: entAccountId,
 		FunctionCode: funcCode,
 		Count:        deductNum,
 		Ids:          ids,
@@ -128,15 +133,15 @@ func ResourcePowerRecharge(eId, uId int64, funcCode, appId string, deductNum int
 	}
 	switch res.Status {
 	case 0:
-		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_FAIL, fmt.Sprintf("账户 eId:%d,uId:%d 充值业务%s权限失败", eId, uId, funcCode))
+		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_FAIL, fmt.Sprintf("账户 accountId:%d entAccountId:%d 充值业务%s权限失败", accountId, entAccountId, funcCode))
 	case -1:
-		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_EXPIRED, fmt.Sprintf("账户 eId:%d,uId:%d 充值业务%s权限失败,权限已过期", eId, uId, funcCode))
+		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_EXPIRED, fmt.Sprintf("账户 accountId:%d entAccountId:%d 充值业务%s权限失败,权限已过期", accountId, entAccountId, funcCode))
 	case -2:
-		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTENOUGH, fmt.Sprintf("账户 eId:%d,uId:%d 充值业务%s权限失败,余额不足", eId, uId, funcCode))
+		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTENOUGH, fmt.Sprintf("账户 accountId:%d entAccountId:%d 充值业务%s权限失败,余额不足", accountId, entAccountId, funcCode))
 	case -3:
-		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTHAS, fmt.Sprintf("账户 eId:%d,uId:%d 充值业务%s权限失败", eId, uId, funcCode))
+		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_NOTHAS, fmt.Sprintf("账户 accountId:%d entAccountId:%d 充值业务%s权限失败", accountId, entAccountId, funcCode))
 	case -4: //超出可拥有最大限额
-		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_RECHARGE_FULL, fmt.Sprintf("账户 eId:%d,uId:%d 充值业务%s权限失败", eId, uId, funcCode))
+		return NewErrorWithCode(GLOBAL_ERR_RESOURCE_PORWE_RECHARGE_FULL, fmt.Sprintf("账户 accountId:%d entAccountId:%d 充值业务%s权限失败", accountId, entAccountId, funcCode))
 	}
 
 	return nil

+ 9 - 6
core/router/session.go

@@ -28,12 +28,14 @@ type JySession struct {
 	UserPositionId    int64  //个人职位id
 	UserAccountId     int64  //个人账户id
 	EntUserPositionId int64  //企业职位id
-	EntUserName       string //企业员工姓名
-	PersonId          int64  //自然人id
-	AccountId         int64  //账户id
-	EntAccountId      int64  //企业账户id
-	PositionId        int64  //职位id
-	PositionType      int64  //职位类型
+
+	EntUserName  string //企业员工姓名
+	PersonId     int64  //自然人id
+	AccountId    int64  //账户id
+	EntAccountId int64  //企业账户id
+	PositionId   int64  //职位id
+	PositionType int64  //职位类型
+	MgoUserId    string //mongodb用户id
 
 }
 
@@ -73,6 +75,7 @@ func InitJySessionContext(r *ghttp.Request) (jSession *JySession, err error) {
 	jSession.EntAccountId = gconv.Int64(data["entAccountId"])
 	jSession.PositionId = gconv.Int64(data["positionId"])
 	jSession.PositionType = gconv.Int64(data["positionType"])
+	jSession.MgoUserId = gconv.String(data["mgoUserId"])
 
 	jSession.Data = data
 	return

+ 5 - 0
etc/config.yaml

@@ -29,6 +29,11 @@ etcd:
       key: resource.rpc
       address:
         - 192.168.3.206:2379
+    # 权益中台配置
+    powerCheckCenter:
+      key: powercheck.rpc
+      address:
+        - 192.168.3.206:2379
 
 #数据库配置
 databases:

+ 111 - 12
go.mod

@@ -1,19 +1,118 @@
 module bp.jydev.jianyu360.cn/BaseService/gateway
 
-go 1.16
+go 1.18
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20220719064915-2fef79005dfa
-	bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698
-	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.2-0.20220825072635-9aef1f62bdee
-	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20220421015128-4a36f3eac5c5
+	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
+	bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220424062752-50170a93c431
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230210052334-7b32c3b8c773
+	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.7
+	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20220905055615-8540037e1b06
 	github.com/go-redis/redis v6.15.9+incompatible
-	//github.com/gogf/gf/v2 v2.0.6
-	github.com/gogf/gf/v2 v2.1.2
-	github.com/golang/freetype v0.0.0
-	github.com/zeromicro/go-zero v1.3.5
-	go.etcd.io/etcd/client/v3 v3.5.4
-	golang.org/x/net v0.1.0
+	github.com/gogf/gf/v2 v2.3.1
+	github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
+	github.com/zeromicro/go-zero v1.4.4
+	go.etcd.io/etcd/client/v3 v3.5.7
+	golang.org/x/net v0.6.0
 )
 
-replace github.com/golang/freetype v0.0.0 => github.com/Kusers/freetype v0.0.0-20220714074437-04188d6f4e2c
+require (
+	github.com/BurntSushi/toml v1.1.0 // indirect
+	github.com/beorn7/perks v1.0.1 // indirect
+	github.com/cenkalti/backoff/v4 v4.1.3 // indirect
+	github.com/cespare/xxhash/v2 v2.1.2 // indirect
+	github.com/clbanning/mxj/v2 v2.5.5 // indirect
+	github.com/coreos/go-semver v0.3.0 // indirect
+	github.com/coreos/go-systemd/v22 v22.3.2 // indirect
+	github.com/davecgh/go-spew v1.1.1 // indirect
+	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
+	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
+	github.com/fatih/color v1.13.0 // indirect
+	github.com/felixge/fgprof v0.9.3 // indirect
+	github.com/fsnotify/fsnotify v1.5.4 // indirect
+	github.com/garyburd/redigo v1.6.2 // indirect
+	github.com/go-logr/logr v1.2.3 // indirect
+	github.com/go-logr/stdr v1.2.2 // indirect
+	github.com/go-redis/redis/v8 v8.11.5 // indirect
+	github.com/go-sql-driver/mysql v1.7.0 // indirect
+	github.com/gogo/protobuf v1.3.2 // indirect
+	github.com/golang/mock v1.6.0 // indirect
+	github.com/golang/protobuf v1.5.2 // indirect
+	github.com/golang/snappy v0.0.4 // indirect
+	github.com/gomodule/redigo v1.8.9 // indirect
+	github.com/google/go-cmp v0.5.9 // indirect
+	github.com/google/gofuzz v1.2.0 // indirect
+	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
+	github.com/googleapis/gnostic v0.5.5 // indirect
+	github.com/gorilla/websocket v1.5.0 // indirect
+	github.com/grokify/html-strip-tags-go v0.0.1 // indirect
+	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
+	github.com/jinzhu/inflection v1.0.0 // indirect
+	github.com/jinzhu/now v1.1.1 // indirect
+	github.com/json-iterator/go v1.1.12 // indirect
+	github.com/klauspost/compress v1.13.6 // indirect
+	github.com/magiconair/properties v1.8.6 // indirect
+	github.com/mattn/go-colorable v0.1.9 // indirect
+	github.com/mattn/go-isatty v0.0.14 // indirect
+	github.com/mattn/go-runewidth v0.0.13 // indirect
+	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
+	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+	github.com/modern-go/reflect2 v1.0.2 // indirect
+	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
+	github.com/nsqio/go-nsq v1.1.0 // indirect
+	github.com/olekukonko/tablewriter v0.0.5 // indirect
+	github.com/openzipkin/zipkin-go v0.4.0 // indirect
+	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
+	github.com/pkg/errors v0.9.1 // indirect
+	github.com/prometheus/client_golang v1.13.0 // indirect
+	github.com/prometheus/client_model v0.2.0 // indirect
+	github.com/prometheus/common v0.37.0 // indirect
+	github.com/prometheus/procfs v0.8.0 // indirect
+	github.com/rivo/uniseg v0.2.0 // indirect
+	github.com/spaolacci/murmur3 v1.1.0 // indirect
+	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
+	github.com/xdg-go/scram v1.1.1 // indirect
+	github.com/xdg-go/stringprep v1.0.3 // indirect
+	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
+	go.etcd.io/etcd/api/v3 v3.5.7 // indirect
+	go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
+	go.mongodb.org/mongo-driver v1.11.1 // indirect
+	go.opentelemetry.io/otel v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/jaeger v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect
+	go.opentelemetry.io/otel/sdk v1.10.0 // indirect
+	go.opentelemetry.io/otel/trace v1.10.0 // indirect
+	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
+	go.uber.org/atomic v1.9.0 // indirect
+	go.uber.org/automaxprocs v1.5.1 // indirect
+	go.uber.org/multierr v1.8.0 // indirect
+	go.uber.org/zap v1.21.0 // indirect
+	golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
+	golang.org/x/image v0.0.0-20190802002840-cff245a6509b // indirect
+	golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
+	golang.org/x/sync v0.1.0 // indirect
+	golang.org/x/sys v0.5.0 // indirect
+	golang.org/x/term v0.5.0 // indirect
+	golang.org/x/text v0.7.0 // indirect
+	golang.org/x/time v0.3.0 // indirect
+	google.golang.org/appengine v1.6.7 // indirect
+	google.golang.org/genproto v0.0.0-20221111202108-142d8a6fa32e // indirect
+	google.golang.org/grpc v1.51.0 // indirect
+	google.golang.org/protobuf v1.28.1 // indirect
+	gopkg.in/inf.v0 v0.9.1 // indirect
+	gopkg.in/yaml.v2 v2.4.0 // indirect
+	gopkg.in/yaml.v3 v3.0.1 // indirect
+	gorm.io/driver/mysql v1.0.5 // indirect
+	gorm.io/gorm v1.21.3 // indirect
+	k8s.io/api v0.22.9 // indirect
+	k8s.io/apimachinery v0.22.9 // indirect
+	k8s.io/client-go v0.22.9 // indirect
+	k8s.io/klog/v2 v2.80.1 // indirect
+	k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 // indirect
+	sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
+	sigs.k8s.io/yaml v1.2.0 // indirect
+)

Разница между файлами не показана из-за своего большого размера
+ 536 - 40
go.sum


Некоторые файлы не были показаны из-за большого количества измененных файлов