Browse Source

Merge branch 'feature/v1.2.1' of http://192.168.3.207:8080/BaseService/userCenter into feature/v1.2.1

wangshan 2 years ago
parent
commit
00e6f1d149

+ 0 - 1
README.md

@@ -1,5 +1,4 @@
 用户/企业中台
-
 $ goctl rpc protoc userCenter.proto --go_out=. --go-grpc_out=. --zrpc_out=.
 
 $ goctl rpc proto -src userCenter.proto -dir .

+ 1 - 1
api/etc/usercenter-api.yaml

@@ -10,7 +10,7 @@ UserCenterRpcConf:
 GatewayRpcConf:
   Etcd:
     Hosts:
-      -  127.0.0.1:2379
+      -  192.168.3.206:2379
     Key: gatewayDemo.rpc
 Timeout:  5000
 Logx:

+ 29 - 0
api/internal/handler/getentuserinfohandler.go

@@ -0,0 +1,29 @@
+package handler
+
+import (
+	"net/http"
+
+	"userCenter/api/internal/logic"
+	"userCenter/api/internal/svc"
+	"userCenter/api/internal/types"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func GetEntUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.EntUserReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := logic.NewGetEntUserInfoLogic(r.Context(), svcCtx)
+		resp, err := l.GetEntUserInfo(&req)
+		if err != nil {
+			httpx.Error(w, err)
+		} else {
+			httpx.OkJson(w, resp)
+		}
+	}
+}

+ 29 - 0
api/internal/handler/getuserinfohandler.go

@@ -0,0 +1,29 @@
+package handler
+
+import (
+	"net/http"
+
+	"userCenter/api/internal/logic"
+	"userCenter/api/internal/svc"
+	"userCenter/api/internal/types"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func GetUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.UserReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := logic.NewGetUserInfoLogic(r.Context(), svcCtx)
+		resp, err := l.GetUserInfo(&req)
+		if err != nil {
+			httpx.Error(w, err)
+		} else {
+			httpx.OkJson(w, resp)
+		}
+	}
+}

+ 10 - 0
api/internal/handler/routes.go

@@ -72,6 +72,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/userCenter/workDesktop/clearUserInfo",
 				Handler: WorkDesktopClearUserInfoHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/userCenter/user/getUserInfo",
+				Handler: GetUserInfoHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/userCenter/ent/userInfo",
+				Handler: GetEntUserInfoHandler(serverCtx),
+			},
 		},
 	)
 

+ 56 - 0
api/internal/logic/getentuserinfologic.go

@@ -0,0 +1,56 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"userCenter/entity"
+
+	"userCenter/rpc/pb"
+
+	"userCenter/api/internal/svc"
+	"userCenter/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetEntUserInfoLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetEntUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetEntUserInfoLogic {
+	return &GetEntUserInfoLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *GetEntUserInfoLogic) GetEntUserInfo(req *types.EntUserReq) (resp *types.Resp, err error) {
+	// todo: add your logic here and delete this line
+	resp = &types.Resp{Data: nil}
+	res, err := entity.UserCenterRpc.GetEntUserInfo(l.ctx, &pb.EntUserReq{
+		AppId:     req.AppId,
+		EntUserId: req.EntUserId,
+	})
+	if res == nil {
+		resp = &types.Resp{Data: nil, Error_msg: "暂无数据", Error_code: -1}
+		return
+	}
+	if res.ErrorMsg != "" {
+		resp.Error_msg = res.ErrorMsg
+		resp.Error_code = -1
+		l.Error(fmt.Sprintf("%+v", req), res.ErrorMsg)
+	} else {
+		data := map[string]interface{}{
+			"name":     res.Data.Name,
+			"phone":    res.Data.Phone,
+			"deptName": res.Data.DeptName,
+			"mail":     res.Data.Mail,
+		}
+		resp.Data = data
+	}
+	return
+}

+ 78 - 0
api/internal/logic/getuserinfologic.go

@@ -0,0 +1,78 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"userCenter/rpc/pb"
+
+	"userCenter/api/internal/svc"
+	"userCenter/api/internal/types"
+	"userCenter/entity"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetUserInfoLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
+	return &GetUserInfoLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *GetUserInfoLogic) GetUserInfo(req *types.UserReq) (resp *types.Resp, err error) {
+	// todo: add your logic here and delete this line
+	resp = &types.Resp{}
+	userId := int64(req.UserId)
+	if req.Uid != "" {
+		//解密userid
+		decode_userid := encrypt.SE.Decode4Hex(req.Uid)
+		userId = common.Int64All(decode_userid)
+
+	}
+
+	res, err := entity.UserCenterRpc.GetUserInfo(l.ctx, &pb.UserReq{
+		AppId:  req.AppId,
+		UserId: int64(userId),
+		Types:  req.Types,
+	})
+	if err != nil || res == nil {
+		resp.Error_msg = ""
+		resp.Error_code = -1
+		l.Error("get user info error:", err)
+		return
+	}
+	if res.ErrorMsg != "" {
+		resp.Error_msg = res.ErrorMsg
+		resp.Error_code = -1
+		l.Error(fmt.Sprintf("%+v", req), res.ErrorMsg)
+	} else {
+		data := map[string]interface{}{
+			"start_time":      res.Data.StartTime,
+			"end_time":        res.Data.EndTime,
+			"area":            res.Data.Area,
+			"matchway":        res.Data.Matchway,
+			"items":           res.Data.Items,
+			"projectmatch":    res.Data.Projectmatch,
+			"infotype":        res.Data.Infotype,
+			"types":           res.SubscribeType, //订阅设置类型 f:免费订阅 v:超级订阅 m:大会员订阅 e:商机管理订阅
+			"vip_status":      res.VipStatus,
+			"member_status":   res.MemberStatus,
+			"entniche_status": res.EntnicheStatus,
+			"phone":           res.Phone,
+			"nickname":        res.Nickname,
+			"headimg":         res.Headimg,
+		}
+		resp.Data = data
+	}
+	return
+}

+ 12 - 0
api/internal/types/types.go

@@ -186,6 +186,18 @@ type GetStatus struct {
 	IsInEnt    bool  `json:"isInEnt"`
 }
 
+type UserReq struct {
+	AppId  string `header:"appId,default=10000"`
+	UserId int    `header:"newUserId,optional"` //session中的用户base_user_id
+	Uid    string `json:"uid,optional"`         //前端传的uid
+	Types  string `json:"types,optional"`       //类型,不传按默认规则获取 m大会员 e商机管理 v超级订阅 f免费订阅
+}
+
+type EntUserReq struct {
+	AppId     string `header:"appId,default=10000"`
+	EntUserId int64  `json:"entUserId"`
+}
+
 type UserAddReq struct {
 	Authorization string `header:"Authorization"`
 	Appid         string `json:"appid"`

+ 17 - 0
api/userCenter.api

@@ -199,6 +199,18 @@ type (
 		IsInEnt    bool  `json:"isInEnt"`
 	}
 
+	UserReq {
+		AppId  string `header:"appId,default=10000"`
+		UserId int    `header:"newUserId,optional"` //session中的用户base_user_id
+		Uid    string `json:"uid,optional"`         //前端传的uid
+		Types  string `json:"types,optional"`       //类型,不传按默认规则获取 m大会员 e商机管理 v超级订阅 f免费订阅
+	}
+
+	EntUserReq {
+		AppId     string `header:"appId,default=10000"`
+		EntUserId int64  `json:"entUserId"`
+	}
+
 	UserAddReq {
 		Authorization string `header:"Authorization"`
 		Appid         string `json:"appid"`
@@ -295,6 +307,11 @@ service userCenter-api {
 	post /userCenter/workDesktop/renew/:actionMode (WorkDesktopComprehensiveReq) returns (CommonResp)
 	@handler WorkDesktopClearUserInfo
 	get /userCenter/workDesktop/clearUserInfo (WorkDesktopClearUserInfo) returns (CommonResp)
+	
+	@handler GetUserInfo
+	post /userCenter/user/getUserInfo(UserReq)returns(resp)
+	@handler GetEntUserInfo
+	post  /userCenter/ent/userInfo(EntUserReq)returns(resp)
 }
 
 @server(

+ 1 - 1
entity/db.go

@@ -6,9 +6,9 @@ import (
 )
 
 var (
+	Mgo               mongodb.MongodbSim
 	Mysql             *mysql.Mysql
 	BaseMysql         *mysql.Mysql
 	UserTable         = "base_user"
 	UserSnapshotTable = "base_user_snapshot"
-	Mgo               mongodb.MongodbSim
 )

+ 149 - 16
entity/ent.go

@@ -10,6 +10,7 @@ import (
 	"time"
 
 	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	resourcepb "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
 	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/resource"
@@ -305,12 +306,12 @@ func (this *Examine) EntExamine() bool {
 
 		//开通权限
 		req := &resourcepb.PowerReq{
-			Appid:     "10000",
-			GoodsCode: GOODSCODE_XXFB,
-			EntId:     this.EntId,
-			StartTime: now.Format(Date_Full_Layout),
-			EndTime:   end.AddDate(1, 0, 0).Format(Date_Full_Layout),
-			Type:      1,
+			Appid:       "10000",
+			GoodsCode:   GOODSCODE_XXFB,
+			EntId:       this.EntId,
+			Type:        1,
+			GoodsSpecId: 4,
+			BuyNum:      1,
 		}
 		resp, err := this.ResourceLib.PowerHandle(context.Background(), req)
 		//0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权
@@ -593,10 +594,11 @@ type UpdateEnt struct {
 func (this *UpdateEnt) UpdateEnt() (int64, string) {
 	needUpdate := false
 	req := &resourcepb.PowerReq{
-		Appid:     "10000",
-		GoodsCode: GOODSCODE_XXFB,
-		EntId:     this.EntId,
-		Type:      1, //1:开通权益 -1:取消权益
+		Appid:       "10000",
+		GoodsCode:   GOODSCODE_XXFB,
+		EntId:       this.EntId,
+		Type:        1, //1:开通权益 -1:取消权益
+		GoodsSpecId: 4,
 	}
 	//解冻
 	rdata := this.Mysql.FindOne(Entniche_info, map[string]interface{}{
@@ -606,12 +608,6 @@ func (this *UpdateEnt) UpdateEnt() (int64, string) {
 		if auth_status := common.Int64All((*rdata)["auth_status"]); auth_status == 1 {
 			needUpdate = true
 		}
-		if starttime := common.ObjToString((*rdata)["auth_startTime"]); starttime != "" {
-			req.StartTime = starttime
-		}
-		if endtime := common.ObjToString((*rdata)["auth_endTime"]); endtime != "" {
-			req.EndTime = endtime
-		}
 	}
 	if this.UpdateType == 2 {
 		this.UpdateType = 0
@@ -725,3 +721,140 @@ func (this *GetStatusByCodeStruct) GetStatusByCode() (int, bool, string) {
 	}
 	return authStatus, isin, ""
 }
+
+//根据id获取企业信息
+func (e *EntInfo) GetById(id int) *EntInfo {
+	r := e.Mysql.FindOne(Entniche_info, map[string]interface{}{"id": id}, "*", "")
+	entInfo, _ := common.JsonUnmarshal(r, &EntInfo{}).(*EntInfo)
+	if entInfo == nil {
+		return &EntInfo{}
+	}
+	return entInfo
+}
+
+type EntDeptParent struct {
+	Id  int
+	Pid int
+}
+type EntDept struct {
+	Id     int
+	Pid    int
+	Name   string
+	Nodiff int
+	Subdis int
+}
+
+type EntDistribute struct {
+	Id         string
+	DeptId     int
+	Area       map[string]interface{}
+	Buyerclass []interface{}
+	Items      []string
+}
+
+type EntRuleUser struct {
+	UserId int
+	RuleId string
+}
+
+//查找父级部门(跨级)
+func GetEntDeptParent(mysq *mysql.Mysql, entParentDept map[int][]*EntDeptParent, deptid int) map[int][]*EntDeptParent {
+
+	//先获取用户组织架构权益
+	//查找父级部门(跨级)
+	list := mysq.SelectBySql(`select id,pid from entniche_department_parent where id =?`, deptid)
+	for _, v := range *list {
+		id := common.IntAll(v["id"])
+		pid := common.IntAll(v["pid"])
+		entParentDept[id] = append(entParentDept[id], &EntDeptParent{
+			Id:  id,
+			Pid: pid,
+		})
+	}
+	return entParentDept
+}
+
+//查看部门相关设置
+func GetEntDepts(mysq *mysql.Mysql, entDepts map[int]*EntDept, entid int64) map[int]*EntDept {
+
+	//查看部门相关设置
+	lis := mysq.SelectBySql(`select * from entniche_department where ent_id=?`, entid)
+	for _, v := range *lis {
+		//获取部门相关
+		deptid := common.IntAll(v["id"])
+		pid := common.IntAll(v["pid"])
+		name := common.ObjToString(v["name"])
+		subdis := common.IntAll(v["subdis"])
+		nodiff := common.IntAll(v["nodiff"])
+		entDepts[deptid] = &EntDept{
+			Id:     deptid,
+			Pid:    pid,
+			Name:   name,
+			Nodiff: nodiff,
+			Subdis: subdis,
+		}
+	}
+	return entDepts
+}
+
+//获取某个用户的所有分发规则
+func GetUserRules(mysq *mysql.Mysql, entUserId int64) map[int][]*EntRuleUser {
+	entUserRules := map[int][]*EntRuleUser{} //用户下所有的分发规则
+	// 分发规则遍历  查询用户是否有被分发的规则
+	data := mysq.SelectBySql(`SELECT * FROM entniche_user_rule WHERE  user_id=?`, entUserId)
+	if data != nil {
+		for _, v := range *data {
+			ruleId := common.ObjToString(v["rule_id"])
+			userId := common.IntAll(v["user_id"])
+			entRuleUser := &EntRuleUser{
+				UserId: userId,
+				RuleId: ruleId,
+			}
+			entUserRules[userId] = append(entUserRules[userId], entRuleUser)
+
+		}
+	}
+
+	return entUserRules
+}
+
+//获取企业下的所有分发规则详情
+func GetEntDistribute(mgo mongodb.MongodbSim, entId int64) map[string]*EntDistribute {
+	entDis := map[string]*EntDistribute{} //分发规则的相关设置
+
+	//获取具体分发规则
+	disData, ok := mgo.Find("entniche_distribute", map[string]interface{}{
+		"i_status": map[string]interface{}{"$ne": 1},
+		"i_entid":  entId,
+	}, nil, nil, false, -1, -1)
+	if ok && disData != nil && len(*disData) > 0 {
+		for _, v := range *disData {
+			deptId := common.IntAll(v["i_deptid"])
+			a_items, _ := v["a_items"].([]interface{})
+			o_area, _ := v["o_area"].(map[string]interface{})
+			a_buyerclass, _ := v["a_buyerclass"].([]interface{})
+			ruleId := mongodb.BsonIdToSId(v["_id"])
+			entDis[ruleId] = &EntDistribute{
+				Id:         ruleId,
+				DeptId:     deptId,
+				Area:       o_area,
+				Buyerclass: a_buyerclass,
+				Items:      common.ObjArrToStringArr(a_items),
+			}
+		}
+	}
+	return entDis
+}
+
+//根据手机号获取用户商机管理企业
+func GetEntByPhone(mys *mysql.Mysql, phone string) (entId, entUserId int64) {
+	data := mys.SelectBySql(`SELECT a.id entid,b.id as user_id from entniche_info a 
+   					 INNER JOIN entniche_user b on (b.phone=? and a.id=b.ent_id and a.status=1 and b.power=1) 
+   					 ORDER BY if(a.createtime<b.createtime,b.createtime,a.createtime) desc limit 1`, phone)
+	if data != nil && len(*data) > 0 {
+		entId := common.Int64All((*data)[0]["entid"])
+		entUserId := common.Int64All((*data)[0]["user_id"])
+		return entId, entUserId
+	}
+	return 0, 0
+}

+ 157 - 0
entity/entUser.go

@@ -0,0 +1,157 @@
+package entity
+
+import (
+	"encoding/json"
+	"fmt"
+
+	"userCenter/rpc/usercenter"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mysql"
+)
+
+type EntUserInfo struct {
+	AppId     string
+	EntUserId int64
+	EntId     int64
+	Mysql     *mysql.Mysql
+}
+type User struct {
+	Name      string //员工姓名
+	Mail      string //邮箱
+	Phone     string //手机号
+	Dept_name string //部门名称
+	EntUserId int64
+}
+
+//获取员工信息
+func (this *EntUserInfo) GetEntUserInfo() (*User, string) {
+	data := this.Mysql.SelectBySql(`SELECT a.name,a.phone,a.mail,c.name AS dept_name,a.id as entUserId FROM entniche_user a 
+		INNER JOIN entniche_department_user b ON (a.id=? AND a.id=b.user_id) 
+		INNER JOIN entniche_department c ON (b.dept_id=c.id)
+		WHERE a.ent_id=?`, this.EntUserId, this.EntId)
+	if data == nil || len(*data) == 0 {
+		return nil, "暂无数据"
+	}
+	users, _ := common.JsonUnmarshal(data, &[]*User{}).(*[]*User)
+
+	return (*users)[0], ""
+}
+
+//1企业管理员 2部门管理员 3员工
+func (this *EntUserInfo) CheckEntAdmin() (int64, string) {
+	if count := this.Mysql.CountBySql(`select count(1) from entniche_user where id =? and ent_id =?`, this.EntUserId, this.EntId); count <= 0 {
+		return -1, "暂无数据"
+	}
+	if data := this.Mysql.SelectBySql(`select role_id from entniche_user_role where user_id =?`, this.EntUserId); data != nil && len(*data) > 0 {
+		rule := common.Int64All((*data)[0]["role_id"])
+		return rule, ""
+	}
+	return 3, ""
+}
+
+type EntUserList struct {
+	EntId  int64
+	DeptId int64
+	Name   string
+	Mysql  *mysql.Mysql
+}
+
+func (this *EntUserList) GetEntUserList() ([]*usercenter.EntUserListData, string) {
+	sql := `SELECT a.id,a.pid,a.name,c.id AS user_id,c.name AS user_name,c.mail AS user_mail, c.phone AS user_phone ,ed.name AS fdept FROM entniche_department a 
+			INNER JOIN entniche_department_user b ON (a.ent_id=? AND a.id=b.dept_id) 
+			INNER JOIN entniche_user c ON (b.user_id=c.id) 
+			LEFT JOIN entniche_department ed ON (a.pid=ed.id)`
+	if this.Name != "" {
+		sql += `where c.name like "%` + this.Name + `%"`
+	}
+	sql += `ORDER BY a.id,CONVERT(c.name USING gbk) COLLATE gbk_chinese_ci ASC`
+	data := this.Mysql.SelectBySql(sql, this.EntId)
+	listMap := map[int64][]*usercenter.EntUser{}
+	if data != nil {
+		for _, v := range *data {
+			id := common.Int64All(v["id"])
+			listMap[id] = append(listMap[id], &usercenter.EntUser{
+				Name:      common.ObjToString(v["user_name"]),
+				Phone:     common.ObjToString(v["user_phone"]),
+				Mail:      common.ObjToString(v["user_mail"]),
+				DeptName:  common.ObjToString(v["name"]),
+				EntUserId: common.Int64All(v["user_id"]),
+			})
+		}
+	}
+	deptData := &[]map[string]interface{}{}
+	//获取部门层级关系
+	if this.DeptId > 0 {
+		deptData = this.Mysql.SelectBySql(`select a.id,a.name,a.pid from entniche_department a 
+							inner join entniche_department_parent b on (a.ent_id=? and b.pid=? and a.id =b.id)`, this.EntId, this.DeptId)
+	} else {
+		deptData = this.Mysql.SelectBySql(`select id,name,pid from entniche_department where ent_id=?`, this.EntId)
+	}
+	deptList := []*usercenter.EntUserListData{}
+	ret := []*usercenter.EntUserListData{}
+
+	if len(*deptData) > 0 {
+		for _, v := range *deptData {
+			deptList = append(deptList, &usercenter.EntUserListData{
+				DeptId:      common.Int64All(v["id"]),
+				Name:        common.ObjToString(v["name"]),
+				PId:         common.Int64All(v["pid"]),
+				EntUserList: listMap[common.Int64All(v["id"])],
+				DeptList:    []*usercenter.EntUserListData{},
+			})
+		}
+		//创建根
+		root := []*usercenter.EntUserListData{deptList[0]}
+		//获取根上部门
+		pdept := make([]*usercenter.EntUserListData, 0)
+		for i, _ := range deptList {
+			var a *usercenter.EntUserListData
+			a = deptList[i]
+			pdept = append(pdept, a)
+		}
+		//
+		for _, v := range root {
+			makeTree(pdept, v)
+			data, _ := json.Marshal(&v)
+			fmt.Println(string(data))
+			ret = append(ret, v)
+		}
+	}
+	if len(ret) == 0 {
+		return ret, "暂无数据"
+	}
+	return ret, ""
+}
+
+func has(v1 usercenter.EntUserListData, vs []*usercenter.EntUserListData) bool {
+	var has bool
+	has = false
+	for _, v2 := range vs {
+		v3 := *v2
+		if v1.PId == v3.DeptId {
+			has = true
+			break
+		}
+	}
+	return has
+}
+
+func makeTree(vs []*usercenter.EntUserListData, node *usercenter.EntUserListData) {
+	childs := findChild(node, vs)
+	for _, child := range childs {
+		node.DeptList = append(node.DeptList, child)
+		if has(*child, vs) {
+			makeTree(vs, child)
+		}
+	}
+}
+
+func findChild(v *usercenter.EntUserListData, vs []*usercenter.EntUserListData) (ret []*usercenter.EntUserListData) {
+	for _, v2 := range vs {
+		if v.DeptId == v2.PId {
+			ret = append(ret, v2)
+		}
+	}
+	return
+}

+ 84 - 0
entity/entniche.go

@@ -0,0 +1,84 @@
+package entity
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mysql"
+)
+
+var VarCurrentUser = &CurrentUser{}
+
+//当前登录用户
+type CurrentUser struct {
+	Role_admin_department bool        //是否是部门管理员
+	Role_admin_system     bool        //是否是系统管理员
+	Ent                   *EntInfo    //企业信息
+	Dept                  *Department //部门信息
+	BondPhone             string      //手机号
+	NickName              string      //昵称
+	HeadImageUrl          string      //头像
+	PersonalAuth          int         //个人认证
+	PersonalAuthReason    string      //个人认证不通过原因
+	User_power            int         //是否分配权限
+	User_name             string      //用户姓名
+	Mysql                 *mysql.Mysql
+}
+
+type Department struct {
+	Id         int
+	Name       string //公司名
+	Pid        int    //上级部门id
+	Pname      string //上级部门名称
+	Nodiff     int    //全员无差别接收 0:关闭 1:打开
+	Subdis     int    //订阅分发 0:关闭 1:打开
+	Aid        int    //管理员id
+	Aname      string //管理员姓名
+	User_count int    //该部门下员工的总数
+	Dept_count int    //该部门下子部门总数
+}
+
+//当前登录用户的信息
+func (this *CurrentUser) EntInfo(entId, entUserId int) *CurrentUser {
+	currentUser := &CurrentUser{
+		Ent:  &EntInfo{},
+		Dept: &Department{},
+	}
+	varentinfo := &EntInfo{
+		Mysql: this.Mysql,
+	}
+	currentUser.Ent = varentinfo.GetById(entId)
+	user := this.Mysql.SelectBySql(`SELECT a.name as user_name from entniche_user a INNER JOIN entniche_user_role b on (a.id=b.user_id) where a.id=? and b.role_id=? limit 1`, entUserId, Role_admin_system)
+	if user != nil && len(*user) > 0 {
+		currentUser.Role_admin_system = true
+		currentUser.User_name, _ = (*user)[0]["user_name"].(string)
+		currentUser.User_power = 1
+		r := this.Mysql.SelectBySql(`SELECT id,name,subdis,nodiff from entniche_department where ent_id=? and pid=0 limit 1`, entId)
+		if r != nil && len(*r) == 1 {
+			department := common.JsonUnmarshal((*r)[0], &Department{}).(*Department)
+			if department != nil {
+				department.Pid = department.Id
+				currentUser.Dept = department
+			}
+		}
+	} else {
+		//角色、权限
+		r := this.Mysql.SelectBySql(`SELECT a.name as user_name,a.power as user_power,b.role_id,d.id as dept_id,d.name as dept_name,d.subdis as dept_subdis,d.nodiff as dept_nodiff,e.id as dept_pid from entniche_user a 
+			LEFT JOIN entniche_user_role b on (b.user_id=?) 
+			INNER JOIN entniche_department_user c on (a.id=? and a.id=c.user_id) 
+			INNER JOIN entniche_department d on (c.dept_id=d.id) 
+			INNER JOIN entniche_department e on (e.ent_id=? and e.pid=0) 
+			order by a.id desc limit 1`, entUserId, entUserId, entId)
+		if r != nil && len(*r) == 1 {
+			currentUser.User_name, _ = (*r)[0]["user_name"].(string)
+			currentUser.User_power = common.IntAll((*r)[0]["user_power"])
+			if common.IntAll((*r)[0]["role_id"]) == Role_admin_department {
+				currentUser.Role_admin_department = true
+			}
+			currentUser.Dept.Id = common.IntAll((*r)[0]["dept_id"])
+			currentUser.Dept.Pid = common.IntAll((*r)[0]["dept_pid"])
+			currentUser.Dept.Name = common.ObjToString((*r)[0]["dept_name"])
+			currentUser.Dept.Subdis = common.IntAll((*r)[0]["dept_subdis"])
+			currentUser.Dept.Nodiff = common.IntAll((*r)[0]["dept_nodiff"])
+		}
+	}
+	return currentUser
+}

+ 296 - 0
entity/subscribe.go

@@ -0,0 +1,296 @@
+package entity
+
+import (
+	"log"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/mysql"
+)
+
+//获取用户状态
+type UserInfoReq struct {
+	Mysql     *mysql.Mysql
+	Mgo       mongodb.MongodbSim
+	UserId    int64  //base_user_id  不是 mongodb的userid!
+	Types     string //不传取默认规则
+	EntId     int64
+	EntUserId int64
+}
+
+//默认规则:优先大会员、商机管理、超级订阅、免费订阅
+func (this *UserInfoReq) GetUserInfo() (ret map[string]interface{}, msg string) {
+	data := this.userInfo()
+	ret = map[string]interface{}{}
+	if data == nil {
+		return nil, "未查询到用户信息"
+	}
+	//获取用户权益
+	vip_status := common.IntAll((*data)["i_vip_status"])       //超级订阅
+	member_status := common.IntAll((*data)["i_member_status"]) //大会员
+	//获取商机管理信息
+	phone := common.ObjToString((*data)["s_phone"])
+	if phone == "" {
+		phone = common.ObjToString((*data)["s_m_phone"])
+	}
+	varentinfo := &EntInfo{Mysql: this.Mysql} //商机管理
+	this.EntId, this.EntUserId = GetEntByPhone(this.Mysql, phone)
+	entinfo := varentinfo.GetById(int(this.EntId))
+	entniche_status := entinfo.Status
+	//用户相关订阅设置
+	object := &map[string]interface{}{}
+	if this.Types == "" {
+		if member_status > 0 {
+			this.Types = "m"
+		} else if entniche_status > 0 {
+			this.Types = "e"
+		} else if vip_status > 0 {
+			this.Types = "v"
+		} else {
+			this.Types = "f"
+		}
+	}
+	switch this.Types {
+	case "m":
+		//大会员
+		if (*data)["o_member_jy"] != nil {
+			memberJy := common.ObjToMap((*data)["o_member_jy"])
+			object = this.format(memberJy)
+			(*object)["starttime"] = (*data)["i_member_starttime"]
+			(*object)["endtime"] = (*data)["i_member_endtime"]
+		}
+	case "e":
+		//商机管理
+		entnicheJy := this.EntnicheSub()
+		log.Println("~~~", entnicheJy)
+		if entnicheJy != nil {
+			object = this.format(entnicheJy)
+		}
+	case "v":
+		//超级订阅
+		if (*data)["o_vipjy"] != nil {
+			vipJy := common.ObjToMap((*data)["o_vipjy"])
+			object = this.format(vipJy)
+			(*object)["starttime"] = (*data)["l_vip_starttime"]
+			(*object)["endtime"] = (*data)["l_vip_endtime"]
+		}
+
+	case "f":
+		if (*data)["o_jy"] != nil {
+			ojy := common.ObjToMap((*data)["o_jy"])
+			if (*ojy)["a_key"] != nil {
+				akey := common.ObjArrToMapArr((*ojy)["a_key"].([]interface{}))
+				(*object)["a_items"] = []map[string]interface{}{ //转换至和其它结构一致
+					map[string]interface{}{
+						"a_key": akey,
+					},
+				}
+			}
+			if (*ojy)["o_area"] == nil {
+				(*object)["o_area"] = map[string]interface{}{}
+			} else {
+				(*object)["o_area"] = (*ojy)["o_area"]
+			}
+		}
+	}
+	//
+	ret["area"] = (*object)["o_area"]
+	ret["items"] = (*object)["a_items"]
+	ret["matchway"] = common.If((*object)["i_matchway"] == nil, 1, (*object)["i_matchway"]) //没有则,默认1
+	ret["buyerclass"] = common.If((*object)["a_buyerclass"] == nil, []string{}, (*object)["a_buyerclass"])
+	ret["infotype"] = common.If((*object)["a_infotype"] == nil, []string{}, (*object)["a_infotype"])
+	ret["projectmatch"] = common.If((*object)["i_projectmatch"] == nil, 0, (*object)["i_projectmatch"])
+	ret["starttime"] = (*object)["starttime"]
+	ret["endtime"] = (*object)["endtime"]
+
+	ret["phone"] = phone
+	ret["vipStatus"] = vip_status
+	ret["memberStatus"] = member_status
+	ret["entnicheStatus"] = entniche_status
+	ret["subscribeType"] = this.Types
+	nickname := common.ObjToString((*data)["s_nickname"])
+	if nickname == "" && phone != "" && len(phone) == 11 {
+		nickname = string(phone[0:3]) + "****" + string(phone[len(phone)-4:])
+	}
+	if nickname == "" {
+		nickname = common.ObjToString((*data)["s_jyname"])
+	}
+	ret["nickname"] = nickname
+	headimg := common.ObjToString((*data)["s_headimageurl"])
+	ret["headimg"] = headimg
+	if headimg == "" {
+		ret["headimg"] = common.ObjToString((*data)["s_headimage"])
+	}
+	return ret, ""
+}
+
+//获取mongodb user表相关数据
+func (this *UserInfoReq) userInfo() *map[string]interface{} {
+	data, ok := this.Mgo.FindOneByField("user", map[string]interface{}{"base_user_id": this.UserId}, `{"i_vip_status":1,"l_vip_starttime":1,"l_vip_endtime":1,"i_member_status":1,"i_member_starttime":1,"i_member_endtime":1,"o_jy":1,"o_vipjy":1,"o_member_jy":1,"s_phone":1,"s_m_phone":1,"s_nickname":1,"s_jyname":1,"s_headimageurl":1,"s_headimage":1}`)
+	if ok && data != nil && len(*data) > 0 {
+		return data
+	}
+	return nil
+}
+
+//格式化数据 大会员/超级订阅/商机管理 结构一致 关键词格式化
+func (this *UserInfoReq) format(data *map[string]interface{}) *map[string]interface{} {
+	if data == nil {
+		return nil
+	}
+	//关键词
+	if (*data)["a_items"] != nil {
+		a_items := common.ObjArrToMapArr((*data)["a_items"].([]interface{}))
+		for k, v := range a_items {
+			if v["a_key"] != nil {
+				a_keys := []map[string]interface{}{}
+				ak, ok := v["a_key"].([]interface{})
+				if !ok {
+					a_keys, _ = v["a_key"].([]map[string]interface{})
+				} else {
+					a_keys = common.ObjArrToMapArr(ak)
+
+				}
+				for kk, vv := range a_keys {
+					if vv["key"] != nil {
+						keyArr, ok1 := vv["key"].([]interface{})
+						if ok1 {
+							if vv["appendkey"] != nil {
+								appendkeyArr, ok2 := vv["appendkey"].([]interface{})
+								if ok2 {
+									key := common.ObjArrToStringArr(keyArr)
+									appendkey := common.ObjArrToStringArr(appendkeyArr)
+									a_keys[kk]["key"] = append(key, appendkey...)
+								}
+							}
+						}
+					}
+					delete(a_keys[kk], "appendkey")
+				}
+				a_items[k]["a_key"] = a_keys
+			}
+		}
+		(*data)["a_items"] = a_items
+	}
+
+	return data
+}
+
+//商机管理订阅设置
+func (this *UserInfoReq) EntnicheSub() *map[string]interface{} {
+	currentUser := &CurrentUser{
+		Mysql: this.Mysql,
+	}
+	entInfo := currentUser.EntInfo(int(this.EntId), int(this.EntUserId))
+	model := entInfo.Ent.Model //1-统一订阅 2-个人订阅
+	if entInfo.User_power != 1 {
+		//用户暂无权限
+		return nil
+	}
+	res := &map[string]interface{}{}
+	switch model {
+	case 1:
+		deptId := entInfo.Dept.Id
+		nodiff := false
+		res_ := map[string]interface{}{} //临时map
+		//我所有的父部门
+		EntParentDept := map[int][]*EntDeptParent{}
+
+		//先获取用户组织架构权益
+		EntParentDept = GetEntDeptParent(this.Mysql, EntParentDept, deptId)
+
+		EntDepts := map[int]*EntDept{}
+		EntDepts = GetEntDepts(this.Mysql, EntDepts, this.EntId)
+
+		// //用户下所有的分发规则
+		EntUserRules := GetUserRules(this.Mysql, this.EntUserId)
+
+		///分发规则的相关设置
+		EntDis := GetEntDistribute(this.Mgo, this.EntId)
+
+		//我的上级部门
+		for _, v := range EntParentDept[entInfo.Dept.Id] {
+			//看我的上级部门,有没有开启订阅分发
+			if EntDepts[v.Pid].Subdis == 0 {
+				log.Println("暂未开启订阅设置")
+				return nil
+			}
+			//看我的上级部门,有没有全员无差别接收
+			if EntDepts[v.Pid].Nodiff == 1 {
+				log.Println(EntDepts[v.Pid].Name, EntDepts[v.Pid].Id, "开启全员无差别")
+				deptId = EntDepts[v.Pid].Id
+				nodiff = true
+				break
+			}
+			log.Println(len(EntUserRules[common.IntAll(this.EntUserId)]) > 0)
+			//看我的上级部门,有没有给我设置分发规则
+			if !nodiff && len(EntUserRules[common.IntAll(this.EntUserId)]) > 0 {
+				for _, v := range EntUserRules[common.IntAll(this.EntUserId)] {
+					//获取关键词组相关
+					ruleData, _ := this.Mgo.FindOne("entniche_rule", map[string]interface{}{
+						"i_deptid": EntDis[v.RuleId].DeptId,
+						"i_entid":  this.EntId,
+					})
+					o_entniche, _ := (*ruleData)["o_entniche"].(map[string]interface{})
+					itemMap := map[string]interface{}{}
+					items, _ := o_entniche["a_items"].([]interface{})
+					for _, v := range items {
+						item, _ := v.(map[string]interface{})
+						if item == nil {
+							continue
+						}
+						item_name, _ := item["s_item"].(string)
+						if item_name == "" {
+							continue
+						}
+						itemMap[item_name] = item
+					}
+					a_items := []interface{}{}
+					for _, v := range EntDis[v.RuleId].Items {
+						m := map[string]interface{}{
+							"s_item": v,
+							"a_key":  (*common.ObjToMap(itemMap[v]))["a_key"],
+						}
+						a_items = append(a_items, m)
+					}
+					(res_)["a_buyerclass"] = EntDis[v.RuleId].Buyerclass
+					(res_)["a_items"] = a_items
+					(res_)["o_area"] = EntDis[v.RuleId].Area
+				}
+			}
+		}
+		res, _ = this.Mgo.FindOne("entniche_rule", map[string]interface{}{
+			"i_deptid": deptId,
+			"i_entid":  this.EntId,
+		})
+		log.Println(res_, "+++")
+		if len(res_) > 0 {
+			oenitche, _ := (*res)["o_entniche"].(map[string]interface{})
+			oenitche["a_buyerclass"] = res_["a_buyerclass"]
+			oenitche["a_items"] = res_["a_items"]
+			oenitche["o_area"] = res_["o_area"]
+			(*res)["o_entniche"] = oenitche
+		}
+	case 2:
+		res, _ = this.Mgo.FindOne("entniche_rule", map[string]interface{}{
+			"i_userid": this.EntUserId,
+			"i_entid":  this.EntId,
+		})
+
+	}
+	log.Println(entInfo.Ent.Name, entInfo.Ent.Id, entInfo.Ent)
+	entnicheJy := common.ObjToMap((*res)["o_entniche"])
+	if entnicheJy != nil && len(*entnicheJy) > 0 {
+		(*entnicheJy)["starttime"] = entInfo.Ent.Startdate
+		(*entnicheJy)["endtime"] = entInfo.Ent.Enddate
+		(*entnicheJy)["power"] = entInfo.User_power //用户权益
+	} else {
+		entnicheJy = &map[string]interface{}{
+			"starttime": entInfo.Ent.Startdate,
+			"endtime":   entInfo.Ent.Enddate,
+			"power":     entInfo.User_power,
+		}
+	}
+	//获取商机管理的订阅设置
+	return entnicheJy
+}

+ 5 - 87
go.mod

@@ -1,95 +1,13 @@
 module userCenter
 
-go 1.18
+go 1.16
 
 require (
 	app.yhyue.com/moapp/jyInfo v1.0.0
-	app.yhyue.com/moapp/jybase v0.0.0-20220719064915-2fef79005dfa
+	app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
-	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.1
-	github.com/zeromicro/go-zero v1.3.5
+	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.2-0.20220723113228-8ddb7d40e0dc
+	github.com/zeromicro/go-zero v1.4.0
 	google.golang.org/grpc v1.48.0
-	google.golang.org/protobuf v1.28.0
-)
-
-require (
-	github.com/beorn7/perks v1.0.1 // indirect
-	github.com/cespare/xxhash/v2 v2.1.2 // 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/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.6.0 // indirect
-	github.com/go-stack/stack v1.8.0 // indirect
-	github.com/gogo/protobuf v1.3.2 // indirect
-	github.com/golang-jwt/jwt/v4 v4.4.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/google/go-cmp v0.5.8 // indirect
-	github.com/google/gofuzz v1.2.0 // indirect
-	github.com/google/uuid v1.3.0 // indirect
-	github.com/googleapis/gnostic v0.5.5 // 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/mattn/go-colorable v0.1.9 // indirect
-	github.com/mattn/go-isatty v0.0.14 // 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/openzipkin/zipkin-go v0.4.0 // indirect
-	github.com/pelletier/go-toml/v2 v2.0.2 // indirect
-	github.com/pkg/errors v0.9.1 // indirect
-	github.com/prometheus/client_golang v1.12.2 // indirect
-	github.com/prometheus/client_model v0.2.0 // indirect
-	github.com/prometheus/common v0.32.1 // indirect
-	github.com/prometheus/procfs v0.7.3 // indirect
-	github.com/spaolacci/murmur3 v1.1.0 // indirect
-	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
-	github.com/xdg-go/scram v1.0.2 // indirect
-	github.com/xdg-go/stringprep v1.0.2 // indirect
-	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
-	go.etcd.io/etcd/api/v3 v3.5.4 // indirect
-	go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
-	go.etcd.io/etcd/client/v3 v3.5.4 // indirect
-	go.mongodb.org/mongo-driver v1.9.1 // indirect
-	go.opentelemetry.io/otel v1.8.0 // indirect
-	go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect
-	go.opentelemetry.io/otel/exporters/zipkin v1.8.0 // indirect
-	go.opentelemetry.io/otel/sdk v1.8.0 // indirect
-	go.opentelemetry.io/otel/trace v1.8.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-20210920023735-84f357641f63 // indirect
-	golang.org/x/net v0.0.0-20220531201128-c960675eff93 // indirect
-	golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
-	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
-	golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
-	golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
-	golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 // indirect
-	golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
-	google.golang.org/appengine v1.6.7 // indirect
-	google.golang.org/genproto v0.0.0-20220602131408-e326c6e8e9c8 // 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.40.1 // indirect
-	k8s.io/utils v0.0.0-20220706174534-f6158b442e7c // indirect
-	sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
-	sigs.k8s.io/yaml v1.2.0 // indirect
+	google.golang.org/protobuf v1.28.1
 )

+ 40 - 15
go.sum

@@ -6,8 +6,9 @@ app.yhyue.com/moapp/jybase v0.0.0-20220418104200-46c3fff161c7/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20220419023055-f406279ff7e3/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220420032112-668025915ee4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220421060131-a1001013ba46/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
-app.yhyue.com/moapp/jybase v0.0.0-20220719064915-2fef79005dfa h1:fGlW3FjP2VeJCH6hZ2Oc1lwi5lI3n3U8JeLVCPKs+9c=
 app.yhyue.com/moapp/jybase v0.0.0-20220719064915-2fef79005dfa/go.mod h1:FjBF25AYoBrPhVKTXGXWcmEAbBT0ATTK6KJMOA+I80Q=
+app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b h1:7EtDV0o2XsluZI0ftgb2Twa/QlX7HxHP2SKhtyfnJV4=
+app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b/go.mod h1:HelrO6tcD9TcKb/HOP2BLbzppyDz2kpQSFhPMQTUgbQ=
 bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/AUH9Yr1wzarEjOaNMkj1Cet/9r8IgLyba64Z52E=
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220419090715-88ddb32961be/go.mod h1:Yj4oabIGItuMoF0BXYLz2XAnF581kxgXBrvlUtIJrkI=
 bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4 h1:zl5eZrKDBENVVBUiPpzyQQ0/SBdGUmZS3thXycSEO1g=
@@ -16,8 +17,8 @@ bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220418005748-8ba5d936d
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220419023723-0b32d4a41751/go.mod h1:6KL5LMEku83uRbre0W/bj5kXG2I6pJGBFtktmtp51yM=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220419063004-233fc7ce006c/go.mod h1:6KL5LMEku83uRbre0W/bj5kXG2I6pJGBFtktmtp51yM=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220420075831-0b59892e9982/go.mod h1:wsHNO91h37H+xE4ZNny0yd7mtpODeDJxbVYhIRMR+qw=
-bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.1 h1:DsPfVxVBWQ1NUWuroqRkPYuqQnRPj+LRPQjjPG+Vjyc=
-bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.1/go.mod h1:hIemvGYYrFtL8mP7qIy1DENTEn1QQ09eUMf2DyXnigk=
+bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.2-0.20220723113228-8ddb7d40e0dc h1:cFKYXQLF1r3vD6xp5xf3ar4keWpD6qQb9kpJUCUPySw=
+bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.2-0.20220723113228-8ddb7d40e0dc/go.mod h1:Z353aucNO5hH4ZYjeKST3kE1PN3W8/uPc4J8s0Upz40=
 bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20220418072311-2062bed1e700/go.mod h1:KjcrxTzM96tBc6G4B8tlLBn1lrVy5UJYF8+eTdP4xAE=
 bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20220421015128-4a36f3eac5c5/go.mod h1:GT0QC4aaKDuXxAvaU4G02XjCc31TU1ctqBGqxQYOfC4=
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
@@ -169,6 +170,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
 github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
 github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
 github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
+github.com/fullstorydev/grpcurl v1.8.6/go.mod h1:WhP7fRQdhxz2TkL97u+TCb505sxfH78W1usyoB3tepw=
 github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM=
 github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
 github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
@@ -210,7 +212,6 @@ github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG
 github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
 github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
 github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
-github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
 github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
 github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
 github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
@@ -324,6 +325,7 @@ github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3i
 github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU=
 github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw=
 github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA=
+github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
 github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
 github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
 github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
@@ -354,6 +356,12 @@ github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/U
 github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg=
 github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc=
 github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc=
+github.com/jhump/gopoet v0.0.0-20190322174617-17282ff210b3/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI=
+github.com/jhump/gopoet v0.1.0/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI=
+github.com/jhump/goprotoc v0.5.0/go.mod h1:VrbvcYrQOrTi3i0Vf+m+oqQWk9l72mjkJCYo7UvLHRQ=
+github.com/jhump/protoreflect v1.10.3/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg=
+github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E=
+github.com/jhump/protoreflect v1.12.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
 github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
 github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
 github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
@@ -433,6 +441,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
 github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
 github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
+github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
 github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
 github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
@@ -440,6 +449,7 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW
 github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
 github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
+github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso=
 github.com/nsqio/go-nsq v1.1.0/go.mod h1:vKq36oyeVXgsS5Q8YEO7WghqidAVXQlcFxzQbQTuDEY=
 github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
 github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
@@ -471,6 +481,7 @@ github.com/openzipkin/zipkin-go v0.4.0 h1:CtfRrOVZtbDj8rt1WXjklw0kqqJQwICrCKmlfU
 github.com/openzipkin/zipkin-go v0.4.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ=
 github.com/paulmach/orb v0.7.1/go.mod h1:FWRlTgl88VI1RBx/MkrwWDRhQ96ctqMCh8boXhmqB/A=
 github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY=
+github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI=
 github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
 github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw=
 github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI=
@@ -566,10 +577,12 @@ github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hM
 github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
 github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
 github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
-github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w=
 github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
-github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc=
+github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
+github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
 github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=
+github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs=
+github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
 github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
 github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
 github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
@@ -585,8 +598,9 @@ github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 h1:k/gmLsJDWwWqbLC
 github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
 github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
 github.com/zeromicro/go-zero v1.3.2/go.mod h1:DEj3Fwj1Ui1ltsgf6YqwTL9nD4+tYzIRX0c1pWtQo1E=
-github.com/zeromicro/go-zero v1.3.5 h1:+3T4Rx/5o/EgLuCE3Qo4X0i+3GCHRYEgkabmfKhhQ7Q=
 github.com/zeromicro/go-zero v1.3.5/go.mod h1:wh4o794b7Ul3W0k35Pw9nc3iB4O0OpaQTMQz/PJc1bc=
+github.com/zeromicro/go-zero v1.4.0 h1:gtJ6XY7AZUJvA9omWNAWqxCd4hRE5vo1ObS2q+dUJgo=
+github.com/zeromicro/go-zero v1.4.0/go.mod h1:1amLn98K7c6FLntb9f8hdmq26ajtolOg4DTFWnRt54o=
 go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
 go.etcd.io/etcd/api/v3 v3.5.4 h1:OHVyt3TopwtUQ2GKdd5wu3PmmipR4FTwCqoEjSyRdIc=
 go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
@@ -597,8 +611,9 @@ go.etcd.io/etcd/client/v3 v3.5.2/go.mod h1:kOOaWFFgHygyT0WlSmL8TJiXmMysO/nNUlEsS
 go.etcd.io/etcd/client/v3 v3.5.4 h1:p83BUL3tAYS0OT/r0qglgc3M1JjhM0diV8DSWAhVXv4=
 go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY=
 go.mongodb.org/mongo-driver v1.5.0/go.mod h1:boiGPFqyBs5R0R5qf2ErokGRekMfwn+MqKaUyHs7wy0=
-go.mongodb.org/mongo-driver v1.9.1 h1:m078y9v7sBItkt1aaoe2YlvWEXcD263e1a4E1fBrJ1c=
 go.mongodb.org/mongo-driver v1.9.1/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY=
+go.mongodb.org/mongo-driver v1.10.1 h1:NujsPveKwHaWuKUer/ceo9DzEe7HIj1SlJ6uvXZG0S4=
+go.mongodb.org/mongo-driver v1.10.1/go.mod h1:z4XpeoU6w+9Vht+jAFyLgVrD+jGSQQe0+CBWFHNiHt8=
 go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
 go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
 go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
@@ -608,23 +623,28 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
 go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg=
 go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs=
 go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
-go.opentelemetry.io/otel v1.8.0 h1:zcvBFizPbpa1q7FehvFiHbQwGzmPILebO0tyqIR5Djg=
 go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM=
+go.opentelemetry.io/otel v1.9.0 h1:8WZNQFIB2a71LnANS9JeyidJKKGOOremcUtb/OtHISw=
+go.opentelemetry.io/otel v1.9.0/go.mod h1:np4EoPGzoPs3O67xUVNoPPcmSvsfOxNlNA4F4AC+0Eo=
 go.opentelemetry.io/otel/exporters/jaeger v1.3.0/go.mod h1:KoYHi1BtkUPncGSRtCe/eh1ijsnePhSkxwzz07vU0Fc=
-go.opentelemetry.io/otel/exporters/jaeger v1.8.0 h1:TLLqD6kDhLPziEC7pgPrMvP9lAqdk3n1gf8DiFSnfW8=
 go.opentelemetry.io/otel/exporters/jaeger v1.8.0/go.mod h1:GbWg+ng88rDtx+id26C34QLqw2erqJeAjsCx9AFeHfE=
+go.opentelemetry.io/otel/exporters/jaeger v1.9.0 h1:gAEgEVGDWwFjcis9jJTOJqZNxDzoZfR12WNIxr7g9Ww=
+go.opentelemetry.io/otel/exporters/jaeger v1.9.0/go.mod h1:hquezOLVAybNW6vanIxkdLXTXvzlj2Vn3wevSP15RYs=
 go.opentelemetry.io/otel/exporters/zipkin v1.3.0/go.mod h1:LxGGfHIYbvsFnrJtBcazb0yG24xHdDGrT/H6RB9r3+8=
-go.opentelemetry.io/otel/exporters/zipkin v1.8.0 h1:PIAiDdROZzATAFfxr5ASYuSOG0JIJxRq3GwlpJGbSYQ=
 go.opentelemetry.io/otel/exporters/zipkin v1.8.0/go.mod h1:0uYAyCuGT67MFV9Z/Mmx93wGuugHw0FbxMc74fs3LNo=
+go.opentelemetry.io/otel/exporters/zipkin v1.9.0 h1:06b/nt6xao6th00aue9WU3ZDTTe+InaMXA/vym6pLuA=
+go.opentelemetry.io/otel/exporters/zipkin v1.9.0/go.mod h1:HyIvYIu37wV4Wx5azd7e05x9k/dOz9KB4x0plw2QNvs=
 go.opentelemetry.io/otel/sdk v1.0.0/go.mod h1:PCrDHlSy5x1kjezSdL37PhbFUMjrsLRshJ2zCzeXwbM=
 go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs=
-go.opentelemetry.io/otel/sdk v1.8.0 h1:xwu69/fNuwbSHWe/0PGS888RmjWY181OmcXDQKu7ZQk=
 go.opentelemetry.io/otel/sdk v1.8.0/go.mod h1:uPSfc+yfDH2StDM/Rm35WE8gXSNdvCg023J6HeGNO0c=
+go.opentelemetry.io/otel/sdk v1.9.0 h1:LNXp1vrr83fNXTHgU8eO89mhzxb/bbWAsHG6fNf3qWo=
+go.opentelemetry.io/otel/sdk v1.9.0/go.mod h1:AEZc8nt5bd2F7BC24J5R0mrjYnpEgYHyTcM/vrSple4=
 go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs=
 go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk=
 go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
-go.opentelemetry.io/otel/trace v1.8.0 h1:cSy0DF9eGI5WIfNwZ1q2iUyGj00tGzP24dE1lOlHrfY=
 go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4=
+go.opentelemetry.io/otel/trace v1.9.0 h1:oZaCNJUjWcg60VXWee8lJKlqhPbXAPB51URuR47pQYc=
+go.opentelemetry.io/otel/trace v1.9.0/go.mod h1:2737Q0MuG8q1uILYm2YYVkAyLtOofiTNGg6VODnOiPo=
 go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
 go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
 go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
@@ -656,8 +676,9 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh
 golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
 golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
-golang.org/x/crypto v0.0.0-20210920023735-84f357641f63 h1:kETrAMYZq6WVGPa8IIixL0CaEcIUNi+1WX7grUoi3y8=
 golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
+golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -888,8 +909,10 @@ golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWc
 golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
@@ -994,11 +1017,13 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
 google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
 google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
 google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
 google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
+google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

+ 7 - 4
rpc/etc/usercenter.yaml

@@ -13,7 +13,7 @@ CalleeId: usercenter.rpc
 ResourceEtcdConf:
   Etcd:
     Hosts:
-      - 192.168.3.240:2379
+      - 192.168.3.206:2379
     Key: resource.rpc
 Node: 1
 Mysql:
@@ -31,14 +31,13 @@ BaseMysql:
   maxOpenConns: 5
   maxIdleConns: 5
 Logx:
-  Mode: console #console|file|volume
+  Mode: file #console|file|volume
   Path: logs
   Level: info #info|error|severe
   KeepDays: 100
 IsRun: true
 CheckEntIsExpire: 00:00
 DoMain: https://jybx-webtest.jydev.jianyu360.com
-Timeout: 5000
 RedisAddrees:
   - newother=192.168.3.206:1712
 RedisOutTime: 300 #工作桌面redis缓存时间
@@ -57,4 +56,8 @@ UserRolePower: #需要初始化的用户角色
   - 大会员
   - 商机管理
   - 超级订阅
-  - 免费
+  - 免费
+Mongo:
+  dbName: qfw
+  size: 5
+  address: 192.168.3.206:27080

+ 8 - 1
rpc/internal/config/config.go

@@ -1,12 +1,13 @@
 package config
 
 import (
+	"userCenter/entity"
+
 	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/resource"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/discov"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/zrpc"
-	"userCenter/entity"
 )
 
 type Config struct {
@@ -49,6 +50,12 @@ var (
 	ManagerUserIdsMap = map[string]bool{}
 )
 
+type Mongodb struct {
+	DbName  string `json:"dbName"`
+	Size    int    `json:"size"`
+	Address string `json:"address"`
+}
+
 type Mysql struct {
 	DbName       string `json:"dbName"`
 	Address      string `json:"address"`

+ 7 - 3
rpc/internal/db/db.go

@@ -1,14 +1,16 @@
 package db
 
 import (
-	"app.yhyue.com/moapp/jybase/mongodb"
-	"app.yhyue.com/moapp/jybase/redis"
 	"log"
 	"strings"
 
-	"app.yhyue.com/moapp/jybase/mysql"
+	"app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/redis"
+
 	"userCenter/entity"
 	"userCenter/rpc/internal/config"
+
+	"app.yhyue.com/moapp/jybase/mysql"
 )
 
 func init() {
@@ -48,4 +50,6 @@ func init() {
 	}
 	//用户角色功能初始化
 	entity.UserRolePowerInit(config.ConfigJson.UserRolePower)
+	log.Println("初始化 mysql")
+
 }

+ 40 - 0
rpc/internal/logic/checkisentadminlogic.go

@@ -0,0 +1,40 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"userCenter/rpc/internal/svc"
+	"userCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type CheckIsEntAdminLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewCheckIsEntAdminLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CheckIsEntAdminLogic {
+	return &CheckIsEntAdminLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 查看员工是否是企业管理员
+func (l *CheckIsEntAdminLogic) CheckIsEntAdmin(in *pb.EntUserReq) (*pb.CheckIsEntAdminResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.CheckIsEntAdminResp{}
+	data, msg := Entservice.CheckEntUserAdmin(in)
+	if msg != "" {
+		l.Error(fmt.Sprintf("%+v", in), msg)
+		resp.ErrorMsg = msg
+		resp.ErrorCode = -1
+	} else {
+		resp.Status = data
+	}
+	return resp, nil
+}

+ 2 - 0
rpc/internal/logic/entservice.go

@@ -8,3 +8,5 @@ import (
 var Entservice = service.EntService{
 	Url: config.ConfigJson.DoMain,
 }
+
+var SubscirbeService = service.SubscribeService{}

+ 45 - 0
rpc/internal/logic/getentuserinfologic.go

@@ -0,0 +1,45 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"userCenter/rpc/internal/svc"
+	"userCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetEntUserInfoLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetEntUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetEntUserInfoLogic {
+	return &GetEntUserInfoLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 根据企业员工id获取员工的信息
+func (l *GetEntUserInfoLogic) GetEntUserInfo(in *pb.EntUserReq) (*pb.EntUserResp, error) {
+	/// todo: add your logic here and delete this line
+	resp := &pb.EntUserResp{}
+	ret, msg := Entservice.GetEntUserInfo(in)
+	if msg != "" {
+		l.Error(fmt.Sprintf("%+v", in), msg)
+		resp.ErrorMsg = msg
+		resp.ErrorCode = -1
+	} else {
+		resp.Data = &pb.EntUser{
+			Name:     ret.Name,
+			Phone:    ret.Phone,
+			Mail:     ret.Mail,
+			DeptName: ret.Dept_name,
+		}
+	}
+	return resp, nil
+}

+ 40 - 0
rpc/internal/logic/getentuserlistlogic.go

@@ -0,0 +1,40 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"userCenter/rpc/internal/svc"
+	"userCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetEntUserListLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetEntUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetEntUserListLogic {
+	return &GetEntUserListLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 获取企业员工列表
+func (l *GetEntUserListLogic) GetEntUserList(in *pb.EntUserListReq) (*pb.EntUserListResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.EntUserListResp{}
+	data, msg := Entservice.GetEntUserList(in)
+	if msg != "" {
+		l.Error(fmt.Sprintf("%+v", in), msg)
+		resp.ErrorMsg = msg
+		resp.ErrorCode = -1
+	} else {
+		resp.Data = data
+	}
+	return resp, nil
+}

+ 118 - 0
rpc/internal/logic/getuserinfologic.go

@@ -0,0 +1,118 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"userCenter/rpc/internal/svc"
+	"userCenter/rpc/pb"
+
+	"app.yhyue.com/moapp/jybase/common"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetUserInfoLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
+	return &GetUserInfoLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 获取客户信息
+func (l *GetUserInfoLogic) GetUserInfo(in *pb.UserReq) (*pb.UserInfo, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.UserInfo{}
+	ret, msg := SubscirbeService.GetSubscribeInfo(in)
+	if msg != "" {
+		l.Error(fmt.Sprintf("%+v", in), msg)
+		resp.ErrorMsg = msg
+		resp.ErrorCode = -1
+	}
+
+	resp.Phone = common.ObjToString(ret["phone"])
+	resp.VipStatus = common.Int64All(ret["vipStatus"])
+	resp.MemberStatus = common.Int64All(ret["memberStatus"])
+	resp.EntnicheStatus = common.Int64All(ret["entnicheStatus"])
+	resp.SubscribeType = common.ObjToString(ret["subscribeType"])
+	resp.Nickname = common.ObjToString(ret["nickname"])
+	resp.Headimg = common.ObjToString(ret["headimg"])
+	items, ok := ret["items"].([]map[string]interface{})
+	if !ok {
+		inter_items, _ := ret["items"].([]interface{})
+		items = common.ObjArrToMapArr(inter_items)
+	}
+	log.Println("items:", items)
+	log.Println("oarea:", ret["o_area"], common.ObjToMap(ret["o_area"]))
+	buyerclass, _ := ret["buyerclass"].([]interface{})
+	infotype, _ := ret["infotype"].([]interface{})
+	resp.Data = &pb.Subscribe{
+		StartTime:    common.Int64All(ret["starttime"]),
+		EndTime:      common.Int64All(ret["endtime"]),
+		Area:         l.formatM(common.ObjToMap(ret["area"])),
+		Buyerclass:   common.ObjArrToStringArr(buyerclass),
+		Infotype:     common.ObjArrToStringArr(infotype),
+		Matchway:     common.Int64All(ret["matchway"]),
+		Projectmatch: common.Int64All(ret["projectmatch"]),
+		Items:        l.formatItems(items),
+	}
+	return resp, nil
+}
+
+//格式转化 map<string,list>转化
+func (l *GetUserInfoLogic) formatM(m *map[string]interface{}) map[string]*pb.List {
+	retM := map[string]*pb.List{}
+	if len(*m) == 0 {
+		return retM
+	}
+	for k, v := range *m {
+		s_v, ok := v.([]string)
+		if !ok {
+			interf, _ := v.([]interface{})
+			s_v = common.ObjArrToStringArr(interf)
+		}
+		retM[k] = &pb.List{
+			Value: s_v,
+		}
+	}
+	return retM
+}
+
+func (l *GetUserInfoLogic) formatItems(m []map[string]interface{}) []*pb.Items {
+	items := make([]*pb.Items, len(m))
+	for k, v := range m {
+		items[k] = &pb.Items{
+			SItem:      common.ObjToString(v["s_item"]),
+			UpdateTime: common.Int64All(v["updatetime"]),
+		}
+		akey, _ := v["a_key"].([]map[string]interface{})
+		pbKey := make([]*pb.Keys, len(akey))
+		for kk, vv := range akey {
+			key, ok := vv["key"].([]string)
+			if !ok {
+				inter_vv, _ := vv["key"].([]interface{})
+				key = common.ObjArrToStringArr(inter_vv)
+			}
+			notkey, ok := vv["notkey"].([]string)
+			if !ok {
+				inter_vv, _ := vv["notkey"].([]interface{})
+				notkey = common.ObjArrToStringArr(inter_vv)
+			}
+			pbKey[kk] = &pb.Keys{
+				Key:        key,
+				Notkey:     notkey,
+				UpdateTime: common.If(vv["updatetime"] == nil, int64(0), common.Int64All(vv["updatetime"])).(int64),
+			}
+		}
+		items[k].AKey = pbKey
+	}
+	return items
+}

+ 24 - 0
rpc/internal/server/usercenterserver.go

@@ -111,3 +111,27 @@ func (s *UserCenterServer) WorkDesktopClearUserInfo(ctx context.Context, in *pb.
 	l := logic.NewWorkDesktopClearUserInfoLogic(ctx, s.svcCtx)
 	return l.WorkDesktopClearUserInfo(in)
 }
+
+// 获取客户信息
+func (s *UserCenterServer) GetUserInfo(ctx context.Context, in *pb.UserReq) (*pb.UserInfo, error) {
+	l := logic.NewGetUserInfoLogic(ctx, s.svcCtx)
+	return l.GetUserInfo(in)
+}
+
+// 根据企业员工id获取员工的信息
+func (s *UserCenterServer) GetEntUserInfo(ctx context.Context, in *pb.EntUserReq) (*pb.EntUserResp, error) {
+	l := logic.NewGetEntUserInfoLogic(ctx, s.svcCtx)
+	return l.GetEntUserInfo(in)
+}
+
+// 获取企业员工列表
+func (s *UserCenterServer) GetEntUserList(ctx context.Context, in *pb.EntUserListReq) (*pb.EntUserListResp, error) {
+	l := logic.NewGetEntUserListLogic(ctx, s.svcCtx)
+	return l.GetEntUserList(in)
+}
+
+// 查看员工是否是企业管理员
+func (s *UserCenterServer) CheckIsEntAdmin(ctx context.Context, in *pb.EntUserReq) (*pb.CheckIsEntAdminResp, error) {
+	l := logic.NewCheckIsEntAdminLogic(ctx, s.svcCtx)
+	return l.CheckIsEntAdmin(in)
+}

File diff suppressed because it is too large
+ 957 - 6
rpc/pb/userCenter.pb.go


+ 153 - 1
rpc/pb/userCenter_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.15.5
+// - protoc             v3.19.4
 // source: userCenter.proto
 
 package pb
@@ -52,6 +52,14 @@ type UserCenterClient interface {
 	WorkDesktopComprehensive(ctx context.Context, in *WorkDesktopComprehensiveReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error)
 	//手动清除用户功能内存信息
 	WorkDesktopClearUserInfo(ctx context.Context, in *WorkDesktopClearUserInfoReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error)
+	//获取客户信息
+	GetUserInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserInfo, error)
+	//根据企业员工id获取员工的信息
+	GetEntUserInfo(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*EntUserResp, error)
+	//获取企业员工列表
+	GetEntUserList(ctx context.Context, in *EntUserListReq, opts ...grpc.CallOption) (*EntUserListResp, error)
+	//查看员工是否是企业管理员
+	CheckIsEntAdmin(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*CheckIsEntAdminResp, error)
 }
 
 type userCenterClient struct {
@@ -197,6 +205,42 @@ func (c *userCenterClient) WorkDesktopClearUserInfo(ctx context.Context, in *Wor
 	return out, nil
 }
 
+func (c *userCenterClient) GetUserInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserInfo, error) {
+	out := new(UserInfo)
+	err := c.cc.Invoke(ctx, "/UserCenter/GetUserInfo", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *userCenterClient) GetEntUserInfo(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*EntUserResp, error) {
+	out := new(EntUserResp)
+	err := c.cc.Invoke(ctx, "/UserCenter/GetEntUserInfo", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *userCenterClient) GetEntUserList(ctx context.Context, in *EntUserListReq, opts ...grpc.CallOption) (*EntUserListResp, error) {
+	out := new(EntUserListResp)
+	err := c.cc.Invoke(ctx, "/UserCenter/GetEntUserList", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *userCenterClient) CheckIsEntAdmin(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*CheckIsEntAdminResp, error) {
+	out := new(CheckIsEntAdminResp)
+	err := c.cc.Invoke(ctx, "/UserCenter/CheckIsEntAdmin", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // UserCenterServer is the server API for UserCenter service.
 // All implementations must embed UnimplementedUserCenterServer
 // for forward compatibility
@@ -231,6 +275,14 @@ type UserCenterServer interface {
 	WorkDesktopComprehensive(context.Context, *WorkDesktopComprehensiveReq) (*WorkDesktopComprehensiveResp, error)
 	//手动清除用户功能内存信息
 	WorkDesktopClearUserInfo(context.Context, *WorkDesktopClearUserInfoReq) (*WorkDesktopComprehensiveResp, error)
+	//获取客户信息
+	GetUserInfo(context.Context, *UserReq) (*UserInfo, error)
+	//根据企业员工id获取员工的信息
+	GetEntUserInfo(context.Context, *EntUserReq) (*EntUserResp, error)
+	//获取企业员工列表
+	GetEntUserList(context.Context, *EntUserListReq) (*EntUserListResp, error)
+	//查看员工是否是企业管理员
+	CheckIsEntAdmin(context.Context, *EntUserReq) (*CheckIsEntAdminResp, error)
 	mustEmbedUnimplementedUserCenterServer()
 }
 
@@ -283,6 +335,18 @@ func (UnimplementedUserCenterServer) WorkDesktopComprehensive(context.Context, *
 func (UnimplementedUserCenterServer) WorkDesktopClearUserInfo(context.Context, *WorkDesktopClearUserInfoReq) (*WorkDesktopComprehensiveResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method WorkDesktopClearUserInfo not implemented")
 }
+func (UnimplementedUserCenterServer) GetUserInfo(context.Context, *UserReq) (*UserInfo, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented")
+}
+func (UnimplementedUserCenterServer) GetEntUserInfo(context.Context, *EntUserReq) (*EntUserResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetEntUserInfo not implemented")
+}
+func (UnimplementedUserCenterServer) GetEntUserList(context.Context, *EntUserListReq) (*EntUserListResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetEntUserList not implemented")
+}
+func (UnimplementedUserCenterServer) CheckIsEntAdmin(context.Context, *EntUserReq) (*CheckIsEntAdminResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method CheckIsEntAdmin not implemented")
+}
 func (UnimplementedUserCenterServer) mustEmbedUnimplementedUserCenterServer() {}
 
 // UnsafeUserCenterServer may be embedded to opt out of forward compatibility for this service.
@@ -566,6 +630,78 @@ func _UserCenter_WorkDesktopClearUserInfo_Handler(srv interface{}, ctx context.C
 	return interceptor(ctx, in, info, handler)
 }
 
+func _UserCenter_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(UserReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserCenterServer).GetUserInfo(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/UserCenter/GetUserInfo",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserCenterServer).GetUserInfo(ctx, req.(*UserReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _UserCenter_GetEntUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(EntUserReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserCenterServer).GetEntUserInfo(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/UserCenter/GetEntUserInfo",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserCenterServer).GetEntUserInfo(ctx, req.(*EntUserReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _UserCenter_GetEntUserList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(EntUserListReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserCenterServer).GetEntUserList(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/UserCenter/GetEntUserList",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserCenterServer).GetEntUserList(ctx, req.(*EntUserListReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _UserCenter_CheckIsEntAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(EntUserReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserCenterServer).CheckIsEntAdmin(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/UserCenter/CheckIsEntAdmin",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserCenterServer).CheckIsEntAdmin(ctx, req.(*EntUserReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // UserCenter_ServiceDesc is the grpc.ServiceDesc for UserCenter service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -633,6 +769,22 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "WorkDesktopClearUserInfo",
 			Handler:    _UserCenter_WorkDesktopClearUserInfo_Handler,
 		},
+		{
+			MethodName: "GetUserInfo",
+			Handler:    _UserCenter_GetUserInfo_Handler,
+		},
+		{
+			MethodName: "GetEntUserInfo",
+			Handler:    _UserCenter_GetEntUserInfo_Handler,
+		},
+		{
+			MethodName: "GetEntUserList",
+			Handler:    _UserCenter_GetEntUserList_Handler,
+		},
+		{
+			MethodName: "CheckIsEntAdmin",
+			Handler:    _UserCenter_CheckIsEntAdmin_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "userCenter.proto",

+ 3 - 3
rpc/test/usercenter.yaml

@@ -11,13 +11,13 @@ Redis:
   idleTimeOut: 240
 Etcd:
   Hosts:
-  - 127.0.0.1:2379
+  - 192.168.3.206:2379
   Key: usercenter.rpc
 DataSource: root:Topnet123@tcp(192.168.3.11:3366)/jianyu?charset=utf8mb4&parseTime=true&loc=Local
 FileSystemConf:
   Etcd:
     Hosts:
-      - 127.0.0.1:2379
+      - 192.168.3.206:2379
     Key: usercenter.rpc
 CalleeId: usercenter.rpc
 Node: 1
@@ -54,4 +54,4 @@ Mongo:
     size: 50
     address: 192.168.3.206:27080
 BigMemberOff: false
-CommonlySize: 10
+CommonlySize: 10

+ 107 - 0
rpc/userCenter.proto

@@ -197,6 +197,104 @@ message GetStatusByCodeResp{
   GetStatusByCode data = 3; //详情
 }
 
+//用户权益
+message UserInfo{
+	string phone =1;//手机号
+	int64 vipStatus =2;//超级订阅状态; >0有权限 <=0无权限
+	int64 memberStatus =3;//大会员状态;  >0:有权限  <=0:无权限
+	int64 entnicheStatus=4;//商机管理权限状态; 1:有权限   -1:无权限
+	string subscribeType =5;//订阅设置类型 f:免费订阅 v:超级订阅 m:大会员订阅 e:商机管理订阅
+	Subscribe data =6;
+    	string error_msg = 7;
+	int64 error_code = 8; 
+	string nickname =9;
+	string headimg=10;
+}
+
+//订阅设置
+message Subscribe{
+	int64 startTime =1;//开始时间
+	int64 endTime =2;//结束时间
+    map<string,List> area =3;//地区
+    repeated string buyerclass=4;//采购单位类型
+    repeated string infotype=5;//信息类型
+    repeated Items items =6;//关键词
+    int64 matchway =7;//匹配方式 1标题 2正文
+    int64 projectmatch=8;//项目匹配 
+}
+
+message List{
+	repeated string value =1;
+}
+
+//分类
+message Items{
+	string s_item =1;//分类名称
+	int64 updateTime=2;
+	repeated Keys a_key=3;
+}
+
+//关键词
+message Keys {
+	repeated string key =1;
+	repeated string notkey=2;
+	int64 updateTime=3; 
+	int64 matchway=4;
+}
+
+message UserReq{
+	string appId =1;
+	int64 userId =2;
+	string types =3;//类型,不传按默认规则获取 m大会员 e商机管理 v超级订阅 f免费订阅
+}
+
+message EntUserReq{
+	string appId =1;
+	int64 entUserId =2;
+	int64 entId=3;
+}
+
+message EntUserResp{
+	int64 error_code = 1;
+	string error_msg = 2;
+	EntUser data=3;
+}
+
+message EntUser{
+	string Name =1; //员工名册
+	string phone =2;//员工手机号
+	string mail =3;//邮箱
+	string deptName =4;//部门名称
+	int64 entUserId=5;
+}
+
+message EntUserListReq{
+	string appId =1;
+	int64 entId=2;
+	int64 deptId=3;
+	string name=4;
+}
+
+message EntUserListResp{
+	int64 error_code = 1;
+	string error_msg = 2;
+	repeated EntUserListData data=3;
+}
+
+message EntUserListData{
+	string name =1;
+	int64 deptId=2;
+	int64 pId=3;
+	repeated EntUser entUserList=4;
+	repeated EntUserListData deptList=5;
+}
+
+message CheckIsEntAdminResp{
+	int64 error_code = 1;
+	string error_msg = 2;
+	int64 status=3; //1企业管理员 2部门管理员 3员工 
+}
+
 message GetStatusByCode {
   int64 authStatus = 1;//企业是否认证 -1 未通过,0 未认证,1 已认证. -2 已到期 3待审核
   bool isInEnt = 2; //是否在该企业内
@@ -374,4 +472,13 @@ service UserCenter {
   rpc WorkDesktopComprehensive (WorkDesktopComprehensiveReq) returns (WorkDesktopComprehensiveResp);
   //手动清除用户功能内存信息
   rpc WorkDesktopClearUserInfo (WorkDesktopClearUserInfoReq) returns (WorkDesktopComprehensiveResp);
+ 
+  //获取客户信息
+  rpc GetUserInfo(UserReq) returns(UserInfo);
+  //根据企业员工id获取员工的信息
+  rpc GetEntUserInfo(EntUserReq) returns(EntUserResp);
+  //获取企业员工列表
+  rpc GetEntUserList (EntUserListReq) returns(EntUserListResp);
+  //查看员工是否是企业管理员
+  rpc CheckIsEntAdmin(EntUserReq)returns(CheckIsEntAdminResp);
 }

+ 45 - 0
rpc/usercenter/usercenter.go

@@ -17,6 +17,7 @@ type (
 	CheckEntReq                  = pb.CheckEntReq
 	CheckEntResp                 = pb.CheckEntResp
 	CheckExamineReq              = pb.CheckExamineReq
+	CheckIsEntAdminResp          = pb.CheckIsEntAdminResp
 	EntAuthData                  = pb.EntAuthData
 	EntAuthReq                   = pb.EntAuthReq
 	EntAuthResp                  = pb.EntAuthResp
@@ -27,6 +28,12 @@ type (
 	EntListReq                   = pb.EntListReq
 	EntListResp                  = pb.EntListResp
 	EntUpdateReq                 = pb.EntUpdateReq
+	EntUser                      = pb.EntUser
+	EntUserListData              = pb.EntUserListData
+	EntUserListReq               = pb.EntUserListReq
+	EntUserListResp              = pb.EntUserListResp
+	EntUserReq                   = pb.EntUserReq
+	EntUserResp                  = pb.EntUserResp
 	ExamineData                  = pb.ExamineData
 	ExamineList                  = pb.ExamineList
 	ExamineListData              = pb.ExamineListData
@@ -37,15 +44,21 @@ type (
 	GetStatusByCode              = pb.GetStatusByCode
 	GetStatusByCodeReq           = pb.GetStatusByCodeReq
 	GetStatusByCodeResp          = pb.GetStatusByCodeResp
+	Items                        = pb.Items
+	Keys                         = pb.Keys
+	List                         = pb.List
 	MenuData                     = pb.MenuData
 	MenuList                     = pb.MenuList
 	SecondLevelMenu              = pb.SecondLevelMenu
+	Subscribe                    = pb.Subscribe
 	ThreeLevelMenu               = pb.ThreeLevelMenu
 	TipInfo                      = pb.TipInfo
 	UserAddReq                   = pb.UserAddReq
 	UserAddResp                  = pb.UserAddResp
 	UserAdds                     = pb.UserAdds
 	UserIdReq                    = pb.UserIdReq
+	UserInfo                     = pb.UserInfo
+	UserReq                      = pb.UserReq
 	WorkDesktopClearUserInfoReq  = pb.WorkDesktopClearUserInfoReq
 	WorkDesktopComprehensiveReq  = pb.WorkDesktopComprehensiveReq
 	WorkDesktopComprehensiveResp = pb.WorkDesktopComprehensiveResp
@@ -83,6 +96,14 @@ type (
 		WorkDesktopComprehensive(ctx context.Context, in *WorkDesktopComprehensiveReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error)
 		// 手动清除用户功能内存信息
 		WorkDesktopClearUserInfo(ctx context.Context, in *WorkDesktopClearUserInfoReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error)
+		// 获取客户信息
+		GetUserInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserInfo, error)
+		// 根据企业员工id获取员工的信息
+		GetEntUserInfo(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*EntUserResp, error)
+		// 获取企业员工列表
+		GetEntUserList(ctx context.Context, in *EntUserListReq, opts ...grpc.CallOption) (*EntUserListResp, error)
+		// 查看员工是否是企业管理员
+		CheckIsEntAdmin(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*CheckIsEntAdminResp, error)
 	}
 
 	defaultUserCenter struct {
@@ -185,3 +206,27 @@ func (m *defaultUserCenter) WorkDesktopClearUserInfo(ctx context.Context, in *Wo
 	client := pb.NewUserCenterClient(m.cli.Conn())
 	return client.WorkDesktopClearUserInfo(ctx, in, opts...)
 }
+
+// 获取客户信息
+func (m *defaultUserCenter) GetUserInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserInfo, error) {
+	client := pb.NewUserCenterClient(m.cli.Conn())
+	return client.GetUserInfo(ctx, in, opts...)
+}
+
+// 根据企业员工id获取员工的信息
+func (m *defaultUserCenter) GetEntUserInfo(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*EntUserResp, error) {
+	client := pb.NewUserCenterClient(m.cli.Conn())
+	return client.GetEntUserInfo(ctx, in, opts...)
+}
+
+// 获取企业员工列表
+func (m *defaultUserCenter) GetEntUserList(ctx context.Context, in *EntUserListReq, opts ...grpc.CallOption) (*EntUserListResp, error) {
+	client := pb.NewUserCenterClient(m.cli.Conn())
+	return client.GetEntUserList(ctx, in, opts...)
+}
+
+// 查看员工是否是企业管理员
+func (m *defaultUserCenter) CheckIsEntAdmin(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*CheckIsEntAdminResp, error) {
+	client := pb.NewUserCenterClient(m.cli.Conn())
+	return client.CheckIsEntAdmin(ctx, in, opts...)
+}

+ 33 - 0
service/entService.go

@@ -321,3 +321,36 @@ func (this *EntService) GetStatusByCode(data *userCenter.GetStatusByCodeReq) (in
 	}
 	return info.GetStatusByCode()
 }
+
+//根据entid 获取员工 信息
+func (this *EntService) GetEntUserInfo(data *userCenter.EntUserReq) (*entity.User, string) {
+	info := &entity.EntUserInfo{
+		Mysql:     entity.Mysql,
+		EntUserId: data.EntUserId,
+		EntId:     data.EntId,
+	}
+	return info.GetEntUserInfo()
+}
+
+//获取部门及子部门的员工列表
+func (this *EntService) GetEntUserList(data *userCenter.EntUserListReq) ([]*userCenter.EntUserListData, string) {
+	info := &entity.EntUserList{
+		Mysql:  entity.Mysql,
+		EntId:  data.EntId,
+		DeptId: data.DeptId,
+		Name:   data.Name,
+	}
+
+	return info.GetEntUserList()
+}
+
+//判断是否是企业管理员
+func (this *EntService) CheckEntUserAdmin(data *userCenter.EntUserReq) (int64, string) {
+	info := &entity.EntUserInfo{
+		Mysql:     entity.Mysql,
+		EntUserId: data.EntUserId,
+		EntId:     data.EntId,
+	}
+
+	return info.CheckEntAdmin()
+}

+ 68 - 0
service/ent_test.go

@@ -197,3 +197,71 @@ func Test_ExamineList(t *testing.T) {
 	log.Println("err ", err)
 	log.Println("res:", res)
 }
+
+// go test -v -run Test_UserInfo
+func Test_UserInfo(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
+	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &pb.UserReq{
+		UserId: 57685,
+		Types:  "f",
+		// EntId:     14904,
+		// EntUserId: 4254,
+	}
+
+	res, err := FileSystem.GetUserInfo(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
+// go test -v -run Test_EntUserInfo
+//获取用户企业信息
+func Test_EntUserInfo(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
+	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &pb.EntUserReq{
+		EntUserId: 4254,
+		AppId:     "10000",
+		EntId:     14904,
+	}
+
+	res, err := FileSystem.GetEntUserInfo(ctx, req)
+
+	log.Println("res:", res)
+	log.Println("err ", err)
+}
+
+// go test -v -run Test_EntUserList
+//获取企业列表/员工列表
+func Test_EntUserList(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
+	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &pb.EntUserListReq{
+		EntId: 149041,
+		AppId: "10000",
+		// DeptId: 3821,  //非必填
+		// Name: "后端",//非必填
+	}
+
+	res, err := FileSystem.GetEntUserList(ctx, req)
+
+	log.Println("res:", res)
+	log.Println("err ", err)
+}
+
+// go test -v -run Test_CheckIsEntAdmin
+//查看用户是否是管理员 1-企业管理员 2-部门管理员 3-员工
+func Test_CheckIsEntAdmin(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
+	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &pb.EntUserReq{
+		EntUserId: 4254,
+		AppId:     "10000",
+		EntId:     14904,
+	}
+
+	res, err := FileSystem.CheckIsEntAdmin(ctx, req)
+
+	log.Println("res:", res)
+	log.Println("err ", err)
+}

+ 19 - 0
service/subscribe.go

@@ -0,0 +1,19 @@
+package service
+
+import (
+	"userCenter/entity"
+	userCenter "userCenter/rpc/usercenter"
+)
+
+type SubscribeService struct{}
+
+//获取用户订阅信息  优先大会员、然后商机管理、然后超级订阅、然后免费订阅
+func (this *SubscribeService) GetSubscribeInfo(data *userCenter.UserReq) (map[string]interface{}, string) {
+	info := entity.UserInfoReq{
+		Mysql:  entity.Mysql,
+		Mgo:    entity.Mgo,
+		UserId: data.UserId,
+		Types:  data.Types,
+	}
+	return info.GetUserInfo()
+}

Some files were not shown because too many files changed in this diff