Răsfoiți Sursa

分支合并

lianbingjie 2 ani în urmă
părinte
comite
43af881a67

+ 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:

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

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/logic"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/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)
+		}
+	}
+}

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

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/logic"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/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

@@ -59,6 +59,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
+<<<<<<< HEAD
 				Path:    "/userCenter/workDesktop/menuInfo",
 				Handler: WorkDesktopMenuInfoHandler(serverCtx),
 			},
@@ -71,6 +72,15 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Method:  http.MethodGet,
 				Path:    "/userCenter/workDesktop/clearUserInfo",
 				Handler: WorkDesktopClearUserInfoHandler(serverCtx),
+=======
+				Path:    "/userCenter/user/getUserInfo",
+				Handler: GetUserInfoHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/userCenter/ent/userInfo",
+				Handler: GetEntUserInfoHandler(serverCtx),
+>>>>>>> master
 			},
 		},
 	)

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

@@ -0,0 +1,56 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/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
+}

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

@@ -0,0 +1,76 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/types"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
+	"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 {
+		resp.Error_msg = ""
+		resp.Error_code = -1
+		l.Error("get user info error:", err)
+	}
+	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 - 0
entity/db.go

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

+ 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
+}

+ 156 - 0
entity/entUser.go

@@ -0,0 +1,156 @@
+package entity
+
+import (
+	"encoding/json"
+	"fmt"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mysql"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
+)
+
+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
+}

+ 6 - 0
go.mod

@@ -6,8 +6,14 @@ require (
 	app.yhyue.com/moapp/jyInfo v1.0.0
 	app.yhyue.com/moapp/jybase v0.0.0-20220719064915-2fef79005dfa
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
+<<<<<<< HEAD
 	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.3.5
+	golang.org/x/net v0.0.0-20220706163947-c90051bbdb60 // indirect
+>>>>>>> master
 	google.golang.org/grpc v1.48.0
 	google.golang.org/protobuf v1.28.0
 )

+ 15 - 0
go.sum

@@ -16,8 +16,13 @@ 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=
+<<<<<<< HEAD
 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=
+>>>>>>> master
 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=
@@ -471,6 +476,10 @@ 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=
+<<<<<<< HEAD
+=======
+github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI=
+>>>>>>> master
 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=
@@ -733,8 +742,14 @@ golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qx
 golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+<<<<<<< HEAD
 golang.org/x/net v0.0.0-20220531201128-c960675eff93 h1:MYimHLfoXEpOhqd/zgoA/uoXzHB86AEky4LAx5ij9xA=
 golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+=======
+golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.0.0-20220706163947-c90051bbdb60 h1:8NSylCMxLW4JvserAndSgFL7aPli6A68yf0bYFTcWCM=
+golang.org/x/net v0.0.0-20220706163947-c90051bbdb60/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+>>>>>>> master
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=

+ 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

+ 10 - 0
rpc/internal/config/config.go

@@ -21,6 +21,7 @@ type Config struct {
 	IsRun            bool   //定时任务是否开启
 	CheckEntIsExpire string //
 	DoMain           string
+<<<<<<< HEAD
 	RedisAddrees     []string
 	RedisOutTime     int64
 	InternalTime     int64
@@ -42,6 +43,9 @@ type MongoStruct struct {
 	CollectionBack string `json:"collectionBack,optional"`
 	MaxOpenConns   int    `json:"maxOpenConns,optional"`
 	MaxIdleConns   int    `json:"maxIdleConns,optional"`
+=======
+	Mongo            Mongodb
+>>>>>>> master
 }
 
 var (
@@ -49,6 +53,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"`

+ 13 - 0
rpc/internal/db/db.go

@@ -6,6 +6,7 @@ import (
 	"log"
 	"strings"
 
+	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"userCenter/entity"
 	"userCenter/rpc/internal/config"
@@ -32,6 +33,7 @@ func init() {
 	}
 	log.Println("初始化 base mysql")
 	entity.BaseMysql.Init()
+<<<<<<< HEAD
 
 	log.Println("初始化 redis")
 	redis.InitRedisBySize(strings.Join(config.ConfigJson.RedisAddrees, ","), 100, 30, 300)
@@ -48,4 +50,15 @@ func init() {
 	}
 	//用户角色功能初始化
 	entity.UserRolePowerInit(config.ConfigJson.UserRolePower)
+=======
+	log.Println("初始化 mysql")
+
+	entity.Mgo = mongodb.MongodbSim{
+		MongodbAddr: config.ConfigJson.Mongo.Address,
+		Size:        config.ConfigJson.Mongo.Size,
+		DbName:      config.ConfigJson.Mongo.DbName,
+	}
+	entity.Mgo.InitPool()
+	log.Println("初始化mongodb")
+>>>>>>> master
 }

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

@@ -0,0 +1,40 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/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"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/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"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/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
+}

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

@@ -0,0 +1,117 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
+
+	"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

@@ -76,6 +76,30 @@ func (s *UserCenterServer) GetStatusByCode(ctx context.Context, in *pb.GetStatus
 	return l.GetStatusByCode(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)
+}
+
 // 新增用户
 func (s *UserCenterServer) UserAdd(ctx context.Context, in *pb.UserAddReq) (*pb.UserAddResp, error) {
 	l := logic.NewUserAddLogic(ctx, s.svcCtx)

Fișier diff suprimat deoarece este prea mare
+ 403 - 169
rpc/pb/userCenter.pb.go


+ 238 - 0
rpc/pb/userCenter_grpc.pb.go

@@ -1,7 +1,11 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
+<<<<<<< HEAD
 // - protoc             v3.15.5
+=======
+// - protoc             v3.19.4
+>>>>>>> master
 // source: userCenter.proto
 
 package pb
@@ -40,18 +44,32 @@ type UserCenterClient interface {
 	ExamineInfo(ctx context.Context, in *CheckExamineReq, opts ...grpc.CallOption) (*EntInfoResp, error)
 	//根据统一社会信用代码查询企业状态
 	GetStatusByCode(ctx context.Context, in *GetStatusByCodeReq, opts ...grpc.CallOption) (*GetStatusByCodeResp, error)
+<<<<<<< HEAD
+=======
+	//获取客户信息
+	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)
+>>>>>>> master
 	//新增用户
 	UserAdd(ctx context.Context, in *UserAddReq, opts ...grpc.CallOption) (*UserAddResp, error)
 	//更新用户
 	UserUpdate(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*ExamineResp, error)
 	//删除用户
 	UserDel(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*ExamineResp, error)
+<<<<<<< HEAD
 	//获取菜单树
 	WorkDesktopMenuInfo(ctx context.Context, in *WorkDesktopMenuInfoReq, opts ...grpc.CallOption) (*WorkDesktopMenuInfoResp, error)
 	//菜单选择模式||常用功能更新||常用功能列表
 	WorkDesktopComprehensive(ctx context.Context, in *WorkDesktopComprehensiveReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error)
 	//手动清除用户功能内存信息
 	WorkDesktopClearUserInfo(ctx context.Context, in *WorkDesktopClearUserInfoReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error)
+=======
+>>>>>>> master
 }
 
 type userCenterClient struct {
@@ -143,54 +161,99 @@ func (c *userCenterClient) GetStatusByCode(ctx context.Context, in *GetStatusByC
 	return out, nil
 }
 
+<<<<<<< HEAD
 func (c *userCenterClient) UserAdd(ctx context.Context, in *UserAddReq, opts ...grpc.CallOption) (*UserAddResp, error) {
 	out := new(UserAddResp)
 	err := c.cc.Invoke(ctx, "/UserCenter/UserAdd", in, out, opts...)
+=======
+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...)
+>>>>>>> master
 	if err != nil {
 		return nil, err
 	}
 	return out, nil
 }
 
+<<<<<<< HEAD
 func (c *userCenterClient) UserUpdate(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*ExamineResp, error) {
 	out := new(ExamineResp)
 	err := c.cc.Invoke(ctx, "/UserCenter/UserUpdate", in, out, opts...)
+=======
+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...)
+>>>>>>> master
 	if err != nil {
 		return nil, err
 	}
 	return out, nil
 }
 
+<<<<<<< HEAD
 func (c *userCenterClient) UserDel(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*ExamineResp, error) {
 	out := new(ExamineResp)
 	err := c.cc.Invoke(ctx, "/UserCenter/UserDel", in, out, opts...)
+=======
+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...)
+>>>>>>> master
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+<<<<<<< HEAD
 func (c *userCenterClient) WorkDesktopMenuInfo(ctx context.Context, in *WorkDesktopMenuInfoReq, opts ...grpc.CallOption) (*WorkDesktopMenuInfoResp, error) {
 	out := new(WorkDesktopMenuInfoResp)
 	err := c.cc.Invoke(ctx, "/UserCenter/WorkDesktopMenuInfo", in, out, opts...)
+=======
+func (c *userCenterClient) UserAdd(ctx context.Context, in *UserAddReq, opts ...grpc.CallOption) (*UserAddResp, error) {
+	out := new(UserAddResp)
+	err := c.cc.Invoke(ctx, "/UserCenter/UserAdd", in, out, opts...)
+>>>>>>> master
 	if err != nil {
 		return nil, err
 	}
 	return out, nil
 }
 
+<<<<<<< HEAD
 func (c *userCenterClient) WorkDesktopComprehensive(ctx context.Context, in *WorkDesktopComprehensiveReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error) {
 	out := new(WorkDesktopComprehensiveResp)
 	err := c.cc.Invoke(ctx, "/UserCenter/WorkDesktopComprehensive", in, out, opts...)
+=======
+func (c *userCenterClient) UserUpdate(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*ExamineResp, error) {
+	out := new(ExamineResp)
+	err := c.cc.Invoke(ctx, "/UserCenter/UserUpdate", in, out, opts...)
+>>>>>>> master
 	if err != nil {
 		return nil, err
 	}
 	return out, nil
 }
 
+<<<<<<< HEAD
 func (c *userCenterClient) WorkDesktopClearUserInfo(ctx context.Context, in *WorkDesktopClearUserInfoReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error) {
 	out := new(WorkDesktopComprehensiveResp)
 	err := c.cc.Invoke(ctx, "/UserCenter/WorkDesktopClearUserInfo", in, out, opts...)
+=======
+func (c *userCenterClient) UserDel(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*ExamineResp, error) {
+	out := new(ExamineResp)
+	err := c.cc.Invoke(ctx, "/UserCenter/UserDel", in, out, opts...)
+>>>>>>> master
 	if err != nil {
 		return nil, err
 	}
@@ -219,18 +282,32 @@ type UserCenterServer interface {
 	ExamineInfo(context.Context, *CheckExamineReq) (*EntInfoResp, error)
 	//根据统一社会信用代码查询企业状态
 	GetStatusByCode(context.Context, *GetStatusByCodeReq) (*GetStatusByCodeResp, error)
+<<<<<<< HEAD
+=======
+	//获取客户信息
+	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)
+>>>>>>> master
 	//新增用户
 	UserAdd(context.Context, *UserAddReq) (*UserAddResp, error)
 	//更新用户
 	UserUpdate(context.Context, *UserIdReq) (*ExamineResp, error)
 	//删除用户
 	UserDel(context.Context, *UserIdReq) (*ExamineResp, error)
+<<<<<<< HEAD
 	//获取菜单树
 	WorkDesktopMenuInfo(context.Context, *WorkDesktopMenuInfoReq) (*WorkDesktopMenuInfoResp, error)
 	//菜单选择模式||常用功能更新||常用功能列表
 	WorkDesktopComprehensive(context.Context, *WorkDesktopComprehensiveReq) (*WorkDesktopComprehensiveResp, error)
 	//手动清除用户功能内存信息
 	WorkDesktopClearUserInfo(context.Context, *WorkDesktopClearUserInfoReq) (*WorkDesktopComprehensiveResp, error)
+=======
+>>>>>>> master
 	mustEmbedUnimplementedUserCenterServer()
 }
 
@@ -265,6 +342,21 @@ func (UnimplementedUserCenterServer) ExamineInfo(context.Context, *CheckExamineR
 func (UnimplementedUserCenterServer) GetStatusByCode(context.Context, *GetStatusByCodeReq) (*GetStatusByCodeResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetStatusByCode not implemented")
 }
+<<<<<<< HEAD
+=======
+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")
+}
+>>>>>>> master
 func (UnimplementedUserCenterServer) UserAdd(context.Context, *UserAddReq) (*UserAddResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method UserAdd not implemented")
 }
@@ -274,6 +366,7 @@ func (UnimplementedUserCenterServer) UserUpdate(context.Context, *UserIdReq) (*E
 func (UnimplementedUserCenterServer) UserDel(context.Context, *UserIdReq) (*ExamineResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method UserDel not implemented")
 }
+<<<<<<< HEAD
 func (UnimplementedUserCenterServer) WorkDesktopMenuInfo(context.Context, *WorkDesktopMenuInfoReq) (*WorkDesktopMenuInfoResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method WorkDesktopMenuInfo not implemented")
 }
@@ -283,6 +376,8 @@ func (UnimplementedUserCenterServer) WorkDesktopComprehensive(context.Context, *
 func (UnimplementedUserCenterServer) WorkDesktopClearUserInfo(context.Context, *WorkDesktopClearUserInfoReq) (*WorkDesktopComprehensiveResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method WorkDesktopClearUserInfo not implemented")
 }
+=======
+>>>>>>> master
 func (UnimplementedUserCenterServer) mustEmbedUnimplementedUserCenterServer() {}
 
 // UnsafeUserCenterServer may be embedded to opt out of forward compatibility for this service.
@@ -458,12 +553,18 @@ func _UserCenter_GetStatusByCode_Handler(srv interface{}, ctx context.Context, d
 	return interceptor(ctx, in, info, handler)
 }
 
+<<<<<<< HEAD
 func _UserCenter_UserAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(UserAddReq)
+=======
+func _UserCenter_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(UserReq)
+>>>>>>> master
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
+<<<<<<< HEAD
 		return srv.(UserCenterServer).UserAdd(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
@@ -472,16 +573,32 @@ func _UserCenter_UserAdd_Handler(srv interface{}, ctx context.Context, dec func(
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(UserCenterServer).UserAdd(ctx, req.(*UserAddReq))
+=======
+		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))
+>>>>>>> master
 	}
 	return interceptor(ctx, in, info, handler)
 }
 
+<<<<<<< HEAD
 func _UserCenter_UserUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(UserIdReq)
+=======
+func _UserCenter_GetEntUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(EntUserReq)
+>>>>>>> master
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
+<<<<<<< HEAD
 		return srv.(UserCenterServer).UserUpdate(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
@@ -490,16 +607,32 @@ func _UserCenter_UserUpdate_Handler(srv interface{}, ctx context.Context, dec fu
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(UserCenterServer).UserUpdate(ctx, req.(*UserIdReq))
+=======
+		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))
+>>>>>>> master
 	}
 	return interceptor(ctx, in, info, handler)
 }
 
+<<<<<<< HEAD
 func _UserCenter_UserDel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(UserIdReq)
+=======
+func _UserCenter_GetEntUserList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(EntUserListReq)
+>>>>>>> master
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
+<<<<<<< HEAD
 		return srv.(UserCenterServer).UserDel(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
@@ -508,16 +641,50 @@ func _UserCenter_UserDel_Handler(srv interface{}, ctx context.Context, dec func(
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(UserCenterServer).UserDel(ctx, req.(*UserIdReq))
+=======
+		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))
+>>>>>>> master
 	}
 	return interceptor(ctx, in, info, handler)
 }
 
+<<<<<<< HEAD
 func _UserCenter_WorkDesktopMenuInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(WorkDesktopMenuInfoReq)
+=======
+func _UserCenter_UserAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(UserAddReq)
+>>>>>>> master
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
+<<<<<<< HEAD
 		return srv.(UserCenterServer).WorkDesktopMenuInfo(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
@@ -526,16 +693,32 @@ func _UserCenter_WorkDesktopMenuInfo_Handler(srv interface{}, ctx context.Contex
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(UserCenterServer).WorkDesktopMenuInfo(ctx, req.(*WorkDesktopMenuInfoReq))
+=======
+		return srv.(UserCenterServer).UserAdd(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/UserCenter/UserAdd",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserCenterServer).UserAdd(ctx, req.(*UserAddReq))
+>>>>>>> master
 	}
 	return interceptor(ctx, in, info, handler)
 }
 
+<<<<<<< HEAD
 func _UserCenter_WorkDesktopComprehensive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(WorkDesktopComprehensiveReq)
+=======
+func _UserCenter_UserUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(UserIdReq)
+>>>>>>> master
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
+<<<<<<< HEAD
 		return srv.(UserCenterServer).WorkDesktopComprehensive(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
@@ -544,16 +727,32 @@ func _UserCenter_WorkDesktopComprehensive_Handler(srv interface{}, ctx context.C
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(UserCenterServer).WorkDesktopComprehensive(ctx, req.(*WorkDesktopComprehensiveReq))
+=======
+		return srv.(UserCenterServer).UserUpdate(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/UserCenter/UserUpdate",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserCenterServer).UserUpdate(ctx, req.(*UserIdReq))
+>>>>>>> master
 	}
 	return interceptor(ctx, in, info, handler)
 }
 
+<<<<<<< HEAD
 func _UserCenter_WorkDesktopClearUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(WorkDesktopClearUserInfoReq)
+=======
+func _UserCenter_UserDel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(UserIdReq)
+>>>>>>> master
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
+<<<<<<< HEAD
 		return srv.(UserCenterServer).WorkDesktopClearUserInfo(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
@@ -562,6 +761,16 @@ func _UserCenter_WorkDesktopClearUserInfo_Handler(srv interface{}, ctx context.C
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(UserCenterServer).WorkDesktopClearUserInfo(ctx, req.(*WorkDesktopClearUserInfoReq))
+=======
+		return srv.(UserCenterServer).UserDel(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/UserCenter/UserDel",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserCenterServer).UserDel(ctx, req.(*UserIdReq))
+>>>>>>> master
 	}
 	return interceptor(ctx, in, info, handler)
 }
@@ -610,6 +819,7 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
 			Handler:    _UserCenter_GetStatusByCode_Handler,
 		},
 		{
+<<<<<<< HEAD
 			MethodName: "UserAdd",
 			Handler:    _UserCenter_UserAdd_Handler,
 		},
@@ -632,6 +842,34 @@ 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,
+		},
+		{
+			MethodName: "UserAdd",
+			Handler:    _UserCenter_UserAdd_Handler,
+		},
+		{
+			MethodName: "UserUpdate",
+			Handler:    _UserCenter_UserUpdate_Handler,
+		},
+		{
+			MethodName: "UserDel",
+			Handler:    _UserCenter_UserDel_Handler,
+>>>>>>> master
 		},
 	},
 	Streams:  []grpc.StreamDesc{},

+ 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);
 }

+ 92 - 0
rpc/usercenter/usercenter.go

@@ -13,6 +13,7 @@ import (
 )
 
 type (
+<<<<<<< HEAD
 	CheckData                    = pb.CheckData
 	CheckEntReq                  = pb.CheckEntReq
 	CheckEntResp                 = pb.CheckEntResp
@@ -51,6 +52,49 @@ type (
 	WorkDesktopComprehensiveResp = pb.WorkDesktopComprehensiveResp
 	WorkDesktopMenuInfoReq       = pb.WorkDesktopMenuInfoReq
 	WorkDesktopMenuInfoResp      = pb.WorkDesktopMenuInfoResp
+=======
+	CheckData           = pb.CheckData
+	CheckEntReq         = pb.CheckEntReq
+	CheckEntResp        = pb.CheckEntResp
+	CheckExamineReq     = pb.CheckExamineReq
+	CheckIsEntAdminResp = pb.CheckIsEntAdminResp
+	EntAuthData         = pb.EntAuthData
+	EntAuthReq          = pb.EntAuthReq
+	EntAuthResp         = pb.EntAuthResp
+	EntData             = pb.EntData
+	EntInfoData         = pb.EntInfoData
+	EntInfoResp         = pb.EntInfoResp
+	EntList             = pb.EntList
+	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
+	ExamineListReq      = pb.ExamineListReq
+	ExamineListResp     = pb.ExamineListResp
+	ExamineReq          = pb.ExamineReq
+	ExamineResp         = pb.ExamineResp
+	GetStatusByCode     = pb.GetStatusByCode
+	GetStatusByCodeReq  = pb.GetStatusByCodeReq
+	GetStatusByCodeResp = pb.GetStatusByCodeResp
+	Items               = pb.Items
+	Keys                = pb.Keys
+	List                = pb.List
+	Subscribe           = pb.Subscribe
+	UserAddReq          = pb.UserAddReq
+	UserAddResp         = pb.UserAddResp
+	UserAdds            = pb.UserAdds
+	UserIdReq           = pb.UserIdReq
+	UserInfo            = pb.UserInfo
+	UserReq             = pb.UserReq
+>>>>>>> master
 
 	UserCenter interface {
 		// 企业认证
@@ -71,18 +115,32 @@ type (
 		ExamineInfo(ctx context.Context, in *CheckExamineReq, opts ...grpc.CallOption) (*EntInfoResp, error)
 		// 根据统一社会信用代码查询企业状态
 		GetStatusByCode(ctx context.Context, in *GetStatusByCodeReq, opts ...grpc.CallOption) (*GetStatusByCodeResp, error)
+<<<<<<< HEAD
+=======
+		// 获取客户信息
+		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)
+>>>>>>> master
 		// 新增用户
 		UserAdd(ctx context.Context, in *UserAddReq, opts ...grpc.CallOption) (*UserAddResp, error)
 		// 更新用户
 		UserUpdate(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*ExamineResp, error)
 		// 删除用户
 		UserDel(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*ExamineResp, error)
+<<<<<<< HEAD
 		// 获取菜单树
 		WorkDesktopMenuInfo(ctx context.Context, in *WorkDesktopMenuInfoReq, opts ...grpc.CallOption) (*WorkDesktopMenuInfoResp, error)
 		// 菜单选择模式||常用功能更新||常用功能列表
 		WorkDesktopComprehensive(ctx context.Context, in *WorkDesktopComprehensiveReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error)
 		// 手动清除用户功能内存信息
 		WorkDesktopClearUserInfo(ctx context.Context, in *WorkDesktopClearUserInfoReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error)
+=======
+>>>>>>> master
 	}
 
 	defaultUserCenter struct {
@@ -146,8 +204,37 @@ func (m *defaultUserCenter) ExamineInfo(ctx context.Context, in *CheckExamineReq
 
 // 根据统一社会信用代码查询企业状态
 func (m *defaultUserCenter) GetStatusByCode(ctx context.Context, in *GetStatusByCodeReq, opts ...grpc.CallOption) (*GetStatusByCodeResp, error) {
+<<<<<<< HEAD
 	client := pb.NewUserCenterClient(m.cli.Conn())
 	return client.GetStatusByCode(ctx, in, opts...)
+=======
+	client := pb.NewUserCenterClient(m.cli.Conn())
+	return client.GetStatusByCode(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...)
+>>>>>>> master
 }
 
 // 新增用户
@@ -164,6 +251,7 @@ func (m *defaultUserCenter) UserUpdate(ctx context.Context, in *UserIdReq, opts
 
 // 删除用户
 func (m *defaultUserCenter) UserDel(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*ExamineResp, error) {
+<<<<<<< HEAD
 	client := pb.NewUserCenterClient(m.cli.Conn())
 	return client.UserDel(ctx, in, opts...)
 }
@@ -184,4 +272,8 @@ func (m *defaultUserCenter) WorkDesktopComprehensive(ctx context.Context, in *Wo
 func (m *defaultUserCenter) WorkDesktopClearUserInfo(ctx context.Context, in *WorkDesktopClearUserInfoReq, opts ...grpc.CallOption) (*WorkDesktopComprehensiveResp, error) {
 	client := pb.NewUserCenterClient(m.cli.Conn())
 	return client.WorkDesktopClearUserInfo(ctx, in, opts...)
+=======
+	client := pb.NewUserCenterClient(m.cli.Conn())
+	return client.UserDel(ctx, in, opts...)
+>>>>>>> master
 }

+ 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 (
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
+	userCenter "bp.jydev.jianyu360.cn/BaseService/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()
+}

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff