Ver Fonte

feat:首次访问推送列表 默认推送数据

wangshan há 3 anos atrás
pai
commit
e2348cd66f

+ 4 - 0
jyBXSubscribe/api/bxsubscribe.api

@@ -11,6 +11,10 @@ type (
 	//订阅列表
 	subscribeReq {
 		AppId      string `header:"appId"`
+		UserId     string `header:"userId"`
+		EntId      string `header:"entId"`
+		EntUserId  string `header:"entUserId"`
+		DeptId     string `header:"deptId"` //部门id
 		PageNum    int64  `json:"pageNum,optional"`
 		PageSize   int64  `json:"pageSize,optional"`
 		SelectTime string `json:"selectTime,optional"`

+ 4 - 2
jyBXSubscribe/api/internal/logic/subscribeListLogic.go

@@ -40,8 +40,10 @@ func (l *SubscribeListLogic) SubscribeList(req *types.SubscribeReq) (resp *types
 		UserType:   req.UserType,
 		Price:      req.Price,
 		FileExists: req.FileExists,
-		UserId:     l.r.Header.Get("userId"),
-		EntId:      l.r.Header.Get("entId"),
+		UserId:     req.UserId,
+		EntId:      req.EntId,
+		EntUserId:  req.EntUserId,
+		DeptId:     req.DeptId,
 	})
 	if err != nil {
 		return &types.CommonResp{

+ 4 - 0
jyBXSubscribe/api/internal/types/types.go

@@ -3,6 +3,10 @@ package types
 
 type SubscribeReq struct {
 	AppId      string `header:"appId"`
+	UserId     string `header:"userId"`
+	EntId      string `header:"entId"`
+	EntUserId  string `header:"entUserId"`
+	DeptId     string `header:"deptId"` //部门id
 	PageNum    int64  `json:"pageNum,optional"`
 	PageSize   int64  `json:"pageSize,optional"`
 	SelectTime string `json:"selectTime,optional"`

+ 1 - 1
jyBXSubscribe/go.mod

@@ -3,7 +3,7 @@ module jyBXSubscribe
 go 1.16
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20220527014844-2736644c3090
+	app.yhyue.com/moapp/jybase v0.0.0-20220617085837-48c1bf245c2f
 	bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220505015640-56e56f06bc5c
 	github.com/go-sql-driver/mysql v1.6.0
 	github.com/golang/protobuf v1.5.2

+ 2 - 2
jyBXSubscribe/go.sum

@@ -4,8 +4,8 @@ app.yhyue.com/moapp/jybase v0.0.0-20220415064050-37ce64b3e2d4/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20220418104200-46c3fff161c7/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220420032112-668025915ee4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220421060131-a1001013ba46/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
-app.yhyue.com/moapp/jybase v0.0.0-20220527014844-2736644c3090 h1:K2FTqMDQkkKvM9t/oqa9MLKciZDngrxDH1OkriDGOZM=
-app.yhyue.com/moapp/jybase v0.0.0-20220527014844-2736644c3090/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
+app.yhyue.com/moapp/jybase v0.0.0-20220617085837-48c1bf245c2f h1:U8sVqWn/JH2gcsJqQcHFaCx/MtY1pGUwbUAc5dVkwto=
+app.yhyue.com/moapp/jybase v0.0.0-20220617085837-48c1bf245c2f/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/AUH9Yr1wzarEjOaNMkj1Cet/9r8IgLyba64Z52E=
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220419090715-88ddb32961be/go.mod h1:Yj4oabIGItuMoF0BXYLz2XAnF581kxgXBrvlUtIJrkI=
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220505015640-56e56f06bc5c h1:p2WctRqfE6wdLPHnACIO983CfYV2LLaaLC2ADpSaNn0=

+ 2 - 0
jyBXSubscribe/rpc/bxsubscribe.proto

@@ -19,6 +19,8 @@ message SubscribeInfosReq {
   string  appId = 13;
   string  price = 14;
   string  fileExists = 15;
+  string  entUserId = 16;
+  string deptId = 17;
 }
 
 message SubscribeInfosResp {

+ 5 - 1
jyBXSubscribe/rpc/etc/bxsubscribe.yaml

@@ -5,4 +5,8 @@ Etcd:
   - 127.0.0.1:2379
   Key: bxsubscribe.rpc
 Timeout: 8000
-Webrpcport: 8011
+Webrpcport: 8011
+DefaultDay: 7
+DefaulCount:
+  Pay: 1000
+  Free: 50

+ 2 - 0
jyBXSubscribe/rpc/init/init.go

@@ -48,4 +48,6 @@ func init() {
 			logx.Info(v, "--日志记录")
 		}
 	}
+	//
+	PushMapping.Init()
 }

+ 6 - 1
jyBXSubscribe/rpc/internal/config/config.go

@@ -7,7 +7,12 @@ import (
 
 type Config struct {
 	zrpc.RpcServerConf
-	Webrpcport int64
+	Webrpcport  int64
+	DefaultDay  int
+	DefaulCount struct {
+		Pay  int
+		Free int
+	}
 }
 
 type Db struct {

+ 12 - 0
jyBXSubscribe/rpc/internal/logic/getsublistlogic.go

@@ -50,6 +50,10 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 		Key:           in.KeyWords,                        //关键词
 		Price:         in.Price,                           //价格区间
 		FileExists:    in.FileExists,                      //是否有附件
+		EntId:         in.EntId,                           //商机管理企业id
+		EntUserId:     in.EntUserId,                       //商机管理用户id
+		DeptId:        in.DeptId,                          //商机管理部门id
+
 	}
 	if in.UserType == "mType" {
 		spqp.PushMysql = IC.MemberPushMysql
@@ -59,6 +63,14 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 		spqp.PushMysql = IC.PushMysql
 	}
 	hasNextPage, total, list := util.NewSubscribePush(in.UserType).Datas(spqp)
+	/*
+	 *无推送记录生成推送记录
+	 *免费用户默认推送50条
+	 *大会员、新版商机管理、超级订阅用户 默认推送1000条记录
+	 */
+	if in.PageNum == 1 && spqp.IsEmpty() && len(list) == 0 {
+		hasNextPage, total, list = util.NewSubscribePush(in.UserType).DefaultDatas(spqp)
+	}
 	//查询是否收藏
 	util.NewSubscribePush(in.UserType).MakeCollection(in.UserId, list)
 	return &bxsubscribe.SubscribeInfosResp{

+ 116 - 97
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go

@@ -45,6 +45,8 @@ type SubscribeInfosReq struct {
 	AppId      string `protobuf:"bytes,13,opt,name=appId,proto3" json:"appId,omitempty"`
 	Price      string `protobuf:"bytes,14,opt,name=price,proto3" json:"price,omitempty"`
 	FileExists string `protobuf:"bytes,15,opt,name=fileExists,proto3" json:"fileExists,omitempty"`
+	EntUserId  string `protobuf:"bytes,16,opt,name=entUserId,proto3" json:"entUserId,omitempty"`
+	DeptId     string `protobuf:"bytes,17,opt,name=deptId,proto3" json:"deptId,omitempty"`
 }
 
 func (x *SubscribeInfosReq) Reset() {
@@ -184,6 +186,20 @@ func (x *SubscribeInfosReq) GetFileExists() string {
 	return ""
 }
 
+func (x *SubscribeInfosReq) GetEntUserId() string {
+	if x != nil {
+		return x.EntUserId
+	}
+	return ""
+}
+
+func (x *SubscribeInfosReq) GetDeptId() string {
+	if x != nil {
+		return x.DeptId
+	}
+	return ""
+}
+
 type SubscribeInfosResp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -315,7 +331,7 @@ type SubscribeInfo struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	XId          string   `protobuf:"bytes,1,opt,name=_id,json=Id,proto3" json:"_id,omitempty"`
+	XId          string   `protobuf:"bytes,1,opt,name=_id,json=Id,proto3" json:"_id,omitempty"` //和推送程序 缓存保持一致
 	Title        string   `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
 	Area         string   `protobuf:"bytes,3,opt,name=area,proto3" json:"area,omitempty"`
 	BuyerClass   string   `protobuf:"bytes,4,opt,name=buyerClass,proto3" json:"buyerClass,omitempty"`
@@ -760,7 +776,7 @@ var File_bxsubscribe_proto protoreflect.FileDescriptor
 var file_bxsubscribe_proto_rawDesc = []byte{
 	0x0a, 0x11, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x2e, 0x70, 0x72,
 	0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65,
-	0x22, 0x99, 0x03, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x49, 0x6e,
+	0x22, 0xcf, 0x03, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x49, 0x6e,
 	0x66, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75,
 	0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d,
 	0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01,
@@ -785,101 +801,104 @@ var file_bxsubscribe_proto_rawDesc = []byte{
 	0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18,
 	0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x0a,
 	0x66, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09,
-	0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x22, 0x78, 0x0a, 0x12,
-	0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x52, 0x65,
-	0x73, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x72, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x72, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a,
-	0x07, 0x65, 0x72, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
-	0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x2e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03,
-	0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
-	0x62, 0x65, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x44, 0x61, 0x74, 0x61,
-	0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x77, 0x0a, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72,
-	0x69, 0x62, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x20, 0x0a,
-	0x0b, 0x68, 0x61, 0x73, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01,
-	0x28, 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x12,
-	0x2e, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
-	0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x2e, 0x73, 0x75, 0x62, 0x73,
-	0x63, 0x72, 0x69, 0x62, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22,
-	0xd4, 0x04, 0x0a, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x49, 0x6e, 0x66,
-	0x6f, 0x12, 0x0f, 0x0a, 0x03, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
-	0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x65, 0x61,
-	0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x65, 0x61, 0x12, 0x1e, 0x0a, 0x0a,
-	0x62, 0x75, 0x79, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
-	0x52, 0x0a, 0x62, 0x75, 0x79, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07,
-	0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
-	0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x64, 0x75, 0x73, 0x74,
-	0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x75, 0x73, 0x74,
-	0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d,
-	0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68,
-	0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x61, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78,
-	0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x61, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12,
-	0x17, 0x0a, 0x07, 0x63, 0x61, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03,
-	0x52, 0x06, 0x63, 0x61, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x5f, 0x69,
-	0x73, 0x76, 0x69, 0x73, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x61,
-	0x49, 0x73, 0x76, 0x69, 0x73, 0x69, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x61, 0x5f, 0x74, 0x79,
-	0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x61, 0x54, 0x79, 0x70, 0x65,
-	0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x0c, 0x20,
-	0x03, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x16,
-	0x0a, 0x06, 0x62, 0x75, 0x64, 0x67, 0x65, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
-	0x62, 0x75, 0x64, 0x67, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x69, 0x64, 0x41, 0x6d, 0x6f,
-	0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x69, 0x64, 0x41, 0x6d,
-	0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69,
-	0x6f, 0x6e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63,
-	0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x75, 0x79, 0x65, 0x72, 0x18, 0x10, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x79, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72,
-	0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x0b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06,
-	0x77, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x77, 0x69,
-	0x6e, 0x6e, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x64, 0x4f, 0x70, 0x65, 0x6e, 0x54,
-	0x69, 0x6d, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x69, 0x64, 0x4f, 0x70,
-	0x65, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x61, 0x5f, 0x69, 0x73, 0x76,
-	0x69, 0x70, 0x18, 0x14, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x61, 0x49, 0x73, 0x76, 0x69,
-	0x70, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x61, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x69, 0x73,
-	0x74, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x63, 0x61, 0x46, 0x69, 0x6c, 0x65,
-	0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x22, 0x57, 0x0a, 0x0b, 0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e,
-	0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75,
-	0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65,
-	0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18,
-	0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x22,
-	0x6d, 0x0a, 0x0c, 0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12,
-	0x19, 0x0a, 0x08, 0x65, 0x72, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x07, 0x65, 0x72, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x65, 0x72,
-	0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72,
-	0x4d, 0x73, 0x67, 0x12, 0x29, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28,
-	0x0b, 0x32, 0x15, 0x2e, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x2e,
-	0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x84,
-	0x02, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x68,
-	0x61, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x61, 0x73,
-	0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x49, 0x6e, 0x47, 0x75, 0x69, 0x64, 0x65,
-	0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x49, 0x6e, 0x47, 0x75, 0x69, 0x64,
-	0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x18, 0x03, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x73, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x12, 0x1a, 0x0a,
-	0x08, 0x69, 0x73, 0x4f, 0x6e, 0x54, 0x61, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
-	0x08, 0x69, 0x73, 0x4f, 0x6e, 0x54, 0x61, 0x69, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x73, 0x50,
-	0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b,
-	0x69, 0x73, 0x50, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6f,
-	0x74, 0x68, 0x65, 0x72, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
-	0x6f, 0x74, 0x68, 0x65, 0x72, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x52,
-	0x65, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x52, 0x65, 0x61,
-	0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20,
-	0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x12, 0x16, 0x0a,
-	0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75,
-	0x73, 0x65, 0x72, 0x49, 0x64, 0x32, 0xa3, 0x01, 0x0a, 0x0b, 0x42, 0x78, 0x73, 0x75, 0x62, 0x73,
-	0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x4d, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x4c,
-	0x69, 0x73, 0x74, 0x12, 0x1e, 0x2e, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
-	0x65, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73,
-	0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
-	0x65, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x45, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x53, 0x6f,
-	0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63,
-	0x72, 0x69, 0x62, 0x65, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
-	0x1a, 0x19, 0x2e, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x2e, 0x53,
-	0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0f, 0x5a, 0x0d, 0x2e,
-	0x2f, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x62, 0x06, 0x70, 0x72,
-	0x6f, 0x74, 0x6f, 0x33,
+	0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09,
+	0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65,
+	0x70, 0x74, 0x49, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x70, 0x74,
+	0x49, 0x64, 0x22, 0x78, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x49,
+	0x6e, 0x66, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x72, 0x72, 0x5f,
+	0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x72, 0x72, 0x43,
+	0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x65, 0x72, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x2e, 0x0a, 0x04,
+	0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x78, 0x73,
+	0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
+	0x62, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x77, 0x0a, 0x0d,
+	0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a,
+	0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f,
+	0x75, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x68, 0x61, 0x73, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61,
+	0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x4e, 0x65, 0x78,
+	0x74, 0x50, 0x61, 0x67, 0x65, 0x12, 0x2e, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20,
+	0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
+	0x65, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52,
+	0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0xd4, 0x04, 0x0a, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72,
+	0x69, 0x62, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0f, 0x0a, 0x03, 0x5f, 0x69, 0x64, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c,
+	0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12,
+	0x0a, 0x04, 0x61, 0x72, 0x65, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72,
+	0x65, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x62, 0x75, 0x79, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73,
+	0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x75, 0x79, 0x65, 0x72, 0x43, 0x6c, 0x61,
+	0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08,
+	0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
+	0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x75, 0x62, 0x6c,
+	0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x70,
+	0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x61,
+	0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x61,
+	0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x61, 0x5f, 0x64, 0x61, 0x74, 0x65,
+	0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x61, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1d,
+	0x0a, 0x0a, 0x63, 0x61, 0x5f, 0x69, 0x73, 0x76, 0x69, 0x73, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x09, 0x63, 0x61, 0x49, 0x73, 0x76, 0x69, 0x73, 0x69, 0x74, 0x12, 0x17, 0x0a,
+	0x07, 0x63, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
+	0x63, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x4b,
+	0x65, 0x79, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68,
+	0x4b, 0x65, 0x79, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x64, 0x67, 0x65, 0x74, 0x18, 0x0d,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x64, 0x67, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09,
+	0x62, 0x69, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x09, 0x62, 0x69, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f,
+	0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a,
+	0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x75,
+	0x79, 0x65, 0x72, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x79, 0x65, 0x72,
+	0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18,
+	0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61,
+	0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x77, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x18, 0x12, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x06, 0x77, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69,
+	0x64, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x0b, 0x62, 0x69, 0x64, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08,
+	0x63, 0x61, 0x5f, 0x69, 0x73, 0x76, 0x69, 0x70, 0x18, 0x14, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07,
+	0x63, 0x61, 0x49, 0x73, 0x76, 0x69, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x61, 0x5f, 0x66, 0x69,
+	0x6c, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c,
+	0x63, 0x61, 0x46, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x22, 0x57, 0x0a, 0x0b,
+	0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61,
+	0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49,
+	0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65,
+	0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65,
+	0x72, 0x54, 0x79, 0x70, 0x65, 0x22, 0x6d, 0x0a, 0x0c, 0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66,
+	0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x72, 0x72, 0x5f, 0x63, 0x6f, 0x64,
+	0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x72, 0x72, 0x43, 0x6f, 0x64, 0x65,
+	0x12, 0x17, 0x0a, 0x07, 0x65, 0x72, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x29, 0x0a, 0x04, 0x64, 0x61, 0x74,
+	0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73,
+	0x63, 0x72, 0x69, 0x62, 0x65, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04,
+	0x64, 0x61, 0x74, 0x61, 0x22, 0x84, 0x02, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66,
+	0x6f, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
+	0x08, 0x52, 0x06, 0x68, 0x61, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x49,
+	0x6e, 0x47, 0x75, 0x69, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73,
+	0x49, 0x6e, 0x47, 0x75, 0x69, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x45, 0x78, 0x70,
+	0x69, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x73, 0x45, 0x78, 0x70,
+	0x69, 0x72, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x4f, 0x6e, 0x54, 0x61, 0x69, 0x6c, 0x18,
+	0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x73, 0x4f, 0x6e, 0x54, 0x61, 0x69, 0x6c, 0x12,
+	0x20, 0x0a, 0x0b, 0x69, 0x73, 0x50, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05,
+	0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x50, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e,
+	0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x06,
+	0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x46, 0x6c, 0x61, 0x67, 0x12,
+	0x16, 0x0a, 0x06, 0x69, 0x73, 0x52, 0x65, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52,
+	0x06, 0x69, 0x73, 0x52, 0x65, 0x61, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x64, 0x75, 0x73,
+	0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x75, 0x73,
+	0x74, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x09, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x32, 0xa3, 0x01, 0x0a, 0x0b,
+	0x42, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x4d, 0x0a, 0x0a, 0x47,
+	0x65, 0x74, 0x53, 0x75, 0x62, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x2e, 0x62, 0x78, 0x73, 0x75,
+	0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
+	0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x62, 0x78, 0x73, 0x75,
+	0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
+	0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x45, 0x0a, 0x0e, 0x47, 0x65,
+	0x74, 0x53, 0x75, 0x62, 0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x62,
+	0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x49,
+	0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63,
+	0x72, 0x69, 0x62, 0x65, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73,
+	0x70, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x62, 0x78, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
+	0x62, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (

+ 463 - 33
jyBXSubscribe/rpc/util/push.go

@@ -14,6 +14,7 @@ import (
 	"go.mongodb.org/mongo-driver/bson/primitive"
 	IC "jyBXSubscribe/rpc/init"
 	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"log"
 	"strconv"
 	"strings"
 	"time"
@@ -22,7 +23,6 @@ import (
 //
 const (
 	pageSize            = 50
-	pageSizes           = 10
 	AllSubPushCacheSize = 250
 	query               = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","area", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type", "buyerclass","bidamount","budget","projectname","buyer","bidopentime","s_winner","filetext"],"from":0,"size":%d}`
 	mongodb_fields      = `{"_id":1,"area":1,"publishtime":1,"s_subscopeclass":1,"subtype":1,"title":1,"toptype":1,"type":1, "buyerclass":1,"budget":1,"bidamount":1,"s_winner":1,"bidopentime":1,"buyer":1,"projectname":1}`
@@ -80,9 +80,11 @@ type SubPushQueryParam struct {
 	Subscopeclass string             //信息行业
 	Key           string             //订阅词
 	Export        bool               //导出
-	EntId         int                //企业id
+	EntId         string             //企业id
 	Price         string             //价格
 	FileExists    string             //是否有附件;默认全部;1:有附件;-1:无附件
+	EntUserId     string             //商机管理用户id
+	DeptId        string             //商机管理用户部门id
 }
 
 func (spqp *SubPushQueryParam) IsEmpty() bool {
@@ -205,36 +207,24 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, total
 		}
 	}
 	starttime, endtime := int64(0), int64(0)
-	st, et := "", ""
-	now := time.Now()
 	logx.Info(4444)
-	if spqp.SelectTime == "today" { //今天
-		starttime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
-	} else if spqp.SelectTime == "yesterday" { //昨天
-		starttime = time.Date(now.Year(), now.Month(), now.Day()-1, 0, 0, 0, 0, time.Local).Unix()
-		endtime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
-	} else if spqp.SelectTime == "lately-7" { //最近7天
-		starttime = time.Date(now.Year(), now.Month(), now.Day()-7, 0, 0, 0, 0, time.Local).Unix()
-	} else if spqp.SelectTime == "lately-30" { //最近30天
-		starttime = time.Date(now.Year(), now.Month(), now.Day()-30, 0, 0, 0, 0, time.Local).Unix()
-	} else if spqp.SelectTime == "lastyear" { //去年
-		starttime = time.Date(now.Year()-1, 1, 1, 0, 0, 0, 0, time.Local).Unix()
-		endtime = time.Date(now.Year()-1, 12, 31, 23, 59, 59, 0, time.Local).Unix()
-	} else if len(strings.Split(spqp.SelectTime, "_")) == 2 {
-		st = strings.Split(spqp.SelectTime, "_")[0]
-		starttime, _ = strconv.ParseInt(st, 0, 64)
-		et = strings.Split(spqp.SelectTime, "_")[1]
-		endtime, _ = strconv.ParseInt(et, 0, 64)
-		if endtime > 0 {
-			etTime := time.Unix(endtime, 0)
-			endtime = time.Date(etTime.Year(), etTime.Month(), etTime.Day(), 23, 59, 59, 0, time.Local).Unix()
+	if len(strings.Split(spqp.SelectTime, "_")) == 2 {
+		st := strings.Split(spqp.SelectTime, "_")[0]
+		et := strings.Split(spqp.SelectTime, "_")[1]
+		if st != "" && et != "" {
+			starttime, _ = strconv.ParseInt(st, 0, 64)
+			endtime, _ = strconv.ParseInt(et, 0, 64)
+			if endtime > 0 {
+				etTime := time.Unix(endtime, 0)
+				endtime = time.Date(etTime.Year(), etTime.Month(), etTime.Day(), 23, 59, 59, 0, time.Local).Unix()
+			}
 		}
 	}
 	logx.Info(2222)
 	nowFormat := date.NowFormat(date.Date_Short_Layout)
 	start := (spqp.PageNum - 1) * spqp.PageSize
 	end := start + spqp.PageSize
-	//时间是今天,没有别的过滤条件
+	//时间是今天,没有别的过滤条件--首先读取当前推送缓存数据 其次查询数据库
 	if nowFormat == date.FormatDateByInt64(&starttime, date.Date_Short_Layout) && spqp.Area == "" && spqp.City == "" && spqp.Buyerclass == "" && spqp.Subscopeclass == "" && spqp.Subtype == "" && spqp.Key == "" && spqp.Price == "" && spqp.FileExists == "" {
 		logx.Info("a1:", s.todayKey(spqp.UserId))
 		subPush, err := s.GetTodayCache(spqp.UserId)
@@ -297,7 +287,7 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, total
 
 //
 func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
-	querys := []string{fmt.Sprintf("userid='%s'", spqp.UserId)}
+	querys := []string{fmt.Sprintf("userid='%s'", common.If(s.ModuleFlag == "eType", spqp.EntUserId, spqp.UserId))}
 	//时间
 	if starttime > 0 && endtime > 0 {
 		querys = append(querys, fmt.Sprintf("date>=%d and date<=%d", starttime, endtime))
@@ -425,13 +415,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 	count = spqp.PushMysql.CountBySql(fmt.Sprintf("select count(id)" + searchSql))
 	logx.Info("count:", count, "---", s.ModuleFlag)
 	findSql := "select id,date,infoid,isvisit,matchkeys,type"
-	if s.ModuleFlag != MemberFlag {
-		if s.ModuleFlag == EntnicheFlag {
-
-		} else {
-			findSql += ",isvip"
-		}
-
+	if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
+		findSql += ",isvip"
 	}
 
 	findSql += searchSql
@@ -723,3 +708,448 @@ func GetKeySet(t string, u *map[string]interface{}, data []string) (bool, []stri
 	}
 	return false, industry_
 }
+
+const (
+	INDEX      = "bidding"
+	TYPE       = "bidding"
+	bidField   = `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount","filetext","spidercode","site"`
+	bidTime    = `{"range":{"publishtime":{"gt":%d}}}`
+	bidSort    = `{"publishtime":"desc"}`
+	findfields = `"title"`
+)
+
+//首次访问推送页面 默认生成推送数据
+//默认匹配es 7天内数据
+func (s *subscribePush) DefaultDatas(spqp *SubPushQueryParam) (hasNextPage bool, total int64, result []*bxsubscribe.SubscribeInfo) {
+	if spqp.UserId == "" {
+		return false, 0, nil
+	}
+	t1 := time.Now()
+	log.Println("userId:", spqp.UserId)
+	//用户信息
+	scd := s.getUserInfo(spqp)
+	if len(scd.Keyword) > 0 {
+		logx.Info(time.Since(t1), "--scd:", scd)
+		//获取查询语句
+		qstr := s.getDefaultDatasSQL(scd)
+		list := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSort, bidField, 0, scd.Size, 0, false)
+		logx.Info(time.Since(t1), "count:", len(*list))
+		if list != nil && len(*list) > 0 {
+			now := time.Now()
+			for _, v := range *list {
+				redisKey := fmt.Sprintf("pushinfo_%s_%s", spqp.UserId, common.ObjToString(v["_id"]))
+				if isExists, _ := redis.Exists("pushcache_2_a", redisKey); isExists {
+					continue
+				}
+				title := strings.Replace(common.ObjToString(v["title"]), "\n", "", -1)
+				var myInsert = make(map[string]interface{})
+				myInsert["userid"] = spqp.UserId
+				myInsert["infoid"] = common.ObjToString(v["_id"])
+				myInsert["date"] = now.Unix()
+				matchkeys := getKeys(title, scd.Keyword)
+				myInsert["matchkeys"] = strings.Join(matchkeys, " ")
+				if v["area"] != nil {
+					myInsert["area"] = common.If(common.ObjToString(v["area"]) == "A", 0, common.If(IC.PushMapping.Area[common.ObjToString(v["area"])] > 0, IC.PushMapping.Area[common.ObjToString(v["area"])], 0).(int)).(int)
+				}
+				if v["city"] != nil {
+					myInsert["city"] = common.If(IC.PushMapping.City[common.ObjToString(v["city"])] > 0, IC.PushMapping.City[common.ObjToString(v["city"])], 0).(int)
+				}
+				if v["subtype"] != nil {
+					myInsert["subtype"] = common.If(IC.PushMapping.Subtype[common.ObjToString(v["subtype"])] > 0, IC.PushMapping.Subtype[common.ObjToString(v["subtype"])], 0).(int)
+				}
+				if v["toptype"] != nil {
+					myInsert["toptype"] = common.If(IC.PushMapping.Toptype[common.ObjToString(v["toptype"])] > 0, IC.PushMapping.Toptype[common.ObjToString(v["toptype"])], 0).(int)
+				}
+				if v["buyerclass"] != nil {
+					myInsert["buyerclass"] = common.If(IC.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])] > 0, IC.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])], 0).(int)
+				}
+				if v["filetext"] != nil {
+					myInsert["attachment_count"] = common.If(v["filetext"] != nil, 1, 0).(int) //附件 :检索库 只有附件字段,无法识别附件数量 暂定为1;为识别有附件
+				}
+				if v["bidamount"] != nil {
+					myInsert["bidamount"] = common.Int64All(v["bidamount"])
+				}
+				if v["budget"] != nil {
+					myInsert["budget"] = common.Int64All(v["budget"])
+				}
+				if s_subscopeclass := common.ObjToString(v["s_subscopeclass"]); s_subscopeclass != "" {
+					subscopeclass := []string{}
+					for _, v := range strings.Split(s_subscopeclass, ",") {
+						if subscopeclass_mapping, ok := IC.PushMapping.Subscopeclass[v]; ok {
+							subscopeclass = append(subscopeclass, fmt.Sprint(subscopeclass_mapping))
+						}
+					}
+					if len(subscopeclass) > 0 {
+						myInsert["subscopeclass"] = strings.Join(subscopeclass, ",")
+					}
+				}
+				//商机管理用户
+				if s.ModuleFlag == "eType" {
+					myInsert["userid"] = spqp.EntUserId
+					myInsert["entid"] = spqp.EntId
+					myInsert["deptid"] = spqp.DeptId
+				}
+				//保存推送表
+				id := spqp.PushMysql.Insert(aboutDbMsg[s.ModuleFlag].MysqlTable, myInsert)
+				if id > 0 {
+					redis.Put("pushcache_2_a", redisKey, 1, 86400)
+				} else {
+					continue
+				}
+				result = append(result, s.InfoFormat(&PushCa{
+					InfoId:     common.ObjToString(v["_id"]),
+					Date:       now.Unix(),
+					Index:      id,
+					Keys:       matchkeys,
+					FileExists: v["filetext"] != nil,
+				}, &v))
+			}
+		}
+	}
+	logx.Info("请求耗时:", time.Since(t1))
+	hasNextPage = len(result) > pageSize
+	total = int64(len(result))
+	return
+}
+
+//获取匹配得关键词
+func getKeys(title string, keywords []ViewKeyWord) (str []string) {
+	if len(keywords) > 0 {
+	L:
+		for _, v := range keywords {
+			for _, vk := range v.Keyword {
+				if strings.Contains(title, vk) {
+					str = append(str, v.Keyword...)
+					break L
+				}
+			}
+			for _, va := range v.Appended {
+				if strings.Contains(title, va) {
+					str = append(str, v.Appended...)
+					break L
+				}
+			}
+		}
+	}
+	return
+}
+
+//获取查询语句
+func (s *subscribePush) getDefaultDatasSQL(scd *ViewCondition) (str string) {
+	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
+	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
+	multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
+	query_bool_must_and := `{"bool":{"must":[%s]%s}}`
+
+	bools := []string{}
+	musts := []string{}
+	//发布时间最新三个月
+	musts = append(musts, fmt.Sprintf(bidTime, time.Now().AddDate(0, -3, 0).Unix()))
+	//省份
+	areaCity := []string{}
+	if len(scd.Area) > 0 {
+		areaquery := `{"terms":{"area":[`
+		for k, v := range scd.Area {
+			if k > 0 {
+				areaquery += `,`
+			}
+			areaquery += `"` + v + `"`
+		}
+		areaquery += `]}}`
+		areaCity = append(areaCity, areaquery)
+	}
+
+	//城市
+	if len(scd.City) > 0 {
+		areaquery := `{"terms":{"city":[`
+		for k, v := range scd.City {
+			if k > 0 {
+				areaquery += `,`
+			}
+			areaquery += `"` + v + `"`
+		}
+		areaquery += `]}}`
+		areaCity = append(areaCity, areaquery)
+	}
+	if len(areaCity) > 0 {
+		musts = append(musts, fmt.Sprintf(query_bool_should, strings.Join(areaCity, ",")))
+	}
+	if len(scd.Subtype) > 0 {
+		subquery := `{"terms":{"subtype":[`
+		for k, v := range scd.Subtype {
+			if k > 0 {
+				subquery += `,`
+			}
+			subquery += `"` + v + `"`
+		}
+		subquery += `]}}`
+		musts = append(musts, subquery)
+	}
+	if len(scd.Buyerclass) > 0 {
+		Buyerclass := `{"terms":{"buyerclass":[`
+		for k, v := range scd.Buyerclass {
+			if k > 0 {
+				Buyerclass += `,`
+			}
+			Buyerclass += `"` + v + `"`
+		}
+		Buyerclass += `]}}`
+		musts = append(musts, Buyerclass)
+	}
+	boolsNum := 0 //should
+	if len(scd.Keyword) > 0 {
+		boolsNum = 1
+		if scd.SelectType == "" || scd.SelectType == "2" {
+			scd.SelectType = "detail\", \"title"
+		} else {
+			scd.SelectType = "title"
+		}
+		multi_match = fmt.Sprintf(multi_match, "%s", "\""+scd.SelectType+"\"")
+
+		for _, v := range scd.Keyword {
+			shoulds := []string{}
+			must_not := []string{}
+			//附加词
+			for _, vv := range v.Keyword {
+				vv = strings.TrimSpace(vv)
+				if vv == "" {
+					continue
+				}
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
+
+			for _, vv := range v.Appended {
+				vv = strings.TrimSpace(vv)
+				if vv == "" {
+					continue
+				}
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
+
+			//排除词
+			for _, vv := range v.Exclude {
+				vv = strings.TrimSpace(vv)
+				if vv == "" {
+					continue
+				}
+				must_not = append(must_not, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
+
+			//添加
+			if len(shoulds) > 0 {
+				notStr := ""
+				if len(must_not) > 0 {
+					notStr = fmt.Sprintf(`,"must_not":[%s]`, strings.Join(must_not, ","))
+				}
+				bools = append(bools, fmt.Sprintf(query_bool_must_and, strings.Join(shoulds, ","), notStr))
+			}
+		}
+	}
+
+	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
+	logx.Info("----", qstr)
+	return qstr
+}
+
+/*已选条件--关键词*/
+type ViewKeyWord struct {
+	Keyword  []string `json:"key"`       //关键词
+	Appended []string `json:"appendkey"` //附加词
+	Exclude  []string `json:"notkey"`    //排除词
+	MatchWay int      `json:"matchway"`  //匹配模式
+}
+
+/*已选条件*/
+type ViewCondition struct {
+	Area       []string      //地区-省份
+	City       []string      //地区-城市
+	Buyerclass []string      //采购行业
+	Keyword    []ViewKeyWord //关键词
+	SelectType string        //筛选(正文 or 标题)
+	Subtype    []string      //信息类型
+	Size       int           //数量
+}
+
+//获取用户信息
+func (s *subscribePush) getUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition) {
+	//优先级 由测试确认  大会员 》 商机管理 》 VIP 》 普通用户
+	userMap, ok := IC.Mgo.FindById("user", spqp.UserId, `{"o_jy":1,"o_vipjy":1,"i_vip_status":1,"o_member_jy":1,"i_member_status":1,"s_m_phone":1,"s_phone":1}`)
+	if !ok || userMap == nil || len(*userMap) == 0 {
+		return &ViewCondition{}
+	}
+	var isPayBool = true
+	var tmpInfo = struct {
+		Items      []interface{}
+		BuyerClass []interface{}
+		SubType    []interface{}
+		Area       map[string]interface{}
+		SelectType string
+	}{}
+	//大会员
+	if common.IntAll((*userMap)["i_member_status"]) > 0 && s.ModuleFlag == "mType" {
+		o_member_jy, _ := (*userMap)["o_member_jy"].(map[string]interface{})
+		tmpInfo.Items, _ = o_member_jy["a_items"].([]interface{})
+		tmpInfo.BuyerClass, _ = o_member_jy["a_buyerclass"].([]interface{})
+		tmpInfo.SubType, _ = o_member_jy["a_infotype"].([]interface{})
+		tmpInfo.Area, _ = o_member_jy["o_area"].(map[string]interface{})
+	} else if phone := common.If((*userMap)["s_phone"] != nil, common.ObjToString((*userMap)["s_phone"]), common.ObjToString((*userMap)["s_m_phone"])).(string); phone != "" && spqp.EntUserId != "" && s.ModuleFlag == "eType" {
+		//新商机管理用户
+		if count := IC.MainMysql.CountBySql(`SELECT count(1) FROM entniche_user u LEFT JOIN entniche_info i ON u.ent_id=i.id WHERE u.phone=? and u.power=1 and i.status=1 and i.isNew=1`, phone); count > 0 {
+			//查询商机管理用户的订阅信息
+			entId, _ := strconv.Atoi(spqp.EntId)
+			entMap, ok := IC.Mgo.FindOneByField("entniche_rule", map[string]interface{}{
+				"i_entid":  entId,
+				"s_userid": spqp.UserId,
+			}, `{"o_entniche":1}`)
+			if ok && entMap != nil && len(*entMap) > 0 {
+				o_entniche, _ := (*entMap)["o_entniche"].(map[string]interface{})
+				tmpInfo.Items, _ = o_entniche["a_items"].([]interface{})
+				tmpInfo.BuyerClass, _ = o_entniche["a_buyerclass"].([]interface{})
+				tmpInfo.SubType, _ = o_entniche["a_infotype"].([]interface{})
+				tmpInfo.Area, _ = o_entniche["o_area"].(map[string]interface{})
+			}
+		}
+	} else if common.IntAll((*userMap)["i_vip_status"]) > 0 && s.ModuleFlag == "vType" {
+		o_vipjy, _ := (*userMap)["o_vipjy"].(map[string]interface{})
+		tmpInfo.Items, _ = o_vipjy["a_items"].([]interface{})
+		tmpInfo.BuyerClass, _ = o_vipjy["a_buyerclass"].([]interface{})
+		tmpInfo.SubType, _ = o_vipjy["a_infotype"].([]interface{})
+		tmpInfo.Area, _ = o_vipjy["o_area"].(map[string]interface{})
+	} else {
+		isPayBool = false
+		o_jy, _ := (*userMap)["o_jy"].(map[string]interface{})
+		if o_jy["a_key"] != nil {
+			tmpInfo.Items, _ = o_jy["a_key"].([]interface{})
+			//信息类型
+			tmpInfo.SubType, _ = o_jy["a_infotype"].([]interface{})
+			//省份
+			tmpInfo.Area, _ = o_jy["o_area"].(map[string]interface{})
+			if common.IntAllDef(o_jy["i_ppstatus"], 0) == 1 && o_jy["o_area_p"] != nil {
+				tmpInfo.Area, _ = o_jy["o_area_p"].(map[string]interface{})
+			}
+		}
+	}
+	vc = &ViewCondition{
+		Buyerclass: common.ObjArrToStringArr(tmpInfo.BuyerClass),
+		Subtype:    common.ObjArrToStringArr(tmpInfo.SubType),
+		Area:       getStringArrFromDbResult(tmpInfo.Area, 1),
+		City:       getStringArrFromDbResult(tmpInfo.Area, 2),
+		SelectType: "1",
+	}
+	//付费用户
+	if isPayBool {
+		vc.Size = IC.C.DefaulCount.Pay
+		vc.Keyword = getKeyWordArrFromDbResult(tmpInfo.Items, "", -1)
+	} else {
+		vc.Size = IC.C.DefaulCount.Free
+		vc.Keyword = getKeyWordArrFromDbResultByFree(tmpInfo.Items, "", -1)
+	}
+	return
+}
+
+//关键词 附加词 排除词
+func getKeyWordArrFromDbResult(a_items []interface{}, item string, index int) (arr []ViewKeyWord) {
+	if a_items == nil {
+		return
+	}
+	for _, v := range a_items {
+		vm, _ := v.(map[string]interface{})
+		if item != "" && index >= 0 && item != common.ObjToString(vm["s_item"]) {
+			continue
+		}
+		kwsArr := vm["a_key"]
+		for i, k := range kwsArr.([]interface{}) {
+			if item != "" && index >= 0 && i != index {
+				continue
+			}
+			kw := ViewKeyWord{}
+			b, e := json.Marshal(k)
+			if e != nil {
+				log.Println(e.Error())
+			}
+			json.Unmarshal(b, &kw)
+			if kw.MatchWay == 1 {
+				for _, kk := range kw.Keyword {
+					arr = append(arr, ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+				for _, kk := range kw.Appended {
+					arr = append(arr, ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+			} else {
+				arr = append(arr, kw)
+			}
+		}
+	}
+	return
+}
+
+// //关键词 附加词 排除词  省份订阅包 - 普通用户
+func getKeyWordArrFromDbResultByFree(a_items []interface{}, item string, index int) (arr []ViewKeyWord) {
+	if a_items == nil {
+		return
+	}
+	for _, v := range a_items {
+		vmr, _ := v.([]interface{})
+		vm, _ := vmr[0].(map[string]interface{})
+		if item != "" && index >= 0 && item != common.ObjToString(vm["s_item"]) {
+			continue
+		}
+		kwsArr := vmr
+		for i, k := range kwsArr {
+			if item != "" && index >= 0 && i != index {
+				continue
+			}
+			kw := ViewKeyWord{}
+			b, e := json.Marshal(k)
+			if e != nil {
+				log.Println(e.Error())
+			}
+			json.Unmarshal(b, &kw)
+			if kw.MatchWay == 1 {
+				for _, kk := range kw.Keyword {
+					arr = append(arr, ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+				for _, kk := range kw.Appended {
+					arr = append(arr, ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+			} else {
+				arr = append(arr, kw)
+			}
+		}
+	}
+	return
+}
+
+//地区格式化
+func getStringArrFromDbResult(area map[string]interface{}, i int) (arr []string) {
+	if area == nil {
+		return
+	}
+	var eareArr []string
+	var cityArr []string
+	for k, v := range area {
+		if len(v.([]interface{})) > 0 {
+			cityArr = append(cityArr, common.ObjArrToStringArr(v.([]interface{}))...)
+		} else {
+			eareArr = append(eareArr, k)
+		}
+	}
+	if i == 1 {
+		arr = eareArr
+	} else {
+		arr = cityArr
+	}
+	return
+}