Преглед на файлове

feat:权益开通user-->entniche_rule

zhangxinlei1996 преди 2 години
родител
ревизия
26e5f98094
променени са 4 файла, в които са добавени 802 реда и са изтрити 100 реда
  1. 20 17
      go.mod
  2. 510 22
      go.sum
  3. 257 58
      service/service.go
  4. 15 3
      service/service_test.go

+ 20 - 17
go.mod

@@ -3,12 +3,12 @@ module bp.jydev.jianyu360.cn/BaseService/entManageApplication
 go 1.17
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20221010080805-39dc6a853eff
+	app.yhyue.com/moapp/jybase v0.0.0-20230109015757-aa3d5e19b196
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
-	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20221114070851-75c9b0950651
+	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230129060002-f69424aa14ba
 	github.com/golang/protobuf v1.5.2
-	github.com/zeromicro/go-zero v1.4.2
-	google.golang.org/grpc v1.50.1
+	github.com/zeromicro/go-zero v1.4.3
+	google.golang.org/grpc v1.51.0
 	google.golang.org/protobuf v1.28.1
 )
 
@@ -22,17 +22,20 @@ require (
 	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
 	github.com/fatih/color v1.13.0 // indirect
+	github.com/felixge/fgprof v0.9.3 // indirect
 	github.com/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-sql-driver/mysql v1.7.0 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
-	github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
+	github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
 	github.com/golang/mock v1.6.0 // indirect
 	github.com/golang/snappy v0.0.4 // indirect
-	github.com/google/go-cmp v0.5.8 // indirect
+	github.com/gomodule/redigo v1.8.9 // indirect
+	github.com/google/go-cmp v0.5.9 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
+	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
 	github.com/google/uuid v1.3.0 // indirect
 	github.com/googleapis/gnostic v0.5.5 // indirect
 	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
@@ -47,7 +50,7 @@ require (
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
 	github.com/openzipkin/zipkin-go v0.4.0 // indirect
-	github.com/pelletier/go-toml/v2 v2.0.5 // indirect
+	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
 	github.com/pkg/errors v0.9.1 // indirect
 	github.com/prometheus/client_golang v1.13.0 // indirect
 	github.com/prometheus/client_model v0.2.0 // indirect
@@ -61,7 +64,7 @@ require (
 	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/v3 v3.5.5 // indirect
-	go.mongodb.org/mongo-driver v1.10.3 // indirect
+	go.mongodb.org/mongo-driver v1.11.1 // indirect
 	go.opentelemetry.io/otel v1.11.0 // indirect
 	go.opentelemetry.io/otel/exporters/jaeger v1.11.0 // indirect
 	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect
@@ -76,15 +79,15 @@ require (
 	go.uber.org/multierr v1.8.0 // indirect
 	go.uber.org/zap v1.21.0 // indirect
 	golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
-	golang.org/x/net v0.0.0-20220531201128-c960675eff93 // indirect
-	golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
-	golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
+	golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
+	golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
+	golang.org/x/sync v0.1.0 // indirect
 	golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // 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
+	golang.org/x/text v0.4.0 // indirect
+	golang.org/x/time v0.3.0 // indirect
 	google.golang.org/appengine v1.6.7 // indirect
-	google.golang.org/genproto v0.0.0-20220602131408-e326c6e8e9c8 // indirect
+	google.golang.org/genproto v0.0.0-20221111202108-142d8a6fa32e // 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
@@ -93,8 +96,8 @@ require (
 	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
+	k8s.io/klog/v2 v2.80.1 // indirect
+	k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 // indirect
 	sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
 	sigs.k8s.io/yaml v1.2.0 // indirect
 )

Файловите разлики са ограничени, защото са твърде много
+ 510 - 22
go.sum


+ 257 - 58
service/service.go

@@ -74,7 +74,7 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
 					})
 				}
 				JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count + 1 where id = ?`, this.WaitEmpowerId)
-				addPower(this.WaitEmpowerId, entUserId)
+				addPower(this.WaitEmpowerId, entUserId, this.EntId)
 			}
 		}
 	}
@@ -177,20 +177,22 @@ func BuyProductList(this *entmanageapplication.BuyProductListReq) *entmanageappl
 	}
 }
 
-func addPower(waitEmpowerId int64, entUserId int) {
+func addPower(waitEmpowerId int64, entUserId int, entId int64) {
 	data := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
 	if data != nil && len(*data) > 0 {
 		orderId := common.Int64All((*data)["order_id"])
 		orderData := JyMysql.FindOne(Order, map[string]interface{}{"id": orderId}, "", "")
 		if orderData != nil && len(*orderData) > 0 {
 			productType := common.ObjToString((*orderData)["product_type"])
-			userId := getUserId(entUserId)
+
+			posititonId := getPositionId(entUserId)
+
 			if productType == "VIP订阅" {
-				log.Println("开通超级订阅", userId)
-				openPowerVip(*orderData, userId)
+				log.Println("开通超级订阅", posititonId)
+				setRule(1, int64(entUserId), entId, *orderData, posititonId)
 			} else if productType == "大会员" {
-				log.Println("开通大会员", userId)
-				openPowerBig(*orderData, userId)
+				log.Println("开通大会员", posititonId)
+				setRule(2, int64(entUserId), entId, *orderData, posititonId)
 			}
 		}
 	}
@@ -422,7 +424,7 @@ func StartSubVip(phone string, area map[string]interface{}, newBuyset SubvipBuyS
 	})
 
 	go func() {
-		MergeKws(userId)
+		// MergeKws(userId)
 		RedisDel(userId)
 	}()
 	if isOk {
@@ -432,18 +434,19 @@ func StartSubVip(phone string, area map[string]interface{}, newBuyset SubvipBuyS
 }
 
 // 初始化vip订阅关键词
-func MergeKws(userId string) {
-	if userId == "" { //11-11 取消此操作
+func MergeKws(entId, entUserId int64) {
+	if entUserId == 0 || entId == 0 { //11-11 取消此操作
 		return
 	}
-	data, ok := Mgo.FindById("user", userId, `{"o_jy":1,"o_vipjy":1}`)
-	var o_vipjy map[string]interface{}
+	data, ok := Mgo.FindOneByField("entniche_rule", map[string]interface{}{"i_entid": entId, "i_userid": entUserId}, `{"o_entniche":1,"_id":1}`)
+	var o_entniche map[string]interface{}
 	if ok && data != nil && len(*data) > 0 {
-		o_vipjy, _ = (*data)["o_vipjy"].(map[string]interface{})
-		a_items, _ := o_vipjy["a_items"].([]interface{})
+		o_entniche, _ = (*data)["o_entniche"].(map[string]interface{})
+		a_items, _ := o_entniche["a_items"].([]interface{})
 		if a_items == nil { //首次
-			Mgo.UpdateById("user", userId, map[string]interface{}{
-				"$set": map[string]interface{}{"o_vipjy.i_matchway": 1, "o_vipjy.i_ratemode": 1, "o_vipjy.i_wxpush": 1, "o_vipjy.i_apppush": 1, "o_vipjy.i_projectmatch": 0, "o_vipjy.a_infotype": []string{}, "o_vipjy.a_items": []string{}, "o_vipjy.l_modifydate": time.Now().Unix()},
+			_id := mongodb.BsonIdToSId((*data)["_id"])
+			Mgo.UpdateById("entniche_rule", _id, map[string]interface{}{
+				"$set": map[string]interface{}{"o_entniche.i_matchway": 1, "o_entniche.i_ratemode": 1, "o_entniche.i_wxpush": 1, "o_entniche.i_apppush": 1, "o_entniche.i_projectmatch": 0, "o_entniche.a_infotype": []string{}, "o_entniche.a_items": []string{}, "o_entniche.l_modifydate": time.Now().Unix()},
 			})
 		}
 	}
@@ -459,62 +462,258 @@ func delPower(id int64) {
 		if eOData != nil && len(*eOData) > 0 {
 			orderId := common.Int64All((*eOData)["order_id"])
 			orderData := JyMysql.FindOne(Order, map[string]interface{}{"id": orderId}, "", "")
+			set := map[string]interface{}{}
 			if orderData != nil && len(*orderData) > 0 {
 				productType := common.ObjToString((*orderData)["product_type"])
-				userId := getUserId(entUserId)
+				entId := common.Int64All((*orderData)["ent_id"])
 				if productType == "VIP订阅" {
-					Mgo.UpdateById("user", userId, map[string]interface{}{"$unset": map[string]interface{}{"i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1}})
+					set["l_vip_endtime"] = time.Now().Unix()
 				} else if productType == "大会员" {
-					Mgo.UpdateById("user", userId, map[string]interface{}{"$unset": map[string]interface{}{"i_member_status": 1, "i_member_starttime": 1, "i_member_endtime": 1}})
-					JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": userId}, map[string]interface{}{"i_status": -1})
+					posititonId := getPositionId(entUserId)
+					set["i_member_endtime"] = time.Now().Unix()
+					JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": posititonId}, map[string]interface{}{"i_status": -1})
 				}
-				RedisDel(userId)
+
+				Mgo.Update("ent_user", map[string]interface{}{
+					"i_entid":  entId,
+					"i_userid": entUserId,
+				}, map[string]interface{}{
+					"$set": set,
+				}, true, false)
+				// RedisDel(userId)
 			}
 		}
 	}
 }
 
-func getUserId(entUserId int) string {
-	data := JyMysql.FindOne(EntnicheUser, map[string]interface{}{"id": entUserId}, "", "")
-	userId := ""
-	now := time.Now()
-	if data != nil && len(*data) > 0 {
-		phone := common.ObjToString((*data)["phone"])
-		userData, ok := Mgo.FindOne("user", map[string]interface{}{"s_phone": phone})
-		if ok && userData != nil && len(*userData) > 0 {
-			userId = mongodb.BsonIdToSId((*userData)["_id"])
-		} else {
-			userDatas, oks := Mgo.FindOne("user", map[string]interface{}{"s_m_phone": phone})
-			if oks && userDatas != nil && len(*userDatas) > 0 {
-				userId = mongodb.BsonIdToSId((*userDatas)["_id"])
+//获取用户信息
+//return 职位id
+func getPositionId(entUserId int) int64 {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+	res, _ := UserCenterRpc.IdentityByEntUserId(ctx, &usercenter.IdentityReq{
+		Id: int64(entUserId),
+	})
+	log.Println(res)
+	return res.PositionId
+}
+
+//订阅设置
+//types:1超级订阅 2大会员
+func setRule(types int64, entUserId, entId int64, orderData map[string]interface{}, posititonId int64) bool {
+	//订阅设置
+	query := map[string]interface{}{
+		"i_entid":  entId,
+		"i_userid": entUserId,
+	}
+	//orderData相关权益
+	set := map[string]interface{}{}
+	setEntUser := map[string]interface{}{}
+	//超级订阅
+	if types == 1 {
+		set, setEntUser = vipSetMap(orderData)
+	} else if types == 2 {
+		set, setEntUser = memberSetMap(posititonId, orderData)
+	}
+
+	ok1 := Mgo.Update("entniche_rule", query, map[string]interface{}{
+		"$set": set,
+	}, true, false)
+	ok2 := Mgo.Update("ent_user", query, map[string]interface{}{
+		"$set": setEntUser,
+	}, true, false)
+
+	go func() {
+		MergeKws(entId, entUserId)
+		// RedisDel(userId)
+	}()
+	return ok1 && ok2
+}
+
+//
+func vipSetMap(orderData map[string]interface{}) (set map[string]interface{}, setEntUser map[string]interface{}) {
+	set, setEntUser = map[string]interface{}{}, map[string]interface{}{}
+	startTime := common.ObjToString(orderData["vip_starttime"])
+	endTime := common.ObjToString(orderData["vip_endtime"])
+	Date_Full_Layout := "2006-01-02 15:04:05"
+	startdate, _ := time.ParseInLocation(Date_Full_Layout, startTime, time.Local)
+	enddate, _ := time.ParseInLocation(Date_Full_Layout, endTime, time.Local)
+
+	dataType := 1
+	if startdate.Unix() > time.Now().Unix() {
+		dataType = 2
+	}
+	//为用户开通超级订阅权限
+	//是否开通超级订阅 -1 试用到期 -2 正式到期 1 试用 2 开通
+	isTrial := false
+	if dataType == 2 {
+		isTrial = true
+	}
+
+	setEntUser["l_createtime"] = time.Now().Unix()
+	setEntUser["l_vip_starttime"] = startdate.Unix()
+	setEntUser["l_vip_endtime"] = enddate.Unix()
+	setEntUser["i_vip_status"] = common.If(isTrial, -2, 2) //1试用 2正式 -2 试用到期
+	vms := VipSimpleMsg{}
+	json.Unmarshal([]byte(common.ObjToString(orderData["filter"])), &vms)
+
+	set = map[string]interface{}{
+		"o_entniche": map[string]interface{}{
+			"i_trial":      -1,              //已激活试用
+			"o_area":       *vms.Area,       //设置地区
+			"o_buyset":     *vms.NewBuyset,  //购买内容 城市、省份、行业数量
+			"a_buyerclass": []interface{}{}, //设置行业
+		},
+		"i_vip_expire_tip": 0, //消息提示初始化
+		"i_type":           1,
+	}
+	return
+}
+
+func memberSetMap(userId int64, orderData map[string]interface{}) (set map[string]interface{}, setEntUser map[string]interface{}) {
+	set, setEntUser = map[string]interface{}{}, map[string]interface{}{}
+	filterMap := common.ObjToMap(orderData["filter"])
+	level := common.IntAll((*filterMap)["level"])
+	comboId := common.IntAll((*filterMap)["comboId"])
+	payCycle := common.IntAll((*filterMap)["cycle"])
+	serversId := common.ObjToString((*filterMap)["serversId"])
+	startTime := common.ObjToString(orderData["vip_starttime"])
+	endTime := common.ObjToString(orderData["vip_endtime"])
+	tmp := "2006-01-02 15:04:05"
+	startdate, _ := time.ParseInLocation(tmp, startTime, time.Local)
+	enddate, _ := time.ParseInLocation(tmp, endTime, time.Local)
+	serverMap := GetServerPid()
+	dataType := 1
+	if startdate.Unix() > time.Now().Unix() {
+		dataType = 2
+	}
+	set = map[string]interface{}{
+		"o_member_jy": map[string]interface{}{
+			"i_wxpush": 1,
+		},
+	}
+	setEntUser = map[string]interface{}{
+		"i_member_status":    common.If(dataType == 1, level, -level),
+		"i_member_starttime": startdate.Unix(),
+		"i_member_endtime":   enddate.Unix(),
+		"i_mainaccount":      1,
+		"l_createtime":       time.Now().Unix(),
+	}
+	if comboId != 0 {
+		datas := JyMysql.FindOne("bigmember_combo", map[string]interface{}{"id": comboId}, "", "")
+		if datas == nil || len(*datas) == 0 {
+			log.Println("未找到此套餐")
+			return
+		}
+		s_servers := common.ObjToString((*datas)["s_servers"])
+		for _, s := range strings.Split(s_servers, ",") {
+			serverId, _ := strconv.Atoi(s)
+			mainId := serverId
+			if serverMap[serverId] != 0 {
+				serverId = serverMap[serverId]
+			}
+			serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
+			frequency := 0
+			if serverData != nil && len(*serverData) > 0 {
+				if serverId == 11 || serverId == 15 {
+					if serverId == 15 {
+						if payCycle >= 12 {
+							frequency = (payCycle / 12 * common.IntAll((*serverData)["s_count_year"])) + (payCycle % 12 * common.IntAll((*serverData)["s_count_month"]))
+						} else {
+							frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+						}
+					} else {
+						frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+					}
+				} else {
+					frequency = common.IntAll((*serverData)["s_count_month"])
+				}
+			}
+			sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
+			serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
+			if serverDatas != nil && len(*serverDatas) > 0 {
+				i_status := common.If(dataType == 1, 0, 1)
+				sql := "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+				status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
+				if status1 < 0 {
+					log.Println("新建服务-更新服务表出错", userId)
+					return
+				}
 			} else {
-				ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
-				res, _ := UserCenterRpc.UserAdd(ctx, &usercenter.UserAddReq{
-					Appid: "10000",
-					Phone: phone,
-				})
-				data := map[string]interface{}{
-					"i_appid":       2,
-					"s_phone":       phone,
-					"s_password":    "",
-					"l_registedate": now.Unix(),
-					"i_ts_guide":    2,
-					"o_jy": map[string]interface{}{
-						"i_wxpush":     1,
-						"i_apppush":    1,
-						"i_ratemode":   2,
-						"l_modifydate": now.Unix(),
-					},
-					"s_regsource":  "qmx_admin",
-					"base_user_id": res.Data.Id,
+				insert := map[string]interface{}{
+					"s_smainid":    mainId,
+					"s_userid":     userId,
+					"s_serviceid":  serverId,
+					"i_frequency":  frequency,
+					"l_starttime":  startdate.Format(tmp),
+					"l_endtime":    enddate.Format(tmp),
+					"i_status":     common.If(dataType == 1, 0, 1),
+					"l_createtime": time.Now().Format(tmp),
+					"l_updatetime": time.Now().Format(tmp),
+				}
+				order_id := JyMysql.Insert(BigServiceUser, insert)
+				if order_id > 0 {
+					log.Println("用户服务表插入成功", userId)
+				} else {
+					log.Println("用户服务表插入失败", userId)
+					return
 				}
-				_id := Mgo.Save("user", data)
-				log.Println("新增用户", _id)
-				if _id != "" {
-					userId = _id
+			}
+		}
+	} else {
+		for _, s := range strings.Split(serversId, ",") {
+			serverId, _ := strconv.Atoi(s)
+			mainId := serverId
+			if serverMap[serverId] != 0 {
+				serverId = serverMap[serverId]
+			}
+			serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
+			frequency := 0
+			if serverData != nil && len(*serverData) > 0 {
+				if serverId == 11 || serverId == 15 {
+					if serverId == 15 {
+						if payCycle >= 12 {
+							frequency = (payCycle / 12 * common.IntAll((*serverData)["s_count_year"])) + (payCycle % 12 * common.IntAll((*serverData)["s_count_month"]))
+						} else {
+							frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+						}
+					} else {
+						frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+					}
+				} else {
+					frequency = common.IntAll((*serverData)["s_count_month"])
+				}
+			}
+			sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
+			serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
+			if serverDatas != nil && len(*serverDatas) > 0 {
+				i_status := common.If(dataType == 1, 0, 1)
+				sql := "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+				status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
+				if status1 < 0 {
+					log.Println("新建服务-更新服务表出错")
+					return
+				}
+			} else {
+				insert := map[string]interface{}{
+					"s_userid":     userId,
+					"s_smainid":    mainId,
+					"s_serviceid":  serverId,
+					"i_frequency":  frequency,
+					"l_starttime":  startdate.Format(tmp),
+					"l_endtime":    enddate.Format(tmp),
+					"i_status":     common.If(dataType == 1, 0, 1),
+					"l_createtime": time.Now().Format(tmp),
+					"l_updatetime": time.Now().Format(tmp),
+				}
+				order_id := JyMysql.Insert(BigServiceUser, insert)
+				if order_id > 0 {
+					log.Println("用户服务表插入成功", userId)
+				} else {
+					log.Println("用户服务表插入失败")
+					return
 				}
 			}
 		}
 	}
-	return userId
+	return
 }

+ 15 - 3
service/service_test.go

@@ -9,6 +9,9 @@ import (
 	"app.yhyue.com/moapp/jybase/redis"
 	"bp.jydev.jianyu360.cn/BaseService/entManageApplication/entity"
 	"bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/pb"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
+	"github.com/zeromicro/go-zero/core/discov"
+	"github.com/zeromicro/go-zero/zrpc"
 )
 
 func init() {
@@ -23,6 +26,15 @@ func init() {
 	entity.JyMysql.Init()
 	entity.Mgo = mongodb.NewMgo("192.168.3.206:27080", "qfw", 10)
 	redis.InitRedisBySize("newother=192.168.3.206:1712", 100, 30, 300)
+	//用户中台配置
+	userClient := zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: []string{"127.0.0.1:2379"},
+			Key:   "usercenter.rpc",
+		},
+	})
+	entity.UserCenterRpc = usercenter.NewUserCenter(userClient)
+
 }
 
 func TestAddUsePerson(t *testing.T) {
@@ -34,9 +46,9 @@ func TestAddUsePerson(t *testing.T) {
 		{
 			name: "添加使用人员",
 			args: &pb.AddUsePersonReq{
-				EntId:         15023,
-				EntUserId:     "4576",
-				WaitEmpowerId: 18,
+				EntId:         15051,
+				EntUserId:     "4623",
+				WaitEmpowerId: 432,
 			},
 			want: "",
 		},

Някои файлове не бяха показани, защото твърде много файлове са промени