syntax = "proto3";
import "google/protobuf/struct.proto";
package bxsubscribe;
option go_package = "./bxsubscribe";

message SubscribeInfosReq {
  int64 pageNum = 1;
  int64  pageSize = 2;
  string  selectTime = 3;
  string  area = 4;
  string  city = 5;
  string  industry = 6;
  string  buyerClass = 7;
  string  keyWords = 8;
  string  subtype = 9;
  string  userType = 10;//fType：普通用户；vType：超级订阅用户；mType：大会员用户；eType：商机管理用户；
  string  userId = 11;
  string  entId = 12;
  string  appId = 13;
  string  price = 14;
  string  fileExists = 15;
  string  isRead = 16; //是否已读
  string  staffs = 17;//分发人员
  string  source = 18; //信息来源
  string  entUserId = 19;
  string  deptId = 20;
  int64 newUserId = 21;
  bool IsEnt = 22;
  string SelectIds = 23;
  int64 positionType = 24;
  string accountId = 25; //账户id
  string positionId = 26;  //职位id
  string mgoUserId = 27;  //原userId
  int64 notReturnCount = 28;
  string item = 29;
}

message SubscribeInfosResp {
  int64 err_code = 1;
  string err_msg = 2;
  subscribeData data = 3;
}

message subscribeData{
  int64 count = 1;
  bool hasNextPage = 2;
  repeated subscribeInfo list = 3;
}

message subscribeInfo {
  string  _id = 1;//和推送程序 缓存保持一致
  string  title = 2;
  string  area = 3;
  string buyerClass = 4;
  string subtype = 5;
  string  industry = 6;
  int64  publishTime = 7;
  int64 ca_index = 8;
  int64 ca_date = 9;
  int64 ca_isvisit = 10;
  int64  ca_type = 11;
  repeated string  matchKeys = 12;
  double budget = 13;// 预算
  double bidAmount = 14;
  int64 collection = 15;
  string  buyer = 16;
  string  projectName = 17;
  string winner = 18;
  int64  bidOpenTime = 19;
  int64  ca_isvip = 20;
  bool   ca_fileExists = 21;
  int64  source = 22;//来源；1：个人订阅 2：企业自动分发 3：企业手动分发
  string  site = 23; // 网站名称
  string buyerTel = 24; // 采购单位联系方式
  string buyerPerson = 25; // 采购单位联系人
  string agency = 26;//代理机构
  string agencyPerson = 27;//代理机构联系人
  string agencyTel = 28;//代理机构联系电话
  int64 signendTime = 29 ;// 报名截止日期
  int64 bidendTime = 30;// 投标截止日期
  repeated WinnerInfo winnerInfo = 31;// 中标企业信息
  string spiderCode = 33;//网站代码
  string city =34; //城市
  string toptype =35; //一级信息类型
  bool isValidFile =36; //是否有附件
  string sourceAll = 37; //来源；1：个人订阅 2：企业自动分发 3：企业手动分发 多个
}
//
message WinnerInfo{
  string winner = 1;
  string winnerTel = 2;
  string winnerPerson = 3;
  string winnerId = 4;
}
//
message SomeInfoReq{
  string  appId = 1;
  string  userId = 2;
  string  userType = 3;
  string  newUserId = 4;
  string  entId = 5;
  string  accountId = 6;
  string  positionType = 7;
  string  positionId = 8;
}

message SomeInfoResp {
  int64 err_code = 1;
  string err_msg = 2;
  SomeInfo data = 3;
}
message SomeInfo{
  bool hasKey = 1;//免费用户和超级订阅是否有订阅词
  bool isInTSguide = 2;//是否进入向导
  int64 isExpire = 3;//超级订阅到期提醒
  int64 isOnTail = 4;//超级订阅试用状态
  bool isPassCount = 5;//推送数量校验
  bool otherFlag = 6;//首次用户推送查询“其他”
  bool isRead = 7;//某个通知??是否已读
  repeated string  industry = 8;//会员订阅的行业
  string userId = 9;//用户id
}
//
message StatusResp{
  string error_msg = 1;
  int64 error_code = 2;
  int64 status = 3;
}
message ByPushHistoryResp{
  string error_msg = 1;
  int64 error_code = 2;
  string data = 3;
}


message UpdateSubScribeInfoReq{
  bytes subSet = 1;//订阅设置
  string userId = 2;//用户id
  int64  PositionType = 3;
}

//城市
message CityList {
  repeated string city = 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;
  repeated string appendKey = 5;
}
message KeyItems{
  string s_item = 1;//分类名称
  int64 updateTime = 2;
  repeated Key a_key = 3;
}

//关键词
message Key {
  repeated string key = 1;
  repeated string notkey = 2;
  int64 updateTime = 3;
  int64 matchway = 4;
  repeated string appendkey = 5;
}

message SetReadReq{
  string  appId = 1;
  string  userId = 2;
  string  userType = 3;
  int64   vsid = 4;
  string  EntId = 5;
  int64   newUserId = 6;
  string  entUserId = 7;
  bool    isEnt = 8;
  int64 positionType = 9;
}
message GetKeyReq{
  string  appId = 1;
  string  userId = 2;
  string  userType = 3;
  string  entId = 5;
  int64   newUserId = 6;
  string  entUserId = 7;
  bool    isEnt = 8;
  int64   vipPower = 4;
  int64   memberPower = 10;
  int64   powerSource = 11;
  int64   userPower = 12;
  string  deptId = 13;
  int64   positionType = 14;
}

message GetDistributorReq{
  string  appId = 1;
  string  entId = 2;
  string  entUserId = 3;
  string  region = 4;
  string  selectIds = 5;
  string  queryType = 6;
}

message MsgDistributorReq{
  string  appId = 1;
  string  entId = 2;
  string  entUserId = 3;
  string  messageId = 4;//分发信息
  string  staffs = 5; //分发的员工
}

message KeyResp {
  int64 err_code = 1;
  string err_msg = 2;
  repeated KeyItems items = 3;//关键词
}
message List{
  repeated string value = 1;
}
//订阅设置
message Subscribe{
  map<string, List> area = 1;//地区
  repeated string buyerclass = 2;//采购单位类型
  repeated string infotype = 3;//信息类型
  repeated Items items = 4;//关键词
  int64 matchway = 5;//匹配方式 1标题 2正文
  int64 projectmatch = 6;//项目匹配
  bool  keytip = 7;
}
message UserReq{
  string appId = 1;
  int64 entUserId = 2;
  string types = 3;//类型，不传按默认规则获取 m大会员 e商机管理 v超级订阅 f免费订阅
  int64 positionType = 4;//职位类型 0个人 1企业
  string userId = 5;
  int64 entId = 6;
}
//用户权益
message UserResq{
  Subscribe data = 1;
  string error_msg = 2;
  int64 error_code = 3;
}

message DistributorResp {
  int64 err_code = 1;
  string err_msg = 2;
  repeated userResp items = 3;//分发人员
}

message userResp {
  string name = 1;
  int64 id = 2;
  string phone = 3;
}

message GetViewStatusReq{
  string  appId = 1;
  string  entId = 2;
  string  entUserId = 3;
  string  infoId = 4;
}

message ViewStatusResp {
  int64 err_code = 1;
  string err_msg = 2;
  repeated UserStatus items = 3;//分发人员
}
message UserStatus {
  string name = 1;
  int64 id = 2;
  int64 isvisit = 3;
  string visittime = 4;
  string date = 5;
  string phone = 6;
  int64 source = 7;
}
message GetUserInfoReq{
  string  appId = 1;
  int64  entId = 2;
  int64  entUserId = 3;
  string  userId = 4;
  int64   positionType = 5;
  int64  baseUserId = 6;
  string serviceType = 7;
}
message GetUserInfoResq{
  GetUserInfo data = 1;
  string error_msg = 2;
  int64 error_code = 3;
}
message GetUserInfo{
  string mail = 1;
  int64  state = 2;
  string imgUrl = 3;
  string appUrl = 4;
  bool   showWx = 5;
}
message SetUserInfoReq{
  string  appId = 1;
  int64  entId = 2;
  int64  entUserId = 3;
  string  userId = 4;
  int64   positionType = 5;
  string  mail = 6;
}
message GetPushSetReq{
  string  appId = 1;
  int64  entId = 2;
  int64  entUserId = 3;
  string  userId = 4;
  int64   positionType = 5;
  int64   positionId = 6;
  int64   accountId = 7;
  int64   baseUserId = 8;
  string  mgoUserId = 9;  //原userId
}

message GetPushSetResp{
  map<string, PushSet> data = 1;
  map<int64, TimeJson> timeData = 3;
  string error_msg = 4;
  int64 error_code = 5;
}
message  TimeJson{
  repeated  string a_times = 1;
}
message PushSet{
  repeated  string a_times = 1;
  int64 i_wxpush = 2;
  int64 i_apppush = 3;
  int64 i_mailpush = 4;
  int64 i_ratemode = 5;
  int64 isWxShow = 6;
  int64 interested = 7;
  int64 isMailShow = 8;
  int64 i_nomsgtip=9;
}
message SetPushSetReq{
  string appId = 1;
  int64  entId = 2;
  int64  entUserId = 3;
  string  userId = 4;
  int64   positionType = 5;
  string  item = 6;
  string  setType = 7;
  int64  ratemode = 8;
  string  pushType = 9;
  repeated  string  times = 10;
  int64  pushValue = 11;
  int64 interested = 12;
}

message StaffSubscribeReq {
  string appId = 1;
  int64  entId = 2;
  int64  entUserId = 3;
  string query = 4;
  int64 eStatus = 6;
  int64 pStatus = 7;
  int64 pageNum = 8;
  int64 pageSize = 9;
}


message StaffSubscribeListResp {
  int64 err_code = 1;
  string err_msg = 2;
  int64 total = 3;
  repeated StaffSubscribe items = 4;
}
message StaffSubscribe {
  string token = 1;
  string name = 2;
  string phone = 3;
  int64 eStatus = 4;
  int64 pStatus = 5;
}

message StaffSubscribeDetailReq{
  int64  entId = 1;
  int64  entUserId = 2;
  string  token = 3;
}

message StaffSubscribeDetail{
  int64 err_code = 1;
  string err_msg = 2;
  bytes  data = 3;
}

message BidDistributorReq{
  string  appId = 1;
  string  entId = 2;
  string  entUserId = 3;
  repeated string  infoIds = 4;//分发信息
  string  staffs = 5; //分发的员工
}


service Bxsubscribe {
  //获取订阅推送列表
  rpc GetSubList(SubscribeInfosReq) returns(SubscribeInfosResp);
  //获取订阅推送相关信息
  rpc GetSubSomeInfo(SomeInfoReq) returns(SomeInfoResp);
  //修改订阅信息接口
  rpc UpdateSubScribeInfo(UpdateSubScribeInfoReq)returns(StatusResp);
  //推送页面筛选导出
  rpc ByPushHistory(SubscribeInfosReq)returns(ByPushHistoryResp);
  //推送数据浏览状态修改
  rpc SetRead(SetReadReq)returns(StatusResp);
  //关键词获取
  rpc GetKey(GetKeyReq)returns(KeyResp);
  //订阅设置获取
  rpc GetSubScribeInfo(UserReq)returns(UserResq);
  //信息分发
  rpc MsgDistributor(MsgDistributorReq)returns(StatusResp);
  //手动分发人员查询
  rpc GetDistributor(GetDistributorReq)returns(DistributorResp);
  //查看状态
  rpc GetViewStatus(GetViewStatusReq)returns(ViewStatusResp);
  //用户推送信息查看
  rpc userInfo(GetUserInfoReq)returns(GetUserInfoResq);
  //用户邮箱保存
  rpc setUser(SetUserInfoReq)returns(StatusResp);
  //用户推送设置查看
  rpc getPushSet(GetPushSetReq)returns(GetPushSetResp);
  //用户推送设置修改
  rpc setPushSet(SetPushSetReq)returns(StatusResp);
  //查看企业员工用户订阅
  rpc getStaffSubscribeList(StaffSubscribeReq)returns(StaffSubscribeListResp);
  //查看企业员工用户订阅详情
  rpc getStaffSubscribeDetail(StaffSubscribeDetailReq)returns(StaffSubscribeDetail);
  //标讯信息分发
  rpc bidDistributor(BidDistributorReq)returns(StatusResp);
}
