Эх сурвалжийг харах

Merge branch 'master' into feature/v1.1.14

lianbingjie 2 жил өмнө
parent
commit
b76e1c1479
52 өөрчлөгдсөн 1906 нэмэгдсэн , 1824 устгасан
  1. 5 0
      jyBXBase/api/bxbase.go
  2. 0 21
      jyBXBase/api/init/init.go
  3. 5 2
      jyBXBase/entity/db.go
  4. 11 6
      jyBXBase/go.mod
  5. 370 50
      jyBXBase/go.sum
  6. 4 1
      jyBXBase/rpc/bxbase.go
  7. 3 0
      jyBXBase/rpc/etc/db.yaml
  8. 3 2
      jyBXBase/rpc/init/db.go
  9. 0 18
      jyBXBase/rpc/init/init.go
  10. 111 110
      jyBXBase/rpc/internal/logic/newestbiddinglogic_test.go
  11. 8 7
      jyBXBase/rpc/model/newestBidding.go
  12. BIN
      jyBXBase/rpc/rpc.exe
  13. 8 7
      jyBXBase/rpc/util/common.go
  14. 5 0
      jyBXBuyer/api/bxbuyer.go
  15. 0 21
      jyBXBuyer/api/init/init.go
  16. 5 2
      jyBXBuyer/entity/db.go
  17. 14 6
      jyBXBuyer/go.mod
  18. 664 31
      jyBXBuyer/go.sum
  19. 4 0
      jyBXBuyer/rpc/bxbuyer.go
  20. 3 0
      jyBXBuyer/rpc/etc/db.yaml
  21. 4 3
      jyBXBuyer/rpc/init/db.go
  22. 0 20
      jyBXBuyer/rpc/init/init.go
  23. 7 36
      jyBXBuyer/rpc/model/buyerListBYEs.go
  24. 4 0
      jyBXCore/api/bxcore.go
  25. 0 21
      jyBXCore/api/init/init.go
  26. 5 2
      jyBXCore/entity/db.go
  27. 6 5
      jyBXCore/entity/rpc.go
  28. 76 65
      jyBXCore/go.mod
  29. 76 573
      jyBXCore/go.sum
  30. 4 2
      jyBXCore/rpc/bxcore.go
  31. 3 0
      jyBXCore/rpc/etc/db.yaml
  32. 4 3
      jyBXCore/rpc/init/db.go
  33. 1 17
      jyBXCore/rpc/init/init.go
  34. 6 5
      jyBXCore/rpc/model/es/es.go
  35. 10 10
      jyBXCore/rpc/model/es/search.go
  36. 6 66
      jyBXCore/rpc/util/search.go
  37. 7 6
      jyBXCore/rpc/util/userInfo.go
  38. 18 16
      jyBXSubscribe/api/bxsubscribe.go
  39. 0 15
      jyBXSubscribe/api/init/init.go
  40. 5 2
      jyBXSubscribe/entity/db.go
  41. 85 61
      jyBXSubscribe/go.mod
  42. 202 434
      jyBXSubscribe/go.sum
  43. 12 11
      jyBXSubscribe/rpc/bxsubscribe.go
  44. 9 6
      jyBXSubscribe/rpc/etc/db.yaml
  45. 6 3
      jyBXSubscribe/rpc/init/db.go
  46. 1 28
      jyBXSubscribe/rpc/init/init.go
  47. 0 3
      jyBXSubscribe/rpc/internal/logic/bypushhistorylogic.go
  48. 1 1
      jyBXSubscribe/rpc/internal/logic/getsubsomeinfologic.go
  49. 2 2
      jyBXSubscribe/rpc/internal/logic/getviewstatuslogic.go
  50. 5 7
      jyBXSubscribe/rpc/internal/logic/msgdistributorlogic.go
  51. 109 82
      jyBXSubscribe/rpc/model/push.go
  52. 9 35
      jyBXSubscribe/rpc/model/service/matchjob.go

+ 5 - 0
jyBXBase/api/bxbase.go

@@ -3,7 +3,9 @@ package main
 import (
 import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/endless"
 	"app.yhyue.com/moapp/jybase/endless"
+	logrusx "app.yhyue.com/moapp/jylogx/logx"
 	"fmt"
 	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
 	IC "jyBXBase/api/init"
 	IC "jyBXBase/api/init"
 	"log"
 	"log"
 	"net/http"
 	"net/http"
@@ -46,6 +48,9 @@ func main() {
 	})
 	})
 	handler.RegisterHandlers(server, ctx)
 	handler.RegisterHandlers(server, ctx)
 
 
+	//日志记录
+	logx.SetWriter(logrusx.NewLogrusWriter())
+
 	fmt.Printf("Starting server at %s:%d...\n", IC.C.Host, IC.C.Port)
 	fmt.Printf("Starting server at %s:%d...\n", IC.C.Host, IC.C.Port)
 	server.Start()
 	server.Start()
 
 

+ 0 - 21
jyBXBase/api/init/init.go

@@ -4,9 +4,7 @@ import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"flag"
 	"flag"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/conf"
-	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXBase/api/internal/config"
 	"jyBXBase/api/internal/config"
-	"jyBXBase/entity"
 	"log"
 	"log"
 	"regexp"
 	"regexp"
 )
 )
@@ -14,15 +12,9 @@ import (
 var configFile = flag.String("cf", "etc/bxbase-api.yaml", "the config file")
 var configFile = flag.String("cf", "etc/bxbase-api.yaml", "the config file")
 var C config.Config
 var C config.Config
 
 
-//
-var logFile = flag.String("lf", "etc/logs.yaml", "the config file")
-var logc entity.Logc
-
-//
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 var DB config.Db
 
 
-//
 var routesFile = flag.String("rf", "etc/routes.yaml", "the routes file")
 var routesFile = flag.String("rf", "etc/routes.yaml", "the routes file")
 var Routes config.Routes
 var Routes config.Routes
 var ExcludeUrl = []*regexp.Regexp{}
 var ExcludeUrl = []*regexp.Regexp{}
@@ -30,19 +22,6 @@ var ExcludeUrl = []*regexp.Regexp{}
 func init() {
 func init() {
 	conf.MustLoad(*configFile, &C)
 	conf.MustLoad(*configFile, &C)
 	log.Println("初始化配置") //
 	log.Println("初始化配置") //
-	//初始化日志信息
-	conf.MustLoad(*logFile, &logc)
-	if len(logc.Level) > 0 {
-		for _, v := range logc.Level {
-			logx.MustSetup(logx.LogConf{
-				Mode:     logc.Mode,
-				Path:     logc.Path,
-				Level:    v,
-				KeepDays: logc.KeepDays,
-			})
-			logx.Info(v, "--日志记录")
-		}
-	}
 	//读取数据库配置
 	//读取数据库配置
 	conf.MustLoad(*dbFile, &DB)
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
 	//初始mongodb

+ 5 - 2
jyBXBase/entity/db.go

@@ -45,8 +45,11 @@ type RedisStuct struct {
 
 
 //es
 //es
 type EsStruct struct {
 type EsStruct struct {
-	Addr string `json:"addr"`
-	Size int    `json:"size"`
+	Addr     string `json:"addr"`
+	Size     int    `json:"size"`
+	Version  string `json:"version"`
+	UserName string `json:"userName"`
+	Password string `json:"password"`
 }
 }
 
 
 const (
 const (

+ 11 - 6
jyBXBase/go.mod

@@ -3,16 +3,21 @@ module jyBXBase
 go 1.16
 go 1.16
 
 
 require (
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
-	app.yhyue.com/moapp/jypkg v0.0.0-20230228082019-eff6065f0416
 	github.com/go-sql-driver/mysql v1.7.0
 	github.com/go-sql-driver/mysql v1.7.0
-	github.com/zeromicro/go-zero v1.4.4
-	go.mongodb.org/mongo-driver v1.11.1
-	google.golang.org/grpc v1.53.0
-	google.golang.org/protobuf v1.28.1
+	github.com/zeromicro/go-zero v1.5.2
+	go.mongodb.org/mongo-driver v1.11.4
+	google.golang.org/grpc v1.54.0
+	google.golang.org/protobuf v1.30.0
 )
 )
 
 
 require (
 require (
+	app.yhyue.com/moapp/jybase v0.0.0-20230420060106-a9c3f4187463
+	app.yhyue.com/moapp/jylogx v0.0.0-20230511070629-0ed867dc49d6
+	app.yhyue.com/moapp/jypkg v0.0.0-20230420060744-ff53e7ca6f47
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	github.com/randolphcyg/gozeropprof v1.0.2
 	github.com/randolphcyg/gozeropprof v1.0.2
+	go.opentelemetry.io/otel/exporters/jaeger v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.15.1 // indirect
 )
 )

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 370 - 50
jyBXBase/go.sum


+ 4 - 1
jyBXBase/rpc/bxbase.go

@@ -1,7 +1,9 @@
 package main
 package main
 
 
 import (
 import (
+	logrusx "app.yhyue.com/moapp/jylogx/logx"
 	"fmt"
 	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
 	"log"
 	"log"
 
 
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
@@ -37,7 +39,8 @@ func main() {
 		}
 		}
 	})
 	})
 	defer s.Stop()
 	defer s.Stop()
-
+	//日志记录
+	logx.SetWriter(logrusx.NewLogrusWriter())
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	s.Start()
 	s.Start()
 }
 }

+ 3 - 0
jyBXBase/rpc/etc/db.yaml

@@ -19,6 +19,9 @@ redis:
 es:
 es:
     addr: http://192.168.3.206:9800
     addr: http://192.168.3.206:9800
     size: 30
     size: 30
+    version: v7
+    userName: ""
+    password: ""
 mongo:
 mongo:
     main:
     main:
         dbName: qfw
         dbName: qfw

+ 3 - 2
jyBXBase/rpc/init/db.go

@@ -7,7 +7,7 @@ import (
 	"jyBXBase/entity"
 	"jyBXBase/entity"
 	"strings"
 	"strings"
 
 
-	"app.yhyue.com/moapp/jybase/esv1"
+	. "app.yhyue.com/moapp/jybase/es"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jybase/redis"
@@ -17,6 +17,7 @@ import (
 var (
 var (
 	MainMysql        *mysql.Mysql
 	MainMysql        *mysql.Mysql
 	BaseServiceMysql *mysql.Mysql
 	BaseServiceMysql *mysql.Mysql
+	PushMysql        *mysql.Mysql
 	Mgo              mongodb.MongodbSim
 	Mgo              mongodb.MongodbSim
 	MgoEnt           mongodb.MongodbSim
 	MgoEnt           mongodb.MongodbSim
 	MgoBidding       mongodb.MongodbSim
 	MgoBidding       mongodb.MongodbSim
@@ -130,6 +131,6 @@ func EsInit(es *entity.EsStruct) {
 	//初始化 elasticsearch
 	//初始化 elasticsearch
 	if es.Addr != "" {
 	if es.Addr != "" {
 		logx.Info("--初始化 elasticsearch--")
 		logx.Info("--初始化 elasticsearch--")
-		elastic.InitElasticSize(es.Addr, es.Size)
+		NewEs(es.Version, es.Addr, es.Size, es.UserName, es.Password)
 	}
 	}
 }
 }

+ 0 - 18
jyBXBase/rpc/init/init.go

@@ -6,8 +6,6 @@ import (
 	"flag"
 	"flag"
 	_ "github.com/go-sql-driver/mysql"
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/conf"
-	"github.com/zeromicro/go-zero/core/logx"
-	"jyBXBase/entity"
 	"jyBXBase/rpc/internal/config"
 	"jyBXBase/rpc/internal/config"
 )
 )
 
 
@@ -15,30 +13,14 @@ var configFile = flag.String("cf", "etc/bxbase.yaml", "the config file")
 var C config.Config
 var C config.Config
 var err error
 var err error
 
 
-//
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 var DB config.Db
 
 
-//
 var logFile = flag.String("lf", "etc/logs.yaml", "the logs file")
 var logFile = flag.String("lf", "etc/logs.yaml", "the logs file")
-var logc entity.Logc
 var Middleground *middleground.Middleground
 var Middleground *middleground.Middleground
 var Compatible *compatible.Compatible
 var Compatible *compatible.Compatible
 
 
 func init() {
 func init() {
-	//初始化日志信息
-	conf.MustLoad(*logFile, &logc)
-	if len(logc.Level) > 0 {
-		for _, v := range logc.Level {
-			logx.MustSetup(logx.LogConf{
-				Mode:     logc.Mode,
-				Path:     logc.Path,
-				Level:    v,
-				KeepDays: logc.KeepDays,
-			})
-			logx.Info(v, "--日志记录")
-		}
-	}
 	//基本配置
 	//基本配置
 	conf.MustLoad(*configFile, &C)
 	conf.MustLoad(*configFile, &C)
 	//数据库配置
 	//数据库配置

+ 111 - 110
jyBXBase/rpc/internal/logic/newestbiddinglogic_test.go

@@ -1,124 +1,125 @@
 package logic
 package logic
 
 
 import (
 import (
-        elastic "app.yhyue.com/moapp/jybase/esv1"
-        "app.yhyue.com/moapp/jybase/mongodb"
-        "app.yhyue.com/moapp/jybase/mysql"
-        "app.yhyue.com/moapp/jybase/redis"
-        "context"
-        "github.com/zeromicro/go-zero/core/logx"
-        "jyBXBase/entity"
-        "jyBXBase/rpc/bxbase"
-        IC "jyBXBase/rpc/init"
-        "jyBXBase/rpc/internal/config"
-        "jyBXBase/rpc/internal/svc"
-        "reflect"
-        "strings"
-        "testing"
+	"context"
+	"jyBXBase/entity"
+	"jyBXBase/rpc/bxbase"
+	IC "jyBXBase/rpc/init"
+	"jyBXBase/rpc/internal/config"
+	"jyBXBase/rpc/internal/svc"
+	"reflect"
+	"strings"
+	"testing"
+
+	elastic "app.yhyue.com/moapp/jybase/es"
+	"app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/mysql"
+	"app.yhyue.com/moapp/jybase/redis"
+	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
 func init() {
 func init() {
 
 
-        logx.Info("--初始化 mongodb--")
-        IC.Mgo = mongodb.MongodbSim{
-	      MongodbAddr: "192.168.3.206:27080",
-	      Size:        5,
-	      DbName:      "qfw",
-        }
-        IC.Mgo.InitPool()
-        IC.DB = config.Db{Mongo: entity.Mongo{
-	      Bidding: &entity.MongoStruct{
-		    Collection:     "bidding",
-		    CollectionBack: "bidding_back",
-	      },
-        }}
-        IC.DB.Mongo.Bidding.Collection = "bidding_back"
-        //
-        logx.Info("--初始化 mongodb bidding--")
-        IC.MgoBidding = mongodb.MongodbSim{
-	      MongodbAddr: "192.168.3.206:27001",
-	      Size:        5,
-	      DbName:      "qfw_data",
-	      UserName:    "jyDevGroup",
-	      Password:    "jy@DevGroup",
-        }
-        IC.MgoBidding.InitPool()
+	logx.Info("--初始化 mongodb--")
+	IC.Mgo = mongodb.MongodbSim{
+		MongodbAddr: "192.168.3.206:27080",
+		Size:        5,
+		DbName:      "qfw",
+	}
+	IC.Mgo.InitPool()
+	IC.DB = config.Db{Mongo: entity.Mongo{
+		Bidding: &entity.MongoStruct{
+			Collection:     "bidding",
+			CollectionBack: "bidding_back",
+		},
+	}}
+	IC.DB.Mongo.Bidding.Collection = "bidding_back"
+	//
+	logx.Info("--初始化 mongodb bidding--")
+	IC.MgoBidding = mongodb.MongodbSim{
+		MongodbAddr: "192.168.3.206:27001",
+		Size:        5,
+		DbName:      "qfw_data",
+		UserName:    "jyDevGroup",
+		Password:    "jy@DevGroup",
+	}
+	IC.MgoBidding.InitPool()
 
 
-        logx.Info("--初始化 mysql--")
-        IC.MainMysql = &mysql.Mysql{
-	      Address:      "192.168.3.11:3366",
-	      UserName:     "root",
-	      PassWord:     "Topnet123",
-	      DBName:       "jianyu",
-	      MaxOpenConns: 5,
-	      MaxIdleConns: 5,
-        }
-        IC.MainMysql.Init()
+	logx.Info("--初始化 mysql--")
+	IC.MainMysql = &mysql.Mysql{
+		Address:      "192.168.3.11:3366",
+		UserName:     "root",
+		PassWord:     "Topnet123",
+		DBName:       "jianyu",
+		MaxOpenConns: 5,
+		MaxIdleConns: 5,
+	}
+	IC.MainMysql.Init()
 
 
-        //初始化 mysql-EntnichePush
-        logx.Info("--初始化 商机管理推送 mysql--")
-        IC.BaseServiceMysql = &mysql.Mysql{
-	      Address:      "192.168.3.217:4000",
-	      UserName:     "root",
-	      PassWord:     "=PDT49#80Z!RVv52_z",
-	      DBName:       "base_service",
-	      MaxOpenConns: 5,
-	      MaxIdleConns: 5,
-        }
-        IC.BaseServiceMysql.Init()
+	//初始化 mysql-EntnichePush
+	logx.Info("--初始化 商机管理推送 mysql--")
+	IC.BaseServiceMysql = &mysql.Mysql{
+		Address:      "192.168.3.217:4000",
+		UserName:     "root",
+		PassWord:     "=PDT49#80Z!RVv52_z",
+		DBName:       "base_service",
+		MaxOpenConns: 5,
+		MaxIdleConns: 5,
+	}
+	IC.BaseServiceMysql.Init()
 
 
-        logx.Info("--初始化 redis--")
-        redis.InitRedisBySize(strings.Join([]string{"other=192.168.3.206:1712", "push=192.168.3.206:1712", "pushcache_1=192.168.3.206:5000", "pushcache_2_a=192.168.3.206:5001", "pushcache_2_b=192.168.3.206:5002"}, ","), 100, 30, 300)
-        //初始化 elasticsearch
-        logx.Info("--初始化 elasticsearch--")
-        elastic.InitElasticSize("http://192.168.3.206:9800", 5)
+	logx.Info("--初始化 redis--")
+	redis.InitRedisBySize(strings.Join([]string{"other=192.168.3.206:1712", "push=192.168.3.206:1712", "pushcache_1=192.168.3.206:5000", "pushcache_2_a=192.168.3.206:5001", "pushcache_2_b=192.168.3.206:5002"}, ","), 100, 30, 300)
+	//初始化 elasticsearch
+	logx.Info("--初始化 elasticsearch--")
+	elastic.InitElasticSize("http://192.168.3.206:9800", 5)
 }
 }
 
 
 func TestNewestBiddingLogic_NewestBidding(t *testing.T) {
 func TestNewestBiddingLogic_NewestBidding(t *testing.T) {
-        type fields struct {
-	      ctx    context.Context
-	      svcCtx *svc.ServiceContext
-	      Logger logx.Logger
-        }
-        type args struct {
-	      in *bxbase.NewestBiddingReq
-        }
-        tests := []struct {
-	      name    string
-	      fields  fields
-	      args    args
-	      want    *bxbase.NewsetBiddingResp
-	      wantErr bool
-        }{
-	      // TODO: Add test cases.
-	      {name: "app首页数据",
-		    args: args{
-			  in: &bxbase.NewestBiddingReq{
-				City:      "",
-				IsSearch:  0,
-				UserId:    "5e8eb60ae138234b4f91aacf",
-				AppId:     "10000",
-				EntUserId: "4530",
-				NewUserId: 11111,
-				EntId:     "15232",
-			  },
-		    }},
-        }
-        for _, tt := range tests {
-	      t.Run(tt.name, func(t *testing.T) {
-		    l := &NewestBiddingLogic{
-			  ctx:    tt.fields.ctx,
-			  svcCtx: tt.fields.svcCtx,
-			  Logger: tt.fields.Logger,
-		    }
-		    got, err := l.NewestBidding(tt.args.in)
-		    if (err != nil) != tt.wantErr {
-			  t.Errorf("NewestBidding() error = %v, wantErr %v", err, tt.wantErr)
-			  return
-		    }
-		    if !reflect.DeepEqual(got, tt.want) {
-			  t.Errorf("NewestBidding() got = %v, want %v", got, tt.want)
-		    }
-	      })
-        }
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxbase.NewestBiddingReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxbase.NewsetBiddingResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+		{name: "app首页数据",
+			args: args{
+				in: &bxbase.NewestBiddingReq{
+					City:      "",
+					IsSearch:  0,
+					UserId:    "5e8eb60ae138234b4f91aacf",
+					AppId:     "10000",
+					EntUserId: "4530",
+					NewUserId: 11111,
+					EntId:     "15232",
+				},
+			}},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &NewestBiddingLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.NewestBidding(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("NewestBidding() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewestBidding() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
 }
 }

+ 8 - 7
jyBXBase/rpc/model/newestBidding.go

@@ -9,7 +9,7 @@ import (
 
 
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	ME "app.yhyue.com/moapp/jybase/encrypt"
 	ME "app.yhyue.com/moapp/jybase/encrypt"
-	elastic "app.yhyue.com/moapp/jybase/esv1"
+	elastic "app.yhyue.com/moapp/jybase/es"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
@@ -35,13 +35,14 @@ type NewestInfo struct {
 	UserId    string
 	UserId    string
 	MysqlDb   *mysql.Mysql
 	MysqlDb   *mysql.Mysql
 	NewUserId int64
 	NewUserId int64
+	PushMysql *mysql.Mysql
 }
 }
 
 
 var mysqlTables = map[string]string{
 var mysqlTables = map[string]string{
-	"f": "pushsubscribe",
-	"v": "pushsubscribe",
-	"m": "pushmember",
-	"e": "pushentniche",
+	"f": "push.pushsubscribe",
+	"v": "push.pushsubscribe",
+	"m": "push.pushmember",
+	"e": "push.pushentniche",
 }
 }
 
 
 func GetNewestInfo(userId, userType string, newUserId int64) *NewestInfo {
 func GetNewestInfo(userId, userType string, newUserId int64) *NewestInfo {
@@ -54,8 +55,8 @@ func GetNewestInfo(userId, userType string, newUserId int64) *NewestInfo {
 	return nt
 	return nt
 }
 }
 func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
 func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
-	findSQL := "select a.infoid,a.matchkeys,b.isvalidfile as attachment_count,b.budget,b.bidamount from %s a INNER JOIN %s b ON a.userid=%d and a.date>=%d and a.infoid=b.infoid order by a.id desc limit 50"
-	findSQL = fmt.Sprintf(findSQL, n.TableName, Pushbidding, n.NewUserId, time.Now().AddDate(0, 0, -7).Unix())
+	findSQL := "select a.infoid,a.matchkeys,a.attachment_count,a.budget,a.bidamount from %s  a  where a.userid=%d and a.date>=%d  order by a.id desc limit 50"
+	findSQL = fmt.Sprintf(findSQL, n.TableName, n.NewUserId, time.Now().AddDate(0, 0, -7).Unix())
 	logx.Info(n.TableName, "-------", n.NewUserId, ",findSQL:", findSQL)
 	logx.Info(n.TableName, "-------", n.NewUserId, ",findSQL:", findSQL)
 	list := n.MysqlDb.SelectBySql(findSQL)
 	list := n.MysqlDb.SelectBySql(findSQL)
 	if len(*list) > 0 && list != nil {
 	if len(*list) > 0 && list != nil {

BIN
jyBXBase/rpc/rpc.exe


+ 8 - 7
jyBXBase/rpc/util/common.go

@@ -1,20 +1,21 @@
 package util
 package util
 
 
 import (
 import (
-	"app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/esv1"
-	"app.yhyue.com/moapp/jybase/mongodb"
-	"app.yhyue.com/moapp/jybase/mysql"
-	"app.yhyue.com/moapp/jybase/redis"
 	"fmt"
 	"fmt"
-	"go.mongodb.org/mongo-driver/bson/primitive"
 	"jyBXBase/rpc/bxbase"
 	"jyBXBase/rpc/bxbase"
 	IC "jyBXBase/rpc/init"
 	IC "jyBXBase/rpc/init"
 	"log"
 	"log"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 	"time"
 	"time"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	elastic "app.yhyue.com/moapp/jybase/es"
+	"app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/mysql"
+	"app.yhyue.com/moapp/jybase/redis"
+	"go.mongodb.org/mongo-driver/bson/primitive"
 )
 )
 
 
 const (
 const (

+ 5 - 0
jyBXBuyer/api/bxbuyer.go

@@ -3,8 +3,10 @@ package main
 import (
 import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/endless"
 	"app.yhyue.com/moapp/jybase/endless"
+	logrusx "app.yhyue.com/moapp/jylogx/logx"
 	"bp.jydev.jianyu360.cn/BaseService/gateway/core/node"
 	"bp.jydev.jianyu360.cn/BaseService/gateway/core/node"
 	"fmt"
 	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
 	IC "jyBXBuyer/api/init"
 	IC "jyBXBuyer/api/init"
 	"log"
 	"log"
 	"net/http"
 	"net/http"
@@ -44,6 +46,9 @@ func main() {
 		}
 		}
 	})
 	})
 
 
+	//日志记录
+	logx.SetWriter(logrusx.NewLogrusWriter())
+
 	handler.RegisterHandlers(server, ctx)
 	handler.RegisterHandlers(server, ctx)
 	fmt.Printf("Starting server at %s:%d...\n", IC.C.Host, IC.C.Port)
 	fmt.Printf("Starting server at %s:%d...\n", IC.C.Host, IC.C.Port)
 	server.Start()
 	server.Start()

+ 0 - 21
jyBXBuyer/api/init/init.go

@@ -4,9 +4,7 @@ import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"flag"
 	"flag"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/conf"
-	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXBuyer/api/internal/config"
 	"jyBXBuyer/api/internal/config"
-	"jyBXBuyer/entity"
 	"log"
 	"log"
 	"regexp"
 	"regexp"
 )
 )
@@ -15,15 +13,9 @@ var configFile = flag.String("cf", "etc/bxbuyer-api.yaml", "the config file")
 
 
 var C config.Config
 var C config.Config
 
 
-//
-var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
-var logc entity.Logc
-
-//
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 var DB config.Db
 
 
-//
 var routesFile = flag.String("rf", "etc/routes.yaml", "the routes file")
 var routesFile = flag.String("rf", "etc/routes.yaml", "the routes file")
 var Routes config.Routes
 var Routes config.Routes
 var ExcludeUrl = []*regexp.Regexp{}
 var ExcludeUrl = []*regexp.Regexp{}
@@ -36,19 +28,6 @@ func init() {
 	conf.MustLoad(*dbFile, &DB)
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
 	//初始mongodb
 	MongoDBInit(&DB.Mongo)
 	MongoDBInit(&DB.Mongo)
-	//初始化日志信息
-	conf.MustLoad(*logFile, &logc)
-	if len(logc.Level) > 0 {
-		for _, v := range logc.Level {
-			logx.MustSetup(logx.LogConf{
-				Mode:     logc.Mode,
-				Path:     logc.Path,
-				Level:    v,
-				KeepDays: logc.KeepDays,
-			})
-			logx.Info(v, "--日志记录")
-		}
-	}
 	//读取路由配置
 	//读取路由配置
 	conf.MustLoad(*routesFile, &Routes)
 	conf.MustLoad(*routesFile, &Routes)
 	if len(Routes.ExcludeRoute) > 0 {
 	if len(Routes.ExcludeRoute) > 0 {

+ 5 - 2
jyBXBuyer/entity/db.go

@@ -41,6 +41,9 @@ type RedisStuct struct {
 
 
 //es
 //es
 type EsStruct struct {
 type EsStruct struct {
-	Addr string `json:"addr"`
-	Size int    `json:"size"`
+	Addr     string `json:"addr"`
+	Size     int    `json:"size"`
+	Version  string `json:"version"`
+	UserName string `json:"userName"`
+	Password string `json:"password"`
 }
 }

+ 14 - 6
jyBXBuyer/go.mod

@@ -3,11 +3,19 @@ module jyBXBuyer
 go 1.16
 go 1.16
 
 
 require (
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20220527072445-3116753a8f28
+	app.yhyue.com/moapp/jybase v0.0.0-20230420060106-a9c3f4187463
+	app.yhyue.com/moapp/jylogx v0.0.0-20230511070629-0ed867dc49d6
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
-	github.com/go-sql-driver/mysql v1.6.0
-	github.com/golang/protobuf v1.5.2
-	github.com/zeromicro/go-zero v1.3.3
-	google.golang.org/grpc v1.46.0
-	google.golang.org/protobuf v1.28.0
+	github.com/go-sql-driver/mysql v1.7.0
+	github.com/golang/protobuf v1.5.3
+	github.com/zeromicro/go-zero v1.5.2
+	google.golang.org/grpc v1.54.0
+	google.golang.org/protobuf v1.30.0
+)
+
+require (
+	go.opentelemetry.io/otel/exporters/jaeger v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.15.1 // indirect
 )
 )

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 664 - 31
jyBXBuyer/go.sum


+ 4 - 0
jyBXBuyer/rpc/bxbuyer.go

@@ -3,7 +3,9 @@ package main
 import (
 import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/endless"
 	"app.yhyue.com/moapp/jybase/endless"
+	logrusx "app.yhyue.com/moapp/jylogx/logx"
 	"fmt"
 	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXBuyer/rpc/type/bxbuyer"
 	"jyBXBuyer/rpc/type/bxbuyer"
 	"log"
 	"log"
 
 
@@ -36,6 +38,8 @@ func main() {
 		}
 		}
 	})
 	})
 	defer s.Stop()
 	defer s.Stop()
+	//日志记录
+	logx.SetWriter(logrusx.NewLogrusWriter())
 
 
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	s.Start()
 	s.Start()

+ 3 - 0
jyBXBuyer/rpc/etc/db.yaml

@@ -12,6 +12,9 @@ redis:
 es:
 es:
     addr: http://192.168.3.206:9800
     addr: http://192.168.3.206:9800
     size: 30
     size: 30
+    version: v7
+    userName: ""
+    password: ""
 mongo:
 mongo:
     main:
     main:
         dbName: qfw
         dbName: qfw

+ 4 - 3
jyBXBuyer/rpc/init/db.go

@@ -4,12 +4,13 @@
 package init
 package init
 
 
 import (
 import (
-	"github.com/zeromicro/go-zero/core/logx"
 	"strings"
 	"strings"
 
 
+	"github.com/zeromicro/go-zero/core/logx"
+
 	"jyBXBuyer/entity"
 	"jyBXBuyer/entity"
 
 
-	"app.yhyue.com/moapp/jybase/esv1"
+	. "app.yhyue.com/moapp/jybase/es"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jybase/redis"
@@ -65,6 +66,6 @@ func EsInit(es *entity.EsStruct) {
 	//初始化 elasticsearch
 	//初始化 elasticsearch
 	if es.Addr != "" {
 	if es.Addr != "" {
 		logx.Info("--初始化 elasticsearch--")
 		logx.Info("--初始化 elasticsearch--")
-		elastic.InitElasticSize(es.Addr, es.Size)
+		NewEs(es.Version, es.Addr, es.Size, es.UserName, es.Password)
 	}
 	}
 }
 }

+ 0 - 20
jyBXBuyer/rpc/init/init.go

@@ -4,8 +4,6 @@ import (
 	"flag"
 	"flag"
 	_ "github.com/go-sql-driver/mysql"
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/conf"
-	"github.com/zeromicro/go-zero/core/logx"
-	"jyBXBuyer/entity"
 	"jyBXBuyer/rpc/internal/config"
 	"jyBXBuyer/rpc/internal/config"
 )
 )
 
 
@@ -13,14 +11,9 @@ var configFile = flag.String("cf", "etc/bxbuyer.yaml", "the config file")
 var C config.Config
 var C config.Config
 var err error
 var err error
 
 
-//
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 var DB config.Db
 
 
-//
-var logFile = flag.String("lf", "etc/logs.yaml", "the logs file")
-var logc entity.Logc
-
 func init() {
 func init() {
 	//基本配置
 	//基本配置
 	conf.MustLoad(*configFile, &C)
 	conf.MustLoad(*configFile, &C)
@@ -34,17 +27,4 @@ func init() {
 	RedisInit(&DB.Redis)
 	RedisInit(&DB.Redis)
 	//初始es
 	//初始es
 	EsInit(&DB.Es)
 	EsInit(&DB.Es)
-	//初始化日志信息
-	conf.MustLoad(*logFile, &logc)
-	if len(logc.Level) > 0 {
-		for _, v := range logc.Level {
-			logx.MustSetup(logx.LogConf{
-				Mode:     logc.Mode,
-				Path:     logc.Path,
-				Level:    v,
-				KeepDays: logc.KeepDays,
-			})
-			logx.Info(v, "--日志记录")
-		}
-	}
 }
 }

+ 7 - 36
jyBXBuyer/rpc/model/buyerListBYEs.go

@@ -1,20 +1,19 @@
 package model
 package model
 
 
 import (
 import (
-	MC "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/esv1"
 	"encoding/json"
 	"encoding/json"
 	"fmt"
 	"fmt"
-	"github.com/zeromicro/go-zero/core/logx"
 	IC "jyBXBuyer/rpc/init"
 	IC "jyBXBuyer/rpc/init"
 	"jyBXBuyer/rpc/type/bxbuyer"
 	"jyBXBuyer/rpc/type/bxbuyer"
-	"log"
-	"runtime"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 	"sync"
 	"sync"
 	"time"
 	"time"
+
+	MC "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	elastic "app.yhyue.com/moapp/jybase/es"
+	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
 type BScope struct {
 type BScope struct {
@@ -229,36 +228,8 @@ func GetBuyerList(qstr string, in *bxbuyer.BuyerListReq, isCache bool) (resp *bx
 }
 }
 
 
 //聚合查询
 //聚合查询
-func GetAggs(index, itype, query string) (aggs map[string]*json.RawMessage) {
-	//count = elastic.Count(index, itype, query)
-	defer MC.Catch()
-	client := elastic.GetEsConn()
-	defer func() {
-		go elastic.DestoryEsConn(client)
-	}()
-	if client != nil {
-		defer func() {
-			if r := recover(); r != nil {
-				for skip := 1; ; skip++ {
-					_, file, line, ok := runtime.Caller(skip)
-					if !ok {
-						break
-					}
-					go log.Printf("%v,%v\n", file, line)
-				}
-			}
-		}()
-		searchResult, err := client.Search().Index(index).Type(itype).Source(query).Do()
-		if searchResult.TimedOut {
-			//请求超时
-			log.Println(err, "____________:::", searchResult.TimedOut)
-			return
-		}
-		if err != nil {
-			log.Println("从ES查询出错", err.Error())
-		}
-		aggs = searchResult.Aggregations
-	}
+func GetAggs(index, itype, query string) (aggs map[string]json.RawMessage) {
+	aggs, _, _ = elastic.GetAggs(index, itype, query)
 	return
 	return
 }
 }
 
 

+ 4 - 0
jyBXCore/api/bxcore.go

@@ -3,8 +3,10 @@ package main
 import (
 import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/endless"
 	"app.yhyue.com/moapp/jybase/endless"
+	logrusx "app.yhyue.com/moapp/jylogx/logx"
 	"bp.jydev.jianyu360.cn/BaseService/gateway/core/node"
 	"bp.jydev.jianyu360.cn/BaseService/gateway/core/node"
 	"fmt"
 	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
 	IC "jyBXCore/api/init"
 	IC "jyBXCore/api/init"
 	"jyBXCore/api/internal/handler"
 	"jyBXCore/api/internal/handler"
 	"jyBXCore/api/internal/svc"
 	"jyBXCore/api/internal/svc"
@@ -42,6 +44,8 @@ func main() {
 			next.ServeHTTP(w, r)
 			next.ServeHTTP(w, r)
 		}
 		}
 	})
 	})
+	//日志记录
+	logx.SetWriter(logrusx.NewLogrusWriter())
 
 
 	handler.RegisterHandlers(server, ctx)
 	handler.RegisterHandlers(server, ctx)
 	fmt.Printf("Starting server at %s:%d...\n", IC.C.Host, IC.C.Port)
 	fmt.Printf("Starting server at %s:%d...\n", IC.C.Host, IC.C.Port)

+ 0 - 21
jyBXCore/api/init/init.go

@@ -4,9 +4,7 @@ import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"flag"
 	"flag"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/conf"
-	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXCore/api/internal/config"
 	"jyBXCore/api/internal/config"
-	"jyBXCore/entity"
 	"log"
 	"log"
 	"regexp"
 	"regexp"
 )
 )
@@ -15,15 +13,9 @@ var configFile = flag.String("cf", "etc/bxcore-api.yaml", "the config file")
 
 
 var C config.Config
 var C config.Config
 
 
-//
-var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
-var logc entity.Logc
-
-//
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 var DB config.Db
 
 
-//
 var routesFile = flag.String("rf", "etc/routes.yaml", "the routes file")
 var routesFile = flag.String("rf", "etc/routes.yaml", "the routes file")
 var Routes config.Routes
 var Routes config.Routes
 var ExcludeUrl = []*regexp.Regexp{}
 var ExcludeUrl = []*regexp.Regexp{}
@@ -36,19 +28,6 @@ func init() {
 	conf.MustLoad(*dbFile, &DB)
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
 	//初始mongodb
 	MongoDBInit(&DB.Mongo)
 	MongoDBInit(&DB.Mongo)
-	//初始化日志信息
-	conf.MustLoad(*logFile, &logc)
-	if len(logc.Level) > 0 {
-		for _, v := range logc.Level {
-			logx.MustSetup(logx.LogConf{
-				Mode:     logc.Mode,
-				Path:     logc.Path,
-				Level:    v,
-				KeepDays: logc.KeepDays,
-			})
-			logx.Info(v, "--日志记录")
-		}
-	}
 	//读取路由配置
 	//读取路由配置
 	conf.MustLoad(*routesFile, &Routes)
 	conf.MustLoad(*routesFile, &Routes)
 	if len(Routes.ExcludeRoute) > 0 {
 	if len(Routes.ExcludeRoute) > 0 {

+ 5 - 2
jyBXCore/entity/db.go

@@ -41,6 +41,9 @@ type RedisStuct struct {
 
 
 //es
 //es
 type EsStruct struct {
 type EsStruct struct {
-	Addr string `json:"addr"`
-	Size int    `json:"size"`
+	Addr     string `json:"addr"`
+	Size     int    `json:"size"`
+	Version  string `json:"version"`
+	UserName string `json:"userName"`
+	Password string `json:"password"`
 }
 }

+ 6 - 5
jyBXCore/entity/rpc.go

@@ -1,9 +1,10 @@
 package entity
 package entity
 
 
 import (
 import (
-	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
 	"context"
 	"context"
 	"strings"
 	"strings"
+
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
 )
 )
 
 
 var (
 var (
@@ -49,11 +50,11 @@ func (ui *UserInfoRpc) GetQueryItems(selectType string, limitOldTime, registerDa
 			if t == "content" {
 			if t == "content" {
 				items = append(items, "detail")
 				items = append(items, "detail")
 			} else if t == "buyer" {
 			} else if t == "buyer" {
-				items = append(items, "mbuyer")
+				items = append(items, "buyer.mbuyer")
 			} else if t == "winner" {
 			} else if t == "winner" {
-				items = append(items, "mwinner")
+				items = append(items, "s_winner.mwinner")
 			} else if t == "agency" {
 			} else if t == "agency" {
-				items = append(items, "magency")
+				items = append(items, "agency.magency")
 			} else if t == "title" {
 			} else if t == "title" {
 				items = append(items, "title")
 				items = append(items, "title")
 			} else if t == "ppa" {
 			} else if t == "ppa" {
@@ -68,7 +69,7 @@ func (ui *UserInfoRpc) GetQueryItems(selectType string, limitOldTime, registerDa
 	isOldUser := registerData != 0 && registerData < limitOldTime
 	isOldUser := registerData != 0 && registerData < limitOldTime
 	for _, t := range strings.Split(selectType, ",") {
 	for _, t := range strings.Split(selectType, ",") {
 		if t == "winner" && isOldUser {
 		if t == "winner" && isOldUser {
-			items = append(items, "mwinner")
+			items = append(items, "s_winner.mwinner")
 		} else if t == "title" {
 		} else if t == "title" {
 			items = append(items, "title")
 			items = append(items, "title")
 		} else if t == "content" {
 		} else if t == "content" {

+ 76 - 65
jyBXCore/go.mod

@@ -3,118 +3,129 @@ module jyBXCore
 go 1.18
 go 1.18
 
 
 require (
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
-	app.yhyue.com/moapp/jypkg v0.0.0-20230313120532-c305dbfd6a62
+	app.yhyue.com/moapp/jybase v0.0.0-20230509102020-7c97492d5b78
+	app.yhyue.com/moapp/jylogx v0.0.0-20230511070629-0ed867dc49d6
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230222052351-9d6fad062447
 	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230222052351-9d6fad062447
 	github.com/go-sql-driver/mysql v1.7.0
 	github.com/go-sql-driver/mysql v1.7.0
-	github.com/zeromicro/go-zero v1.4.4
-	google.golang.org/grpc v1.53.0
-	google.golang.org/protobuf v1.28.1
+	github.com/zeromicro/go-zero v1.5.2
+	google.golang.org/grpc v1.54.0
+	google.golang.org/protobuf v1.30.0
 )
 )
 
 
 require (
 require (
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
-	app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230304035551-21bb1eedf547 // indirect
-	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae // indirect
-	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e // indirect
-	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.7 // indirect
-	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.13 // indirect
+	app.yhyue.com/moapp/jylog v0.0.0-20230511065424-895d5b2cedfd // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
-	github.com/cenkalti/backoff/v4 v4.1.3 // indirect
+	github.com/cenkalti/backoff/v4 v4.2.1 // indirect
 	github.com/cespare/xxhash/v2 v2.2.0 // indirect
 	github.com/cespare/xxhash/v2 v2.2.0 // indirect
-	github.com/coreos/go-semver v0.3.0 // indirect
-	github.com/coreos/go-systemd/v22 v22.3.2 // indirect
+	github.com/coreos/go-semver v0.3.1 // indirect
+	github.com/coreos/go-systemd/v22 v22.5.0 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
 	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
-	github.com/fatih/color v1.13.0 // indirect
+	github.com/emicklei/go-restful/v3 v3.9.0 // indirect
+	github.com/fatih/color v1.15.0 // indirect
 	github.com/felixge/fgprof v0.9.3 // indirect
 	github.com/felixge/fgprof v0.9.3 // indirect
+	github.com/fsnotify/fsnotify v1.6.0 // indirect
 	github.com/garyburd/redigo v1.6.2 // indirect
 	github.com/garyburd/redigo v1.6.2 // indirect
-	github.com/go-logr/logr v1.2.3 // indirect
+	github.com/go-logr/logr v1.2.4 // indirect
 	github.com/go-logr/stdr v1.2.2 // indirect
 	github.com/go-logr/stdr v1.2.2 // indirect
+	github.com/go-openapi/jsonpointer v0.19.6 // indirect
+	github.com/go-openapi/jsonreference v0.20.1 // indirect
+	github.com/go-openapi/swag v0.22.3 // indirect
 	github.com/go-redis/redis/v8 v8.11.5 // indirect
 	github.com/go-redis/redis/v8 v8.11.5 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
-	github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
+	github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
 	github.com/golang/mock v1.6.0 // indirect
 	github.com/golang/mock v1.6.0 // indirect
-	github.com/golang/protobuf v1.5.2 // indirect
+	github.com/golang/protobuf v1.5.3 // indirect
 	github.com/golang/snappy v0.0.4 // indirect
 	github.com/golang/snappy v0.0.4 // indirect
 	github.com/gomodule/redigo v2.0.0+incompatible // indirect
 	github.com/gomodule/redigo v2.0.0+incompatible // indirect
+	github.com/google/gnostic v0.5.7-v3refs // indirect
 	github.com/google/go-cmp v0.5.9 // indirect
 	github.com/google/go-cmp v0.5.9 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
 	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
 	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
 	github.com/google/uuid v1.3.0 // 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
+	github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
+	github.com/hashicorp/hcl v1.0.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/jinzhu/now v1.1.1 // indirect
 	github.com/jinzhu/now v1.1.1 // indirect
 	github.com/josharian/intern v1.0.0 // indirect
 	github.com/josharian/intern v1.0.0 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
-	github.com/klauspost/compress v1.13.6 // indirect
+	github.com/klauspost/compress v1.15.15 // indirect
+	github.com/magiconair/properties v1.8.7 // indirect
 	github.com/mailru/easyjson v0.7.7 // indirect
 	github.com/mailru/easyjson v0.7.7 // indirect
-	github.com/mattn/go-colorable v0.1.9 // indirect
-	github.com/mattn/go-isatty v0.0.14 // indirect
-	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
+	github.com/mattn/go-colorable v0.1.13 // indirect
+	github.com/mattn/go-isatty v0.0.17 // indirect
+	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
+	github.com/mitchellh/mapstructure v1.5.0 // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
-	github.com/nsqio/go-nsq v1.1.0 // indirect
+	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
 	github.com/olivere/elastic/v7 v7.0.22 // indirect
 	github.com/olivere/elastic/v7 v7.0.22 // indirect
-	github.com/openzipkin/zipkin-go v0.4.0 // indirect
-	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
+	github.com/openzipkin/zipkin-go v0.4.1 // indirect
+	github.com/pelletier/go-toml/v2 v2.0.7 // indirect
 	github.com/pkg/errors v0.9.1 // 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
-	github.com/prometheus/common v0.37.0 // indirect
-	github.com/prometheus/procfs v0.8.0 // indirect
+	github.com/prometheus/client_golang v1.15.0 // indirect
+	github.com/prometheus/client_model v0.3.0 // indirect
+	github.com/prometheus/common v0.42.0 // indirect
+	github.com/prometheus/procfs v0.9.0 // indirect
+	github.com/sirupsen/logrus v1.9.0 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
-	github.com/tealeg/xlsx v1.0.5 // indirect
-	github.com/thinxer/go-word2vec v0.0.0-20150917053916-5c19ec7379ed // indirect
+	github.com/spf13/afero v1.9.3 // indirect
+	github.com/spf13/cast v1.5.0 // indirect
+	github.com/spf13/jwalterweatherman v1.1.0 // indirect
+	github.com/spf13/pflag v1.0.5 // indirect
+	github.com/spf13/viper v1.15.0 // indirect
+	github.com/subosito/gotenv v1.4.2 // indirect
 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
-	github.com/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb // indirect
-	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.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
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/zipkin v1.11.0 // indirect
-	go.opentelemetry.io/otel/sdk v1.11.0 // indirect
-	go.opentelemetry.io/otel/trace v1.11.0 // indirect
+	go.etcd.io/etcd/api/v3 v3.5.8 // indirect
+	go.etcd.io/etcd/client/pkg/v3 v3.5.8 // indirect
+	go.etcd.io/etcd/client/v3 v3.5.8 // indirect
+	go.mongodb.org/mongo-driver v1.11.4 // indirect
+	go.opentelemetry.io/otel v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/jaeger v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.15.1 // indirect
+	go.opentelemetry.io/otel/sdk v1.15.1 // indirect
+	go.opentelemetry.io/otel/trace v1.15.1 // indirect
 	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
 	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
-	go.uber.org/atomic v1.9.0 // indirect
-	go.uber.org/automaxprocs v1.5.1 // indirect
-	go.uber.org/multierr v1.8.0 // indirect
-	go.uber.org/zap v1.21.0 // indirect
-	golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
-	golang.org/x/net v0.5.0 // indirect
-	golang.org/x/oauth2 v0.4.0 // indirect
+	go.uber.org/atomic v1.10.0 // indirect
+	go.uber.org/automaxprocs v1.5.2 // indirect
+	go.uber.org/multierr v1.9.0 // indirect
+	go.uber.org/zap v1.24.0 // indirect
+	golang.org/x/crypto v0.6.0 // indirect
+	golang.org/x/net v0.9.0 // indirect
+	golang.org/x/oauth2 v0.5.0 // indirect
 	golang.org/x/sync v0.1.0 // indirect
 	golang.org/x/sync v0.1.0 // indirect
-	golang.org/x/sys v0.4.0 // indirect
-	golang.org/x/term v0.4.0 // indirect
-	golang.org/x/text v0.6.0 // indirect
+	golang.org/x/sys v0.7.0 // indirect
+	golang.org/x/term v0.7.0 // indirect
+	golang.org/x/text v0.9.0 // indirect
 	golang.org/x/time v0.3.0 // indirect
 	golang.org/x/time v0.3.0 // indirect
 	google.golang.org/appengine v1.6.7 // indirect
 	google.golang.org/appengine v1.6.7 // indirect
-	google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
-	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
+	google.golang.org/genproto v0.0.0-20230123190316-2c411cf9d197 // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect
+	gopkg.in/ini.v1 v1.67.0 // indirect
+	gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 	gorm.io/driver/mysql v1.0.5 // indirect
 	gorm.io/driver/mysql v1.0.5 // indirect
 	gorm.io/gorm v1.21.3 // indirect
 	gorm.io/gorm v1.21.3 // indirect
-	k8s.io/api v0.22.9 // indirect
-	k8s.io/apimachinery v0.22.9 // indirect
-	k8s.io/client-go v0.22.9 // indirect
-	k8s.io/klog/v2 v2.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
+	k8s.io/api v0.26.3 // indirect
+	k8s.io/apimachinery v0.27.0-alpha.3 // indirect
+	k8s.io/client-go v0.26.3 // indirect
+	k8s.io/klog/v2 v2.90.1 // indirect
+	k8s.io/kube-openapi v0.0.0-20230307230338-69ee2d25a840 // indirect
+	k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
+	sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
+	sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
+	sigs.k8s.io/yaml v1.3.0 // indirect
 )
 )

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 76 - 573
jyBXCore/go.sum


+ 4 - 2
jyBXCore/rpc/bxcore.go

@@ -3,7 +3,9 @@ package main
 import (
 import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/endless"
 	"app.yhyue.com/moapp/jybase/endless"
+	logrusx "app.yhyue.com/moapp/jylogx/logx"
 	"fmt"
 	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXCore/rpc/type/bxcore"
 	"jyBXCore/rpc/type/bxcore"
 	"jyBXCore/rpc/util"
 	"jyBXCore/rpc/util"
 	"log"
 	"log"
@@ -39,9 +41,9 @@ func main() {
 			reflection.Register(grpcServer)
 			reflection.Register(grpcServer)
 		}
 		}
 	})
 	})
-	//日志记录
-	//s.AddUnaryInterceptors(util.CustomInterceptors)
 	defer s.Stop()
 	defer s.Stop()
+	//日志记录
+	logx.SetWriter(logrusx.NewLogrusWriter())
 
 
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	s.Start()
 	s.Start()

+ 3 - 0
jyBXCore/rpc/etc/db.yaml

@@ -13,6 +13,9 @@ redis:
 es:
 es:
     addr: http://192.168.3.206:9800
     addr: http://192.168.3.206:9800
     size: 50
     size: 50
+    version: v7
+    userName: ""
+    password: ""
 mongo:
 mongo:
     main:
     main:
         dbName: qfw
         dbName: qfw

+ 4 - 3
jyBXCore/rpc/init/db.go

@@ -4,12 +4,13 @@
 package init
 package init
 
 
 import (
 import (
-	"github.com/zeromicro/go-zero/core/logx"
 	"strings"
 	"strings"
 
 
+	"github.com/zeromicro/go-zero/core/logx"
+
 	"jyBXCore/entity"
 	"jyBXCore/entity"
 
 
-	"app.yhyue.com/moapp/jybase/esv1"
+	. "app.yhyue.com/moapp/jybase/es"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jybase/redis"
@@ -78,6 +79,6 @@ func EsInit(es *entity.EsStruct) {
 	//初始化 elasticsearch
 	//初始化 elasticsearch
 	if es.Addr != "" {
 	if es.Addr != "" {
 		logx.Info("--初始化 elasticsearch--")
 		logx.Info("--初始化 elasticsearch--")
-		elastic.InitElasticSize(es.Addr, es.Size)
+		NewEs(es.Version, es.Addr, es.Size, es.UserName, es.Password)
 	}
 	}
 }
 }

+ 1 - 17
jyBXCore/rpc/init/init.go

@@ -7,7 +7,6 @@ import (
 	_ "github.com/go-sql-driver/mysql"
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/discov"
 	"github.com/zeromicro/go-zero/core/discov"
-	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/zrpc"
 	"github.com/zeromicro/go-zero/zrpc"
 	"jyBXCore/entity"
 	"jyBXCore/entity"
 	"jyBXCore/rpc/internal/config"
 	"jyBXCore/rpc/internal/config"
@@ -20,9 +19,6 @@ var err error
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 var DB config.Db
 
 
-var logFile = flag.String("lf", "etc/logs.yaml", "the logs file")
-var logc entity.Logc
-
 // 全文或附件搜索限制
 // 全文或附件搜索限制
 var SearchLimitKey = "jy_limitSearchText_new"
 var SearchLimitKey = "jy_limitSearchText_new"
 var SearchLimitFlag = "jy_limitSearchText_%s"
 var SearchLimitFlag = "jy_limitSearchText_%s"
@@ -40,19 +36,7 @@ func init() {
 	RedisInit(&DB.Redis)
 	RedisInit(&DB.Redis)
 	//初始es
 	//初始es
 	EsInit(&DB.Es)
 	EsInit(&DB.Es)
-	//初始化日志信息
-	conf.MustLoad(*logFile, &logc)
-	if len(logc.Level) > 0 {
-		for _, v := range logc.Level {
-			logx.MustSetup(logx.LogConf{
-				Mode:     logc.Mode,
-				Path:     logc.Path,
-				Level:    v,
-				KeepDays: logc.KeepDays,
-			})
-			logx.Info(v, "--日志记录")
-		}
-	}
+
 	//初始化标签
 	//初始化标签
 	LabelInit()
 	LabelInit()
 	//
 	//

+ 6 - 5
jyBXCore/rpc/model/es/es.go

@@ -1,11 +1,12 @@
 package es
 package es
 
 
 import (
 import (
-	elastic "app.yhyue.com/moapp/jybase/esv1"
 	"fmt"
 	"fmt"
-	"github.com/zeromicro/go-zero/core/logx"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
+
+	elastic "app.yhyue.com/moapp/jybase/es"
+	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
 const (
 const (
@@ -15,8 +16,8 @@ const (
 	queryBoolShould         = `{"bool":{"should":[%s],"minimum_should_match": 1}}`
 	queryBoolShould         = `{"bool":{"should":[%s],"minimum_should_match": 1}}`
 	queryBoolMustBoolShould = `{"bool":{"must":[{"range":{"bidamount":{%s}}}]}},{"bool":{"must":[{"range":{"budget":{%s}}}],"must_not":[{"range":{"bidamount":{"gte":-1}}}]}}`
 	queryBoolMustBoolShould = `{"bool":{"must":[{"range":{"bidamount":{%s}}}]}},{"bool":{"must":[{"range":{"budget":{%s}}}],"must_not":[{"range":{"bidamount":{"gte":-1}}}]}}`
 	queryBoolMust           = `{"bool":{"must":[{"terms":{"s_subscopeclass":[%s]}}]}}`
 	queryBoolMust           = `{"bool":{"must":[{"terms":{"s_subscopeclass":[%s]}}]}}`
-	queryBoolMustTerm       = `{"bool": {"must": [{ "term": {"isValidFile": %d }}]}}`
-	queryMissing            = `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
+	queryBoolMustTerm       = `{"bool": {"must": [{ "term": {"isValidFile": %t }}]}}`
+	queryExists             = `{"constant_score":{"filter":{"exists":{"field":"%s"}}}}`
 	gte                     = `"gte": %s`
 	gte                     = `"gte": %s`
 	lte                     = `"lte": %s`
 	lte                     = `"lte": %s`
 	HighlightStr            = `"%s": {"fragment_size": %d,"number_of_fragments": 1}`
 	HighlightStr            = `"%s": {"fragment_size": %d,"number_of_fragments": 1}`
@@ -78,7 +79,7 @@ func (e *SearchByES) GetAllByNgramWithCount() (int64, *[]map[string]interface{})
 			queryStr = queryStr[:len(queryStr)-1] + `,"from":` + strconv.Itoa(e.Start) + `,"size":` + strconv.Itoa(e.Limit) + "}"
 			queryStr = queryStr[:len(queryStr)-1] + `,"from":` + strconv.Itoa(e.Start) + `,"size":` + strconv.Itoa(e.Limit) + "}"
 		}
 		}
 		logx.Info("queryStr:", queryStr)
 		logx.Info("queryStr:", queryStr)
-		return elastic.GetWithCount(e.Index, e.IType, queryStr)
+		return elastic.GetWithCount(e.Index, e.IType, e.Query, queryStr)
 	} else {
 	} else {
 		return 0, nil
 		return 0, nil
 	}
 	}

+ 10 - 10
jyBXCore/rpc/model/es/search.go

@@ -1,15 +1,16 @@
 package es
 package es
 
 
 import (
 import (
-	MC "app.yhyue.com/moapp/jybase/common"
-	elastic "app.yhyue.com/moapp/jybase/esv1"
 	"fmt"
 	"fmt"
-	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXCore/rpc/bxcore"
 	"jyBXCore/rpc/bxcore"
 	IC "jyBXCore/rpc/init"
 	IC "jyBXCore/rpc/init"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 	"time"
 	"time"
+
+	MC "app.yhyue.com/moapp/jybase/common"
+	elastic "app.yhyue.com/moapp/jybase/es"
+	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
 // GetSearchQuery  整理关键词等查询条件
 // GetSearchQuery  整理关键词等查询条件
@@ -173,28 +174,27 @@ func GetSearchQuery(in *bxcore.SearchReq, mustQuery string) (qstr string) {
 	hasBuyerTel := in.BuyerTel
 	hasBuyerTel := in.BuyerTel
 	if hasBuyerTel != "" {
 	if hasBuyerTel != "" {
 		if hasBuyerTel == "y" {
 		if hasBuyerTel == "y" {
-			mustNot = append(mustNot, fmt.Sprintf(queryMissing, "buyertel"))
+			musts = append(musts, fmt.Sprintf(queryExists, "buyertel"))
 		} else {
 		} else {
-			musts = append(musts, fmt.Sprintf(queryMissing, "buyertel"))
+			mustNot = append(mustNot, fmt.Sprintf(queryExists, "buyertel"))
 		}
 		}
 	}
 	}
 	//中标企业联系方式
 	//中标企业联系方式
 	hasWinnerTel := in.WinnerTel
 	hasWinnerTel := in.WinnerTel
 	if hasWinnerTel != "" {
 	if hasWinnerTel != "" {
 		if hasWinnerTel == "y" {
 		if hasWinnerTel == "y" {
-			mustNot = append(mustNot, fmt.Sprintf(queryMissing, "winnertel"))
+			musts = append(musts, fmt.Sprintf(queryExists, "winnertel"))
 		} else {
 		} else {
-			musts = append(musts, fmt.Sprintf(queryMissing, "winnertel"))
+			mustNot = append(mustNot, fmt.Sprintf(queryExists, "winnertel"))
 		}
 		}
 	}
 	}
 	//附件
 	//附件
 	fileExists := in.FileExists
 	fileExists := in.FileExists
 	if !isFileSearch && fileExists != "" {
 	if !isFileSearch && fileExists != "" {
 		if fileExists == "1" { //有附件
 		if fileExists == "1" { //有附件
-			mustNot = append(mustNot, fmt.Sprintf(queryMissing, "isValidFile"))
-			musts = append(musts, fmt.Sprintf(queryBoolMustTerm, 1))
+			musts = append(musts, fmt.Sprintf(queryBoolMustTerm, true))
 		} else if fileExists == "-1" { //无附件
 		} else if fileExists == "-1" { //无附件
-			musts = append(musts, fmt.Sprintf(queryMissing, "isValidFile"))
+			mustNot = append(mustNot, fmt.Sprintf(queryBoolMustTerm, true))
 		}
 		}
 	}
 	}
 	// 如果是领域化数据则需要加标签
 	// 如果是领域化数据则需要加标签

+ 6 - 66
jyBXCore/rpc/util/search.go

@@ -1,24 +1,19 @@
 package util
 package util
 
 
 import (
 import (
-	MC "app.yhyue.com/moapp/jybase/common"
-	ME "app.yhyue.com/moapp/jybase/encrypt"
-	"crypto/rand"
-	"encoding/json"
 	"fmt"
 	"fmt"
-	"github.com/zeromicro/go-zero/core/logx"
-	"io/ioutil"
 	IC "jyBXCore/rpc/init"
 	IC "jyBXCore/rpc/init"
 	"jyBXCore/rpc/internal/config"
 	"jyBXCore/rpc/internal/config"
 	"jyBXCore/rpc/type/bxcore"
 	"jyBXCore/rpc/type/bxcore"
-	"math/big"
-	"net/http"
-	"net/url"
 	"regexp"
 	"regexp"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 	"time"
 	"time"
-	"unicode"
+
+	MC "app.yhyue.com/moapp/jybase/common"
+	ME "app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/es"
+	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
 var (
 var (
@@ -102,62 +97,7 @@ func InterceptSearchKW(word string, keywordsLimit int, isFilter bool) (bWord, aW
 }
 }
 
 
 func HttpEs(ques, analyzer, esAddress string) (res string) {
 func HttpEs(ques, analyzer, esAddress string) (res string) {
-	var adders []string
-	curl := ""
-	for _, s := range strings.Split(esAddress, ",") {
-		adders = append(adders, s)
-	}
-	i, _ := rand.Int(rand.Reader, big.NewInt(int64(len(adders)))) //随机
-	curl = adders[int(i.Int64())] + "/bidding/_analyze"
-	URL, _ := url.Parse(curl)
-	Q := URL.Query()
-	Q.Add("text", ques)
-	Q.Add("analyzer", analyzer)
-	URL.RawQuery = Q.Encode()
-	resp, err := http.Get(URL.String())
-	if err != nil {
-		logx.Info("es连接失败 err1:", err)
-		resp, err = getESResp(ques, analyzer, adders)
-		if err != nil {
-			return
-		}
-	}
-	result, err1 := ioutil.ReadAll(resp.Body)
-	if err1 == nil {
-		defer resp.Body.Close()
-		var resMap map[string]interface{}
-		json.Unmarshal(result, &resMap)
-		if resMap != nil && resMap["tokens"] != nil {
-			tokens := MC.ObjArrToMapArr(resMap["tokens"].([]interface{}))
-			for _, v := range tokens {
-				token := MC.ObjToString(v["token"])
-				if len([]rune(token)) == 1 && !unicode.Is(unicode.Scripts["Han"], []rune(token)[0]) { //(P260保留单个汉字)
-					continue
-				}
-				if res != "" && token != "" {
-					res += IC.C.JYKeyMark
-				}
-				res += token
-			}
-		}
-	}
-	return
-}
-
-func getESResp(ques, analyzer string, adds []string) (resp *http.Response, err error) {
-	for _, v := range adds {
-		curl := v + "/bidding/_analyze"
-		URL, _ := url.Parse(curl)
-		Q := URL.Query()
-		Q.Add("text", ques)
-		Q.Add("analyzer", analyzer)
-		URL.RawQuery = Q.Encode()
-		resp, err = http.Get(URL.String())
-		if err == nil {
-			break
-		}
-	}
-	return resp, err
+	return strings.ReplaceAll(es.Analyze(ques, "bidding", analyzer), "+", IC.C.JYKeyMark)
 }
 }
 
 
 const (
 const (

+ 7 - 6
jyBXCore/rpc/util/userInfo.go

@@ -1,11 +1,12 @@
 package util
 package util
 
 
 import (
 import (
+	IC "jyBXCore/rpc/init"
+	"strings"
+
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/mysql"
-	IC "jyBXCore/rpc/init"
-	"strings"
 )
 )
 
 
 // VipState 是否是付费用户
 // VipState 是否是付费用户
@@ -76,11 +77,11 @@ func (vs *VipState) GetQueryItems(selectType string, limitOldTime int64) (items
 			if t == "content" {
 			if t == "content" {
 				items = append(items, "detail")
 				items = append(items, "detail")
 			} else if t == "buyer" {
 			} else if t == "buyer" {
-				items = append(items, "mbuyer")
+				items = append(items, "buyer.mbuyer")
 			} else if t == "winner" {
 			} else if t == "winner" {
-				items = append(items, "mwinner")
+				items = append(items, "s_winner.mwinner")
 			} else if t == "agency" {
 			} else if t == "agency" {
-				items = append(items, "magency")
+				items = append(items, "agency.magency")
 			} else if t == "title" {
 			} else if t == "title" {
 				items = append(items, "title")
 				items = append(items, "title")
 			} else if t == "ppa" {
 			} else if t == "ppa" {
@@ -95,7 +96,7 @@ func (vs *VipState) GetQueryItems(selectType string, limitOldTime int64) (items
 	isOldUser := vs.RegisterData != 0 && vs.RegisterData < limitOldTime
 	isOldUser := vs.RegisterData != 0 && vs.RegisterData < limitOldTime
 	for _, t := range strings.Split(selectType, ",") {
 	for _, t := range strings.Split(selectType, ",") {
 		if t == "winner" && isOldUser {
 		if t == "winner" && isOldUser {
-			items = append(items, "mwinner")
+			items = append(items, "s_winner.mwinner")
 		} else if t == "title" {
 		} else if t == "title" {
 			items = append(items, "title")
 			items = append(items, "title")
 		} else if t == "content" {
 		} else if t == "content" {

+ 18 - 16
jyBXSubscribe/api/bxsubscribe.go

@@ -1,25 +1,26 @@
 package main
 package main
 
 
 import (
 import (
-        "app.yhyue.com/moapp/jybase/endless"
-        "bp.jydev.jianyu360.cn/BaseService/gateway/core/node"
-        "fmt"
-        "log"
-        "net/http"
-        "os"
-        "os/signal"
-        "syscall"
+	"app.yhyue.com/moapp/jybase/endless"
+	logrusx "app.yhyue.com/moapp/jylogx/logx"
+	"bp.jydev.jianyu360.cn/BaseService/gateway/core/node"
+	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
+	"jyBXSubscribe/api/internal/handler"
+	"jyBXSubscribe/api/internal/svc"
+	"log"
+	"net/http"
+	"os"
+	"os/signal"
+	"syscall"
 
 
-        "jyBXSubscribe/api/internal/handler"
-        "jyBXSubscribe/api/internal/svc"
-
-        MC "app.yhyue.com/moapp/jybase/common"
-        "github.com/zeromicro/go-zero/rest"
-        IC "jyBXSubscribe/api/init"
+	MC "app.yhyue.com/moapp/jybase/common"
+	"github.com/zeromicro/go-zero/rest"
+	IC "jyBXSubscribe/api/init"
 )
 )
 
 
 func main() {
 func main() {
-        //注册代理服务
+	//注册代理服务
 	closeNotify, err := node.NewNode(IC.C.Gateway.Etcd...).Register(IC.C.Gateway.ServerCode, MC.InterfaceToStr(IC.C.Port))
 	closeNotify, err := node.NewNode(IC.C.Gateway.Etcd...).Register(IC.C.Gateway.ServerCode, MC.InterfaceToStr(IC.C.Port))
 	if err != nil {
 	if err != nil {
 		panic(err)
 		panic(err)
@@ -45,7 +46,8 @@ func main() {
 		}
 		}
 	})
 	})
 	handler.RegisterHandlers(server, ctx)
 	handler.RegisterHandlers(server, ctx)
-
+	//日志记录
+	logx.SetWriter(logrusx.NewLogrusWriter())
 	fmt.Printf("Starting server at %s:%d...\n", IC.C.Host, IC.C.Port)
 	fmt.Printf("Starting server at %s:%d...\n", IC.C.Host, IC.C.Port)
 	server.Start()
 	server.Start()
 
 

+ 0 - 15
jyBXSubscribe/api/init/init.go

@@ -9,22 +9,18 @@ import (
 
 
 	MC "app.yhyue.com/moapp/jybase/common"
 	MC "app.yhyue.com/moapp/jybase/common"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/conf"
-	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
 var configFile = flag.String("cf", "etc/bxsubscribe-api.yaml", "the config file")
 var configFile = flag.String("cf", "etc/bxsubscribe-api.yaml", "the config file")
 
 
 var C config.Config
 var C config.Config
 
 
-//
 var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
 var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
 var logc entity.Logc
 var logc entity.Logc
 
 
-//
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 var DB config.Db
 
 
-//
 var routesFile = flag.String("rf", "etc/routes.yaml", "the routes file")
 var routesFile = flag.String("rf", "etc/routes.yaml", "the routes file")
 var Routes config.Routes
 var Routes config.Routes
 var ExcludeUrl = []*regexp.Regexp{}
 var ExcludeUrl = []*regexp.Regexp{}
@@ -38,17 +34,6 @@ func init() {
 	MongoDBInit(&DB.Mongo)
 	MongoDBInit(&DB.Mongo)
 	//初始化日志信息
 	//初始化日志信息
 	conf.MustLoad(*logFile, &logc)
 	conf.MustLoad(*logFile, &logc)
-	if len(logc.Level) > 0 {
-		for _, v := range logc.Level {
-			logx.MustSetup(logx.LogConf{
-				Mode:     logc.Mode,
-				Path:     logc.Path,
-				Level:    v,
-				KeepDays: logc.KeepDays,
-			})
-			logx.Info(v, "--日志记录")
-		}
-	}
 	//读取路由配置
 	//读取路由配置
 	conf.MustLoad(*routesFile, &Routes)
 	conf.MustLoad(*routesFile, &Routes)
 	if len(Routes.ExcludeRoute) > 0 {
 	if len(Routes.ExcludeRoute) > 0 {

+ 5 - 2
jyBXSubscribe/entity/db.go

@@ -43,6 +43,9 @@ type RedisStuct struct {
 
 
 //es
 //es
 type EsStruct struct {
 type EsStruct struct {
-	Addr string `json:"addr"`
-	Size int    `json:"size"`
+	Addr     string `json:"addr"`
+	Size     int    `json:"size"`
+	Version  string `json:"version"`
+	UserName string `json:"userName"`
+	Password string `json:"password"`
 }
 }

+ 85 - 61
jyBXSubscribe/go.mod

@@ -3,119 +3,143 @@ module jyBXSubscribe
 go 1.18
 go 1.18
 
 
 require (
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
-	app.yhyue.com/moapp/jypkg v0.0.0-20230218064127-1de4f4f3e6a3
+	app.yhyue.com/moapp/jybase v0.0.0-20230504094413-7eab0c56bca0
+	app.yhyue.com/moapp/jylogx v0.0.0-20230511070629-0ed867dc49d6
+	app.yhyue.com/moapp/jypkg v0.0.0-20230420060744-ff53e7ca6f47
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
-	bp.jydev.jianyu360.cn/BaseService/jyCodeService v0.0.0-20220927093612-72958b15cdf0
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230222052351-9d6fad062447
 	github.com/go-sql-driver/mysql v1.7.0
 	github.com/go-sql-driver/mysql v1.7.0
 	github.com/gogf/gf/v2 v2.0.6
 	github.com/gogf/gf/v2 v2.0.6
-	github.com/zeromicro/go-zero v1.4.4
-	go.mongodb.org/mongo-driver v1.11.1
-	google.golang.org/grpc v1.51.0
-	google.golang.org/protobuf v1.28.1
+	github.com/zeromicro/go-zero v1.5.2
+	go.mongodb.org/mongo-driver v1.11.4
+	google.golang.org/grpc v1.54.0
+	google.golang.org/protobuf v1.30.0
 )
 )
 
 
 require (
 require (
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
-	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230209051900-1e7dcb8f83b7 // indirect
-	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230207054315-b05f3dd4c4d3 // indirect
+	app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230304035551-21bb1eedf547 // indirect
+	app.yhyue.com/moapp/jylog v0.0.0-20230511065424-895d5b2cedfd // indirect
+	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e // indirect
 	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.7 // indirect
 	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.7 // indirect
-	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230129060002-f69424aa14ba // indirect
+	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.13 // indirect
 	github.com/BurntSushi/toml v0.4.1 // indirect
 	github.com/BurntSushi/toml v0.4.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
-	github.com/cenkalti/backoff/v4 v4.1.3 // indirect
-	github.com/cespare/xxhash/v2 v2.1.2 // indirect
+	github.com/cenkalti/backoff/v4 v4.2.1 // indirect
+	github.com/cespare/xxhash/v2 v2.2.0 // indirect
 	github.com/clbanning/mxj/v2 v2.5.5 // indirect
 	github.com/clbanning/mxj/v2 v2.5.5 // indirect
-	github.com/coreos/go-semver v0.3.0 // indirect
-	github.com/coreos/go-systemd/v22 v22.3.2 // indirect
+	github.com/coreos/go-semver v0.3.1 // indirect
+	github.com/coreos/go-systemd/v22 v22.5.0 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
 	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
-	github.com/fatih/color v1.13.0 // indirect
+	github.com/emicklei/go-restful/v3 v3.9.0 // indirect
+	github.com/fatih/color v1.15.0 // indirect
 	github.com/felixge/fgprof v0.9.3 // indirect
 	github.com/felixge/fgprof v0.9.3 // indirect
-	github.com/fsnotify/fsnotify v1.5.1 // indirect
+	github.com/fsnotify/fsnotify v1.6.0 // indirect
 	github.com/garyburd/redigo v1.6.2 // indirect
 	github.com/garyburd/redigo v1.6.2 // indirect
-	github.com/go-logr/logr v1.2.3 // indirect
+	github.com/go-logr/logr v1.2.4 // indirect
 	github.com/go-logr/stdr v1.2.2 // indirect
 	github.com/go-logr/stdr v1.2.2 // indirect
+	github.com/go-openapi/jsonpointer v0.19.6 // indirect
+	github.com/go-openapi/jsonreference v0.20.1 // indirect
+	github.com/go-openapi/swag v0.22.3 // indirect
 	github.com/go-redis/redis/v8 v8.11.5 // indirect
 	github.com/go-redis/redis/v8 v8.11.5 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
-	github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
+	github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
 	github.com/golang/mock v1.6.0 // indirect
 	github.com/golang/mock v1.6.0 // indirect
-	github.com/golang/protobuf v1.5.2 // indirect
+	github.com/golang/protobuf v1.5.3 // indirect
 	github.com/golang/snappy v0.0.4 // indirect
 	github.com/golang/snappy v0.0.4 // indirect
-	github.com/gomodule/redigo v1.8.9 // indirect
+	github.com/gomodule/redigo v2.0.0+incompatible // indirect
+	github.com/google/gnostic v0.5.7-v3refs // indirect
 	github.com/google/go-cmp v0.5.9 // indirect
 	github.com/google/go-cmp v0.5.9 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
 	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
 	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
 	github.com/google/uuid v1.3.0 // indirect
 	github.com/google/uuid v1.3.0 // indirect
-	github.com/googleapis/gnostic v0.5.5 // indirect
 	github.com/gorilla/websocket v1.5.0 // indirect
 	github.com/gorilla/websocket v1.5.0 // indirect
 	github.com/grokify/html-strip-tags-go v0.0.1 // indirect
 	github.com/grokify/html-strip-tags-go v0.0.1 // indirect
-	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
+	github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
+	github.com/hashicorp/hcl v1.0.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/jinzhu/now v1.1.1 // indirect
 	github.com/jinzhu/now v1.1.1 // indirect
+	github.com/josharian/intern v1.0.0 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
-	github.com/klauspost/compress v1.13.6 // indirect
+	github.com/klauspost/compress v1.15.15 // indirect
 	github.com/longbridgeapp/sqlparser v0.3.1 // indirect
 	github.com/longbridgeapp/sqlparser v0.3.1 // indirect
+	github.com/magiconair/properties v1.8.7 // indirect
+	github.com/mailru/easyjson v0.7.7 // indirect
 	github.com/mattn/go-colorable v0.1.13 // indirect
 	github.com/mattn/go-colorable v0.1.13 // indirect
-	github.com/mattn/go-isatty v0.0.16 // indirect
+	github.com/mattn/go-isatty v0.0.17 // indirect
 	github.com/mattn/go-runewidth v0.0.13 // indirect
 	github.com/mattn/go-runewidth v0.0.13 // indirect
-	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
+	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
+	github.com/mitchellh/mapstructure v1.5.0 // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
+	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
 	github.com/olekukonko/tablewriter v0.0.5 // indirect
 	github.com/olekukonko/tablewriter v0.0.5 // indirect
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
-	github.com/openzipkin/zipkin-go v0.4.0 // indirect
-	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
+	github.com/olivere/elastic/v7 v7.0.22 // indirect
+	github.com/openzipkin/zipkin-go v0.4.1 // indirect
+	github.com/pelletier/go-toml/v2 v2.0.7 // indirect
 	github.com/pkg/errors v0.9.1 // 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
-	github.com/prometheus/common v0.37.0 // indirect
-	github.com/prometheus/procfs v0.8.0 // indirect
+	github.com/prometheus/client_golang v1.15.0 // indirect
+	github.com/prometheus/client_model v0.3.0 // indirect
+	github.com/prometheus/common v0.42.0 // indirect
+	github.com/prometheus/procfs v0.9.0 // indirect
 	github.com/rivo/uniseg v0.2.0 // indirect
 	github.com/rivo/uniseg v0.2.0 // indirect
+	github.com/sirupsen/logrus v1.9.0 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
+	github.com/spf13/afero v1.9.3 // indirect
+	github.com/spf13/cast v1.5.0 // indirect
+	github.com/spf13/jwalterweatherman v1.1.0 // indirect
+	github.com/spf13/pflag v1.0.5 // indirect
+	github.com/spf13/viper v1.15.0 // indirect
+	github.com/subosito/gotenv v1.4.2 // indirect
 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
-	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.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
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/zipkin v1.11.0 // indirect
-	go.opentelemetry.io/otel/sdk v1.11.0 // indirect
-	go.opentelemetry.io/otel/trace v1.11.0 // indirect
+	go.etcd.io/etcd/api/v3 v3.5.8 // indirect
+	go.etcd.io/etcd/client/pkg/v3 v3.5.8 // indirect
+	go.etcd.io/etcd/client/v3 v3.5.8 // indirect
+	go.opentelemetry.io/otel v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/jaeger v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.15.1 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.15.1 // indirect
+	go.opentelemetry.io/otel/sdk v1.15.1 // indirect
+	go.opentelemetry.io/otel/trace v1.15.1 // indirect
 	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
 	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
-	go.uber.org/atomic v1.9.0 // indirect
-	go.uber.org/automaxprocs v1.5.1 // indirect
-	go.uber.org/multierr v1.8.0 // indirect
-	go.uber.org/zap v1.21.0 // indirect
-	golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
-	golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
-	golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
+	go.uber.org/atomic v1.10.0 // indirect
+	go.uber.org/automaxprocs v1.5.2 // indirect
+	go.uber.org/multierr v1.9.0 // indirect
+	go.uber.org/zap v1.24.0 // indirect
+	golang.org/x/crypto v0.6.0 // indirect
+	golang.org/x/net v0.9.0 // indirect
+	golang.org/x/oauth2 v0.5.0 // indirect
 	golang.org/x/sync v0.1.0 // 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-20220722155259-a9ba230a4035 // indirect
-	golang.org/x/text v0.4.0 // indirect
+	golang.org/x/sys v0.7.0 // indirect
+	golang.org/x/term v0.7.0 // indirect
+	golang.org/x/text v0.9.0 // indirect
 	golang.org/x/time v0.3.0 // indirect
 	golang.org/x/time v0.3.0 // indirect
 	google.golang.org/appengine v1.6.7 // indirect
 	google.golang.org/appengine v1.6.7 // indirect
-	google.golang.org/genproto v0.0.0-20221111202108-142d8a6fa32e // indirect
+	google.golang.org/genproto v0.0.0-20230123190316-2c411cf9d197 // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect
+	gopkg.in/ini.v1 v1.67.0 // indirect
+	gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 	gorm.io/driver/mysql v1.0.5 // indirect
 	gorm.io/driver/mysql v1.0.5 // indirect
 	gorm.io/gorm v1.21.3 // indirect
 	gorm.io/gorm v1.21.3 // indirect
-	k8s.io/api v0.22.9 // indirect
-	k8s.io/apimachinery v0.22.9 // indirect
-	k8s.io/client-go v0.22.9 // indirect
-	k8s.io/klog/v2 v2.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
+	k8s.io/api v0.26.3 // indirect
+	k8s.io/apimachinery v0.27.0-alpha.3 // indirect
+	k8s.io/client-go v0.26.3 // indirect
+	k8s.io/klog/v2 v2.90.1 // indirect
+	k8s.io/kube-openapi v0.0.0-20230307230338-69ee2d25a840 // indirect
+	k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
+	sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
+	sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
+	sigs.k8s.io/yaml v1.3.0 // indirect
 )
 )

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 202 - 434
jyBXSubscribe/go.sum


+ 12 - 11
jyBXSubscribe/rpc/bxsubscribe.go

@@ -1,25 +1,24 @@
 package main
 package main
 
 
 import (
 import (
+	MC "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/endless"
+	logrusx "app.yhyue.com/moapp/jylogx/logx"
 	"flag"
 	"flag"
 	"fmt"
 	"fmt"
-	"log"
-
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/os/gcfg"
 	"github.com/gogf/gf/v2/os/gcfg"
-
-	IC "jyBXSubscribe/rpc/init"
-	"jyBXSubscribe/rpc/internal/server"
-	"jyBXSubscribe/rpc/internal/svc"
-	"jyBXSubscribe/rpc/type/bxsubscribe"
-
-	MC "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/endless"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/conf"
+	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/service"
 	"github.com/zeromicro/go-zero/core/service"
 	"github.com/zeromicro/go-zero/zrpc"
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/reflection"
 	"google.golang.org/grpc/reflection"
+	IC "jyBXSubscribe/rpc/init"
+	"jyBXSubscribe/rpc/internal/server"
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"log"
 )
 )
 
 
 var configF = flag.String("cf", "etc/bxsubscribe.yaml", "the config file")
 var configF = flag.String("cf", "etc/bxsubscribe.yaml", "the config file")
@@ -27,9 +26,9 @@ var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
 var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
 
 
 func main() {
 func main() {
-
 	//初始化基本配置
 	//初始化基本配置
 	g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("etc/config.yaml")
 	g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("etc/config.yaml")
+	//logx.SetWriter(logx.NewWriter(jylog.GetWriter()))
 	conf.MustLoad(*configF, &IC.C)
 	conf.MustLoad(*configF, &IC.C)
 	//初始化数据库配置
 	//初始化数据库配置
 	conf.MustLoad(*dbFile, &IC.DB)
 	conf.MustLoad(*dbFile, &IC.DB)
@@ -54,7 +53,9 @@ func main() {
 			reflection.Register(grpcServer)
 			reflection.Register(grpcServer)
 		}
 		}
 	})
 	})
+
 	//日志记录
 	//日志记录
+	logx.SetWriter(logrusx.NewLogrusWriter())
 	//s.AddUnaryInterceptors(util.CustomInterceptors)
 	//s.AddUnaryInterceptors(util.CustomInterceptors)
 	defer s.Stop()
 	defer s.Stop()
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)

+ 9 - 6
jyBXSubscribe/rpc/etc/db.yaml

@@ -1,7 +1,7 @@
 mysql:
 mysql:
     main:
     main:
         dbName: jianyu
         dbName: jianyu
-        address: 192.168.3.11:3366
+        address: 192.168.3.149:3306
         userName: root
         userName: root
         password: Topnet123
         password: Topnet123
         maxOpenConns: 5
         maxOpenConns: 5
@@ -22,14 +22,17 @@ mysql:
         maxIdleConns: 5
         maxIdleConns: 5
 redis:
 redis:
     addr:
     addr:
-        - other=192.168.3.206:1712
-        - push=192.168.3.206:1712
-        - pushcache_1=192.168.3.206:5000
-        - pushcache_2_a=192.168.3.206:5001
-        - pushcache_2_b=192.168.3.206:5002
+        - other=127.0.0.1:6379
+        - push=127.0.0.1:6379
+        - pushcache_1=127.0.0.1:6379
+        - pushcache_2_a=127.0.0.1:6379
+        - pushcache_2_b=127.0.0.1:6379
 es:
 es:
     addr: http://192.168.3.206:9800
     addr: http://192.168.3.206:9800
     size: 5
     size: 5
+    version: v7
+    userName: ""
+    password: ""
 mongo:
 mongo:
     main:
     main:
         dbName: qfw
         dbName: qfw

+ 6 - 3
jyBXSubscribe/rpc/init/db.go

@@ -4,11 +4,13 @@
 package init
 package init
 
 
 import (
 import (
-	elastic "app.yhyue.com/moapp/jybase/esv1"
+	"strings"
+
+	elastic "app.yhyue.com/moapp/jybase/es"
+	P "app.yhyue.com/moapp/jybase/mapping"
 	"app.yhyue.com/moapp/jypkg/compatible"
 	"app.yhyue.com/moapp/jypkg/compatible"
 	"app.yhyue.com/moapp/jypkg/middleground"
 	"app.yhyue.com/moapp/jypkg/middleground"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
-	"strings"
 
 
 	"jyBXSubscribe/entity"
 	"jyBXSubscribe/entity"
 
 
@@ -94,6 +96,7 @@ func MysqlInit(mm *entity.Mysql) {
 		}
 		}
 		GlobalCommonData.Init()
 		GlobalCommonData.Init()
 	}
 	}
+	P.BidCodeMapping.Init(BaseServiceMysql)
 }
 }
 
 
 //
 //
@@ -110,6 +113,6 @@ func EsInit(es *entity.EsStruct) {
 	//初始化 elasticsearch
 	//初始化 elasticsearch
 	if es.Addr != "" {
 	if es.Addr != "" {
 		logx.Info("--初始化 elasticsearch--")
 		logx.Info("--初始化 elasticsearch--")
-		elastic.InitElasticSize(es.Addr, es.Size)
+		elastic.NewEs(es.Version, es.Addr, es.Size, es.UserName, es.Password)
 	}
 	}
 }
 }

+ 1 - 28
jyBXSubscribe/rpc/init/init.go

@@ -6,21 +6,15 @@ import (
 
 
 	"app.yhyue.com/moapp/jypkg/compatible"
 	"app.yhyue.com/moapp/jypkg/compatible"
 	"app.yhyue.com/moapp/jypkg/middleground"
 	"app.yhyue.com/moapp/jypkg/middleground"
-	codePb "bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
 	_ "github.com/go-sql-driver/mysql"
 	_ "github.com/go-sql-driver/mysql"
-	"github.com/zeromicro/go-zero/core/discov"
-	"github.com/zeromicro/go-zero/core/logx"
-	"github.com/zeromicro/go-zero/zrpc"
 )
 )
 
 
 var C config.Config
 var C config.Config
 var err error
 var err error
-var CodeLib codePb.CodeService
 
 
-//
 var DB config.Db
 var DB config.Db
 
 
-//var codLib
+// var codLib
 var Logc entity.Logc
 var Logc entity.Logc
 
 
 func InitC() {
 func InitC() {
@@ -37,25 +31,4 @@ func InitC() {
 		RegPowerCheckCenter(C.PowerCheckCenterKey).
 		RegPowerCheckCenter(C.PowerCheckCenterKey).
 		RegEntManageApplication(C.EntManageApplication)
 		RegEntManageApplication(C.EntManageApplication)
 	Compatible = compatible.NewCompatible(&Mgo, BaseServiceMysql, MainMysql, Middleground)
 	Compatible = compatible.NewCompatible(&Mgo, BaseServiceMysql, MainMysql, Middleground)
-	if len(Logc.Level) > 0 {
-		for _, v := range Logc.Level {
-			logx.MustSetup(logx.LogConf{
-				Mode:     Logc.Mode,
-				Path:     Logc.Path,
-				Level:    v,
-				KeepDays: Logc.KeepDays,
-			})
-			logx.Info(v, "--日志记录")
-		}
-	}
-	//代码表服务加载
-	codeClient := zrpc.MustNewClient(zrpc.RpcClientConf{
-		Etcd: discov.EtcdConf{
-			Hosts: C.CodeServiceConf.Etcd.Hosts,
-			Key:   C.CodeServiceConf.Etcd.Key,
-		},
-	})
-	logx.Info("CodeService初始化")
-	CodeLib = codePb.NewCodeService(codeClient)
-
 }
 }

+ 0 - 3
jyBXSubscribe/rpc/internal/logic/bypushhistorylogic.go

@@ -75,7 +75,6 @@ func (l *ByPushHistoryLogic) ByPushHistory(in *bxsubscribe.SubscribeInfosReq) (*
 			vipType = model.EntnicheFlag
 			vipType = model.EntnicheFlag
 		}
 		}
 	}
 	}
-
 	if in.UserType == model.EntnicheFlag {
 	if in.UserType == model.EntnicheFlag {
 		spqp.UserId = common.InterfaceToStr(spqp.EntUserId)
 		spqp.UserId = common.InterfaceToStr(spqp.EntUserId)
 	}
 	}
@@ -114,7 +113,6 @@ func (l *ByPushHistoryLogic) ByPushHistory(in *bxsubscribe.SubscribeInfosReq) (*
 		"selectIds":    ids,
 		"selectIds":    ids,
 		"pushKeyWords": keyWords,
 		"pushKeyWords": keyWords,
 	}
 	}
-
 	_id := IC.Mgo.Save("export_search", saveData)
 	_id := IC.Mgo.Save("export_search", saveData)
 	if _id == "" {
 	if _id == "" {
 		return &bxsubscribe.ByPushHistoryResp{
 		return &bxsubscribe.ByPushHistoryResp{
@@ -122,7 +120,6 @@ func (l *ByPushHistoryLogic) ByPushHistory(in *bxsubscribe.SubscribeInfosReq) (*
 			ErrorMsg:  "创建导出异常",
 			ErrorMsg:  "创建导出异常",
 		}, nil
 		}, nil
 	}
 	}
-
 	return &bxsubscribe.ByPushHistoryResp{
 	return &bxsubscribe.ByPushHistoryResp{
 		Data: encrypt.SE.Encode2Hex(_id),
 		Data: encrypt.SE.Encode2Hex(_id),
 	}, nil
 	}, nil

+ 1 - 1
jyBXSubscribe/rpc/internal/logic/getsubsomeinfologic.go

@@ -81,7 +81,7 @@ func (l *GetSubSomeInfoLogic) GetSubSomeInfo(in *bxsubscribe.SomeInfoReq) (*bxsu
 			today_1 := t.Unix()
 			today_1 := t.Unix()
 			today_2 := t.AddDate(0, 0, 1).Unix()
 			today_2 := t.AddDate(0, 0, 1).Unix()
 			//错误
 			//错误
-			if IC.BaseServiceMysql.CountBySql("select count(1) as count from pushsubscribe a left join global_common_data.dws_f_bid_baseinfo b on a.infoid=b.infoid   where a.isvip =1 and a.userid =? and b.buyerclass_code=?  and (a.date between ? and ? )", common.InterfaceToStr(in.NewUserId), 93, today_1, today_2) > 0 {
+			if IC.BaseServiceMysql.CountBySql("select count(1) as count from push.pushsubscribe where isvip =1 and userid =? and buyerclass=?  and (date between ? and ? )", common.InterfaceToStr(in.NewUserId), 93, today_1, today_2) > 0 {
 				resp.Data.OtherFlag = true
 				resp.Data.OtherFlag = true
 			}
 			}
 		} else {
 		} else {

+ 2 - 2
jyBXSubscribe/rpc/internal/logic/getviewstatuslogic.go

@@ -43,7 +43,7 @@ func (l *GetViewStatusLogic) GetViewStatus(in *bxsubscribe.GetViewStatusReq) (*b
 	in.InfoId = util.DecodeId(in.InfoId)
 	in.InfoId = util.DecodeId(in.InfoId)
 	log.Println("查看状态参数", in)
 	log.Println("查看状态参数", in)
 	res := new(bxsubscribe.ViewStatusResp)
 	res := new(bxsubscribe.ViewStatusResp)
-	finsql = `SELECT userid,isvisit,visittime,date,source FROM pushentniche where  infoid =?  order By date asc`
+	finsql = `SELECT userid,isvisit,visittime,date,source FROM push.pushentniche where  infoid =?  order By date asc`
 	if user.Role_admin_department {
 	if user.Role_admin_department {
 		users = model.GetDisUsers(common.IntAll(in.EntId), user.Dept.Id)
 		users = model.GetDisUsers(common.IntAll(in.EntId), user.Dept.Id)
 		if users != nil && len(*users) > 0 {
 		if users != nil && len(*users) > 0 {
@@ -60,7 +60,7 @@ func (l *GetViewStatusLogic) GetViewStatus(in *bxsubscribe.GetViewStatusReq) (*b
 		users = model.GetEntUsers(common.IntAll(in.EntId))
 		users = model.GetEntUsers(common.IntAll(in.EntId))
 	}
 	}
 	if len(ss) > 0 {
 	if len(ss) > 0 {
-		finsql = fmt.Sprintf(`SELECT userid,isvisit,visittime,date,source FROM pushentniche where  infoid =?  %s order By date asc`, fmt.Sprintf(`and userid in (%s)`, strings.Join(ss, ",")))
+		finsql = fmt.Sprintf(`SELECT userid,isvisit,visittime,date,source FROM push.pushentniche where  infoid =?  %s order By date asc`, fmt.Sprintf(`and userid in (%s)`, strings.Join(ss, ",")))
 	}
 	}
 	data := IC.BaseServiceMysql.SelectBySql(finsql, in.InfoId)
 	data := IC.BaseServiceMysql.SelectBySql(finsql, in.InfoId)
 	userMap := make(map[int]*model.User)
 	userMap := make(map[int]*model.User)

+ 5 - 7
jyBXSubscribe/rpc/internal/logic/msgdistributorlogic.go

@@ -50,7 +50,7 @@ func (l *MsgDistributorLogic) MsgDistributor(in *bxsubscribe.MsgDistributorReq)
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "缺少参数"}, nil
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "缺少参数"}, nil
 	}
 	}
 	//获取分发信息的地区
 	//获取分发信息的地区
-	infoRes := IC.BaseServiceMysql.SelectBySql(fmt.Sprintf("SELECT infoid FROM pushentniche WHERE id in('%s')", strings.Join(pushIds, "','")))
+	infoRes := IC.BaseServiceMysql.SelectBySql(fmt.Sprintf("SELECT infoid FROM push.pushentniche WHERE id in('%s')", strings.Join(pushIds, "','")))
 	if infoRes == nil || len(*infoRes) == 0 {
 	if infoRes == nil || len(*infoRes) == 0 {
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "获取分发地区异常"}, nil
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "获取分发地区异常"}, nil
 	}
 	}
@@ -80,14 +80,14 @@ func (l *MsgDistributorLogic) MsgDistributor(in *bxsubscribe.MsgDistributorReq)
 		}
 		}
 	}
 	}
 	//查询分发信息内容
 	//查询分发信息内容
-	msgRes := IC.BaseServiceMysql.SelectBySql(fmt.Sprintf("SELECT * FROM pushentniche WHERE id in ('%s') and entid =?  ", strings.Join(pushIds, "','")), in.EntId)
+	msgRes := IC.BaseServiceMysql.SelectBySql(fmt.Sprintf("SELECT * FROM push.pushentniche WHERE id in ('%s') and entid =?  ", strings.Join(pushIds, "','")), in.EntId)
 	if msgRes == nil || len(*msgRes) == 0 {
 	if msgRes == nil || len(*msgRes) == 0 {
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "获取分发信息内容异常"}, nil
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "获取分发信息内容异常"}, nil
 	}
 	}
 	//分发数据库修改
 	//分发数据库修改
 	ok := IC.BaseServiceMysql.ExecTx("分发数据库修改", func(tx *sql.Tx) bool {
 	ok := IC.BaseServiceMysql.ExecTx("分发数据库修改", func(tx *sql.Tx) bool {
-		insertRow := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid", "source", "date", "userid", "isvisit", "visittime", "pid"}
-		msgItems := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid"}
+		insertRow := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count", "source", "date", "userid", "isvisit", "visittime", "pid"}
+		msgItems := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count"}
 		dateNew := time.Now().Unix()
 		dateNew := time.Now().Unix()
 		for _, m := range *msgRes {
 		for _, m := range *msgRes {
 			var msgValues, insertValue []interface{}
 			var msgValues, insertValue []interface{}
@@ -98,7 +98,7 @@ func (l *MsgDistributorLogic) MsgDistributor(in *bxsubscribe.MsgDistributorReq)
 				insertValue = append(insertValue, msgValues...)
 				insertValue = append(insertValue, msgValues...)
 				insertValue = append(insertValue, []interface{}{3, dateNew, uid, nil, nil, m["id"]}...)
 				insertValue = append(insertValue, []interface{}{3, dateNew, uid, nil, nil, m["id"]}...)
 			}
 			}
-			affected, _ := IC.BaseServiceMysql.InsertBatchByTx(tx, "pushentniche", insertRow, insertValue)
+			affected, _ := IC.BaseServiceMysql.InsertBatchByTx(tx, "push.pushentniche", insertRow, insertValue)
 			if affected == 0 {
 			if affected == 0 {
 				return false
 				return false
 			}
 			}
@@ -109,13 +109,11 @@ func (l *MsgDistributorLogic) MsgDistributor(in *bxsubscribe.MsgDistributorReq)
 	for _, staff := range staffs {
 	for _, staff := range staffs {
 		//today
 		//today
 		redis.Del("pushcache_2_b", fmt.Sprintf("entnichepush_%s", staff))
 		redis.Del("pushcache_2_b", fmt.Sprintf("entnichepush_%s", staff))
-
 		//all
 		//all
 		redis.Del("pushcache_2_a", fmt.Sprintf("all_entnichepush_%s", staff))
 		redis.Del("pushcache_2_a", fmt.Sprintf("all_entnichepush_%s", staff))
 		redis.Del("pushcache_2_a", fmt.Sprintf("all_entnichepush_vip_%s", staff))
 		redis.Del("pushcache_2_a", fmt.Sprintf("all_entnichepush_vip_%s", staff))
 		redis.Del("pushcache_2_a", fmt.Sprintf("all_entnichepush_member_%s", staff))
 		redis.Del("pushcache_2_a", fmt.Sprintf("all_entnichepush_member_%s", staff))
 	}
 	}
-
 	if !ok {
 	if !ok {
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "数据分发异常"}, nil
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "数据分发异常"}, nil
 	}
 	}

+ 109 - 82
jyBXSubscribe/rpc/model/push.go

@@ -1,7 +1,6 @@
 package model
 package model
 
 
 import (
 import (
-	"context"
 	"encoding/json"
 	"encoding/json"
 	"fmt"
 	"fmt"
 	IC "jyBXSubscribe/rpc/init"
 	IC "jyBXSubscribe/rpc/init"
@@ -16,11 +15,11 @@ import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/esv1"
+	elastic "app.yhyue.com/moapp/jybase/es"
+	P "app.yhyue.com/moapp/jybase/mapping"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jybase/redis"
-	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
 	"go.mongodb.org/mongo-driver/bson/primitive"
 	"go.mongodb.org/mongo-driver/bson/primitive"
 )
 )
@@ -36,21 +35,19 @@ const (
 	MemberFlag   = "mType"
 	MemberFlag   = "mType"
 	EntnicheFlag = "eType"
 	EntnicheFlag = "eType"
 	oneDay       = 24 * 60 * 60
 	oneDay       = 24 * 60 * 60
-	Baseinfo     = "global_common_data.dws_f_bid_baseinfo"
-	BidTags      = "global_common_data.dws_f_bid_tags"
 )
 )
 
 
 var (
 var (
-	ennicheInsertCollKey   = []string{"entid", "deptid", "userid", "infoid", "matchkeys", "date", "source", "product"}
-	subscribeInsertCollKey = []string{"userid", "infoid", "matchkeys", "date", "isvip"}
-	memberInsertCollKey    = []string{"userid", "infoid", "matchkeys", "date"}
+	ennicheInsertCollKey   = []string{"infoid", "matchkeys", "date", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count", "userid", "entid", "deptid", "source", "product"}
+	subscribeInsertCollKey = []string{"infoid", "matchkeys", "date", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count", "userid", "isvip"}
+	memberInsertCollKey    = []string{"infoid", "matchkeys", "date", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count", "userid"}
 )
 )
 
 
 var aboutDbMsg map[string]*AboutDbMsg = map[string]*AboutDbMsg{
 var aboutDbMsg map[string]*AboutDbMsg = map[string]*AboutDbMsg{
-	SubFreeFlag:  &AboutDbMsg{"pushsubscribe", "subpush"},
-	SubVipFlag:   &AboutDbMsg{"pushsubscribe", "subpush"},
-	MemberFlag:   &AboutDbMsg{"pushmember", "memberpush"},
-	EntnicheFlag: &AboutDbMsg{"pushentniche", "entnichepush"},
+	SubFreeFlag:  &AboutDbMsg{"push.pushsubscribe", "subpush"},
+	SubVipFlag:   &AboutDbMsg{"push.pushsubscribe", "subpush"},
+	MemberFlag:   &AboutDbMsg{"push.pushmember", "memberpush"},
+	EntnicheFlag: &AboutDbMsg{"push.pushentniche", "entnichepush"},
 }
 }
 
 
 type AboutDbMsg struct {
 type AboutDbMsg struct {
@@ -391,20 +388,14 @@ 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) {
 func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
 	querys := []string{}
 	querys := []string{}
 	userStr := " "
 	userStr := " "
-	leftJoinStr := " "
 	var (
 	var (
 		countSql, findSql string
 		countSql, findSql string
 	)
 	)
-	codeMap, err := IC.CodeLib.CodeTransformation(context.Background(), &codeservice.Request{})
-	if codeMap.Data == nil || err != nil {
-		logx.Error("代码表获取失败")
-		return result, count
-	}
 	querys = append(querys, " 1=1 ")
 	querys = append(querys, " 1=1 ")
 	if spqp.SelectInfoIds != nil && len(spqp.SelectInfoIds) > 0 {
 	if spqp.SelectInfoIds != nil && len(spqp.SelectInfoIds) > 0 {
-		countSql = fmt.Sprintf("select count(1) as count from %s a LEFT JOIN %s b ON a.infoid = b.infoid where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
+		countSql = fmt.Sprintf("select count(1) as count from %s a  where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
 		logx.Info("countSql", countSql)
 		logx.Info("countSql", countSql)
-		findSql = fmt.Sprintf("select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count from %s a LEFT JOIN %s b ON a.infoid = b.infoid where %s order by a.date desc,a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
+		findSql = fmt.Sprintf("select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,a.attachment_count from %s a  where %s order by a.date desc,a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
 		//查询总数
 		//查询总数
 		count = spqp.BaseServiceMysql.CountBySql(countSql)
 		count = spqp.BaseServiceMysql.CountBySql(countSql)
 	} else {
 	} else {
@@ -422,8 +413,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			//城市
 			//城市
 			city := []string{}
 			city := []string{}
 			for _, v := range strings.Split(spqp.City, ",") {
 			for _, v := range strings.Split(spqp.City, ",") {
-				if codeMap.Data.City[v] != "" {
-					city = append(city, fmt.Sprint(codeMap.Data.City[v]))
+				if P.BidCodeMapping.City[v] != "" {
+					city = append(city, fmt.Sprint(P.BidCodeMapping.City[v]))
 				} else {
 				} else {
 					city = append(city, "-1")
 					city = append(city, "-1")
 				}
 				}
@@ -432,14 +423,14 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				city = append(city, "9999")
 				city = append(city, "9999")
 			}
 			}
 			if len(city) > 0 {
 			if len(city) > 0 {
-				sqlAreaCity = fmt.Sprintf("b.city_code in (%s)", strings.Join(city, ","))
+				sqlAreaCity = fmt.Sprintf("city in (%s)", strings.Join(city, ","))
 			}
 			}
 			//区域
 			//区域
 			var sqlArea = ""
 			var sqlArea = ""
 			area := []string{}
 			area := []string{}
 			for _, v := range strings.Split(spqp.Area, ",") {
 			for _, v := range strings.Split(spqp.Area, ",") {
-				if codeMap.Data.Area[v] != "" {
-					area = append(area, fmt.Sprint(codeMap.Data.Area[v]))
+				if P.BidCodeMapping.Area[v] != "" {
+					area = append(area, fmt.Sprint(P.BidCodeMapping.Area[v]))
 				} else {
 				} else {
 					area = append(area, "-1")
 					area = append(area, "-1")
 				}
 				}
@@ -448,7 +439,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				area = append(area, "9999")
 				area = append(area, "9999")
 			}
 			}
 			if len(area) > 0 {
 			if len(area) > 0 {
-				sqlArea = fmt.Sprintf("b.area_code in (%s)", strings.Join(area, ","))
+				sqlArea = fmt.Sprintf("a.area in (%s)", strings.Join(area, ","))
 			}
 			}
 			if sqlAreaCity != "" && sqlArea != "" {
 			if sqlAreaCity != "" && sqlArea != "" {
 				sqlAreaCity = "( " + sqlAreaCity + " or " + sqlArea + " )"
 				sqlAreaCity = "( " + sqlAreaCity + " or " + sqlArea + " )"
@@ -463,15 +454,15 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		if spqp.Buyerclass != "" {
 		if spqp.Buyerclass != "" {
 			buyerclass := []string{}
 			buyerclass := []string{}
 			for _, v := range strings.Split(spqp.Buyerclass, ",") {
 			for _, v := range strings.Split(spqp.Buyerclass, ",") {
-				if codeMap.Data.Buyerclass[v] != "" {
-					buyerclass = append(buyerclass, fmt.Sprint(codeMap.Data.Buyerclass[v]))
+				if fmt.Sprint(P.BidCodeMapping.Buyerclass[v]) != "" {
+					buyerclass = append(buyerclass, fmt.Sprint(P.BidCodeMapping.Buyerclass[v]))
 				}
 				}
 			}
 			}
 			if len(buyerclass) == 1 {
 			if len(buyerclass) == 1 {
 				buyerclass = append(buyerclass, "9999")
 				buyerclass = append(buyerclass, "9999")
 			}
 			}
 			if len(buyerclass) > 0 {
 			if len(buyerclass) > 0 {
-				querys = append(querys, fmt.Sprintf("b.buyerclass_code in (%s)", strings.Join(buyerclass, ",")))
+				querys = append(querys, fmt.Sprintf("a.buyerclass in (%s)", strings.Join(buyerclass, ",")))
 			}
 			}
 
 
 		}
 		}
@@ -479,28 +470,25 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		if spqp.Subtype != "" {
 		if spqp.Subtype != "" {
 			subtype := []string{}
 			subtype := []string{}
 			for _, v := range strings.Split(spqp.Subtype, ",") {
 			for _, v := range strings.Split(spqp.Subtype, ",") {
-				if codeMap.Data.Subtype[v] != "" {
-					subtype = append(subtype, fmt.Sprint(codeMap.Data.Subtype[v]))
-				}
+				subtype = append(subtype, P.BidCodeMapping.Subtype[v])
 			}
 			}
 			if len(subtype) == 1 {
 			if len(subtype) == 1 {
 				subtype = append(subtype, "9999")
 				subtype = append(subtype, "9999")
 			}
 			}
 			if len(subtype) > 0 {
 			if len(subtype) > 0 {
-				querys = append(querys, fmt.Sprintf("b.subtype_code in (%s)", strings.Join(subtype, ",")))
+				querys = append(querys, fmt.Sprintf("subtype in (%s)", strings.Join(subtype, ",")))
 			}
 			}
 		}
 		}
 		//信息行业
 		//信息行业
 		if spqp.Subscopeclass != "" {
 		if spqp.Subscopeclass != "" {
 			find_in_set := []string{}
 			find_in_set := []string{}
 			for _, v := range strings.Split(spqp.Subscopeclass, ",") {
 			for _, v := range strings.Split(spqp.Subscopeclass, ",") {
-				if codeMap.Data.Subscopeclass[v] != "" {
-					find_in_set = append(find_in_set, codeMap.Data.Subscopeclass[v])
-				}
+				find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',a.subscopeclass)", P.BidCodeMapping.Subscopeclass[v]))
 			}
 			}
-			if len(find_in_set) > 0 {
-				leftJoinStr = fmt.Sprintf(" STRAIGHT_JOIN %s t on t.infoid = b.infoid and t.labelcode=2 ", BidTags)
-				querys = append(querys, fmt.Sprintf(" t.labelvalues in (%s)", strings.Join(find_in_set, ",")))
+			if len(find_in_set) == 1 {
+				querys = append(querys, find_in_set[0])
+			} else if len(find_in_set) > 1 {
+				querys = append(querys, fmt.Sprintf("(%s)", strings.Join(find_in_set, " or ")))
 			}
 			}
 		}
 		}
 		//关键词
 		//关键词
@@ -521,19 +509,19 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			minPrice := common.Int64All(common.Float64All(minPriceStr) * 10000) //换成元
 			minPrice := common.Int64All(common.Float64All(minPriceStr) * 10000) //换成元
 			maxPrice := common.Int64All(common.Float64All(maxPriceStr) * 10000) //换成元
 			maxPrice := common.Int64All(common.Float64All(maxPriceStr) * 10000) //换成元
 			if minPriceStr != "" && maxPriceStr != "" {
 			if minPriceStr != "" && maxPriceStr != "" {
-				querys = append(querys, fmt.Sprintf("((b.bidamount>=%d and b.bidamount<=%d) or (b.budget>=%d and b.budget<=%d and b.bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
+				querys = append(querys, fmt.Sprintf("((a.bidamount>=%d and a.bidamount<=%d) or (a.budget>=%d and a.budget<=%d and a.bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
 			} else if minPriceStr != "" {
 			} else if minPriceStr != "" {
-				querys = append(querys, fmt.Sprintf("(b.bidamount>=%d  or (b.budget>=%d and b.bidamount is null))", minPrice, minPrice))
+				querys = append(querys, fmt.Sprintf("(a.bidamount>=%d  or (a.budget>=%d and a.bidamount is null))", minPrice, minPrice))
 			} else if maxPriceStr != "" {
 			} else if maxPriceStr != "" {
-				querys = append(querys, fmt.Sprintf("(b.bidamount<=%d or (b.budget<=%d and b.bidamount is null))", maxPrice, maxPrice))
+				querys = append(querys, fmt.Sprintf("(a.bidamount<=%d or (a.budget<=%d and a.bidamount is null))", maxPrice, maxPrice))
 			}
 			}
 		}
 		}
 		//附件
 		//附件
 		if spqp.FileExists != "" {
 		if spqp.FileExists != "" {
 			if spqp.FileExists == "1" {
 			if spqp.FileExists == "1" {
-				querys = append(querys, fmt.Sprintf("b.isvalidfile =1 "))
+				querys = append(querys, fmt.Sprintf("a.attachment_count is not null"))
 			} else if spqp.FileExists == "-1" {
 			} else if spqp.FileExists == "-1" {
-				querys = append(querys, fmt.Sprintf("b.isvalidfile =0 "))
+				querys = append(querys, fmt.Sprintf("a.attachment_count is null"))
 			}
 			}
 		}
 		}
 		// 是否已读
 		// 是否已读
@@ -579,39 +567,54 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			} else if len(spqp.Staffs) > 0 {
 			} else if len(spqp.Staffs) > 0 {
 				staffs = spqp.Staffs
 				staffs = spqp.Staffs
 			}
 			}
-			// 空查询优化,不走关联表计算数量
-			if len(querys) == 1 {
-				countSql = fmt.Sprintf("select count(1) from %s a  %s where 1=1 %s ", aboutDbMsg[s.ModuleFlag].MysqlTable, leftJoinStr, userStr)
+			//老板商机管理需要查询全部来源
+			isNew := true
+			//商机管理判断
+			newCount := IC.MainMysql.CountBySql("select  count(id) from  entniche_info where  id =? and  isNew != 1 and  status=1", spqp.EntId)
+			if newCount > 0 {
+				isNew = false
+			}
+			// 无查询分配人员、是否已读
+			if spqp.IsRead == "" && len(staffs) == 0 {
+				//查询数量(需要去重)
+				countSql = fmt.Sprintf("select count(1) from %s a    where %s %s %s", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""))
 				//列表查询
 				//列表查询
-				findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,b.isvalidfile as attachment_count, IF(a.source is NULL,1,a.source) as  source  from %s a LEFT JOIN %s b ON a.infoid = b.infoid  %s where 1=1 %s  order by a.date desc,a.id desc",
-					aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, userStr)
+				findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,a.attachment_count from %s a  where  %s %s %s order by a.date desc,a.id desc",
+					aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""))
 			} else {
 			} else {
-				// 无查询分配人员、是否已读
-				if spqp.IsRead == "" && len(staffs) == 0 {
-					//查询数量(需要去重)
-					countSql = fmt.Sprintf("select count(1) from %s a STRAIGHT_JOIN %s b ON  a.infoid = b.infoid  %s where %s %s ", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr)
-					//列表查询
-					findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,b.isvalidfile as attachment_count, IF(a.source is NULL,1,a.source) as  source  from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid  %s where  %s %s order by a.date desc,a.id desc",
-						aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr)
-				} else {
-					//查询分配人员或是否已读
-					staffQuery := " 1=1 "
-					if len(staffs) > 0 {
-						staffQuery += fmt.Sprintf(" and  a.userid in ('%s')  ", strings.Join(staffs, "','"))
-					}
-					if spqp.IsRead != "" {
-						if spqp.IsRead == "0" {
-							staffQuery += " and a.isvisit IS NULL"
-						} else if spqp.IsRead == "1" {
-							staffQuery += " and a.isvisit=1"
-						}
+				//查询分配人员或是否已读
+				staffQuery := " 1=1 "
+				if len(staffs) > 0 {
+					staffQuery += fmt.Sprintf(" and  a.userid in ('%s')  ", strings.Join(staffs, "','"))
+				}
+				if spqp.IsRead != "" {
+					if spqp.IsRead == "0" {
+						staffQuery += " and a.isvisit IS NULL"
+					} else if spqp.IsRead == "1" {
+						staffQuery += " and a.isvisit=1"
 					}
 					}
-					countSql = fmt.Sprintf("select count(1) from %s a STRAIGHT_JOIN %s b ON  a.infoid = b.infoid  %s where %s %s and %s ", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr, staffQuery)
-					//列表查询
-					findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,b.isvalidfile as attachment_count,IF(a.source is NULL,1,a.source) as  source from %s a STRAIGHT_JOIN %s b ON  a.infoid = b.infoid  %s where %s %s and %s order by a.date desc,a.id desc ", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr, staffQuery)
 				}
 				}
+				//countSql = fmt.Sprintf("select count(1) from %s a  where %s %s and ((%s) or EXISTS (SELECT 1 from %s c  WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) ", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
+				countSql = fmt.Sprintf("select count(1) from %s a  where %s %s and %s ", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, staffQuery)
+
+				//列表查询
+				//findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,a.attachment_count from %s a where %s %s %s and ((%s) or EXISTS (SELECT 1 from %s c  WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) order by a.date desc,a.id desc ", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
+				findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,a.attachment_count,IF(a.source is NULL,1,a.source) as  source from %s a  where %s %s and %s order by a.date desc,a.id desc ", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, staffQuery)
+
 			}
 			}
 		} else {
 		} else {
+			// 是否已读
+			if spqp.IsRead != "" {
+				if spqp.IsRead == "0" {
+					userStr += " and a.isvisit IS NULL"
+				} else if spqp.IsRead == "1" {
+					userStr += " and a.isvisit=1"
+				}
+			}
+			// 信息来源
+			if spqp.Source == "1" || spqp.Source == "2" || spqp.Source == "3" {
+				userStr += " and a.source=" + spqp.Source
+			}
 			if spqp.PositionType == 1 {
 			if spqp.PositionType == 1 {
 				//企业主体是企业的个人查询
 				//企业主体是企业的个人查询
 				if spqp.UserType == SubVipFlag {
 				if spqp.UserType == SubVipFlag {
@@ -633,17 +636,17 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				}
 				}
 			}
 			}
 			//查询数量
 			//查询数量
-			countSql = fmt.Sprintf("select count(1) as count from %s  a STRAIGHT_JOIN %s b ON a.infoid = b.infoid  %s where 1=1 %s and %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, userStr, strings.Join(querys, " and "))
+			countSql = fmt.Sprintf("select count(1) as count from %s  a  where 1=1 %s and %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, strings.Join(querys, " and "))
 			//列表查询语句
 			//列表查询语句
-			findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
+			findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,a.attachment_count"
 			if s.ModuleFlag == EntnicheFlag {
 			if s.ModuleFlag == EntnicheFlag {
 				findSql += ", IF(a.source is NULL,1,a.source) as  source "
 				findSql += ", IF(a.source is NULL,1,a.source) as  source "
 			}
 			}
 			if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
 			if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
 				findSql += ",a.isvip"
 				findSql += ",a.isvip"
 			}
 			}
-			findSql = fmt.Sprintf("%s from %s  a STRAIGHT_JOIN %s b ON 1=1 %s and a.infoid = b.infoid  %s where %s"+
-				" order by a.date desc,a.id desc", findSql, aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, userStr, leftJoinStr, strings.Join(querys, " and "))
+			findSql = fmt.Sprintf("%s from %s  a  where  %s %s "+
+				" order by a.date desc,a.id desc", findSql, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr)
 		}
 		}
 		//查询总数
 		//查询总数
 		logx.Info("countSql", countSql)
 		logx.Info("countSql", countSql)
@@ -923,6 +926,7 @@ func (s *subscribePush) SetRead(newUserId, id int64, userId, entUserId, entId st
 	if isEnt {
 	if isEnt {
 		if s.ModuleFlag == EntnicheFlag {
 		if s.ModuleFlag == EntnicheFlag {
 			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 ,visittime=now() where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
 			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 ,visittime=now() where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
+
 		} else {
 		} else {
 			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
 			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
 
 
@@ -1056,7 +1060,6 @@ func (s *subscribePush) DefaultDatas(spqp *SubPushQueryParam) (hasNextPage bool,
 
 
 // 保存推送表
 // 保存推送表
 func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]interface{}, keyword []ViewKeyWord) (resultList []*bxsubscribe.SubscribeInfo) {
 func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]interface{}, keyword []ViewKeyWord) (resultList []*bxsubscribe.SubscribeInfo) {
-	t2 := time.Now()
 	now := time.Now().Unix()
 	now := time.Now().Unix()
 	length := len(list)
 	length := len(list)
 	resultList = make([]*bxsubscribe.SubscribeInfo, length)
 	resultList = make([]*bxsubscribe.SubscribeInfo, length)
@@ -1073,19 +1076,45 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
 		infoid := common.InterfaceToStr(v["_id"])
 		infoid := common.InterfaceToStr(v["_id"])
 		matchkeys := getKeys(title, keyword)
 		matchkeys := getKeys(title, keyword)
 		matchkey := strings.Join(matchkeys, " ")
 		matchkey := strings.Join(matchkeys, " ")
+		subscopeclassStr := ""
+		area := common.If(v["area"] == nil, nil, common.If(common.ObjToString(v["area"]) == "A", 0, common.If(P.BidCodeMapping.Area[common.ObjToString(v["area"])] != "", P.BidCodeMapping.Area[common.ObjToString(v["area"])], 0)))
+		city := common.If(P.BidCodeMapping.City[common.ObjToString(v["city"])] != "", nil, P.BidCodeMapping.City[common.ObjToString(v["city"])])
+		subtype := common.If(P.BidCodeMapping.Subtype[common.ObjToString(v["subtype"])] != "", nil, P.BidCodeMapping.Subtype[common.ObjToString(v["subtype"])])
+		toptype := common.If(P.BidCodeMapping.Toptype[common.ObjToString(v["toptype"])] != "", nil, P.BidCodeMapping.Toptype[common.ObjToString(v["toptype"])])
+		buyerclass := common.If(P.BidCodeMapping.Buyerclass[common.ObjToString(v["buyerclass"])] != "", nil, P.BidCodeMapping.Buyerclass[common.ObjToString(v["buyerclass"])])
+		attachment_count := 0
+		if v["isValidFile"] != nil {
+			isValidFile, _ := v["isValidFile"].(bool)
+			attachment_count = common.If(isValidFile, 1, 0).(int)
+		}
+		bidamount := common.If(v["bidamount"] == nil, nil, v["bidamount"])
+		budget := common.If(v["budget"] == nil, nil, 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 := P.BidCodeMapping.Subscopeclass[v]; ok {
+					subscopeclass = append(subscopeclass, fmt.Sprint(subscopeclass_mapping))
+				}
+			}
+			if len(subscopeclass) > 0 {
+				subscopeclassStr = strings.Join(subscopeclass, ",")
+			}
+		}
 		redisKey := fmt.Sprintf("pushinfo_%s_%s", spqp.UserId, common.ObjToString(v["_id"]))
 		redisKey := fmt.Sprintf("pushinfo_%s_%s", spqp.UserId, common.ObjToString(v["_id"]))
 		entid := spqp.EntId
 		entid := spqp.EntId
 		entUserId := spqp.EntUserId
 		entUserId := spqp.EntUserId
 		deptid := spqp.DeptId
 		deptid := spqp.DeptId
+		//公共字段处理
+		pushInsert = append(pushInsert, common.InterfaceToStr(infoid), matchkey, now, area, city, buyerclass, toptype, subtype, subscopeclassStr, budget, bidamount, attachment_count)
 		switch s.ModuleFlag {
 		switch s.ModuleFlag {
 		case EntnicheFlag:
 		case EntnicheFlag:
-			pushInsert = append(pushInsert, entid, deptid, entUserId, common.InterfaceToStr(infoid), matchkey, now, 1, product)
+			pushInsert = append(pushInsert, entid, deptid, entUserId, 1, product)
 		case MemberFlag:
 		case MemberFlag:
-			pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now)
+			pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId))
 		case SubVipFlag:
 		case SubVipFlag:
-			pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 1)
+			pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), 1)
 		case SubFreeFlag:
 		case SubFreeFlag:
-			pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 0)
+			pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), 0)
 		}
 		}
 		redis.Put("pushcache_2_a", redisKey, 1, 86400)
 		redis.Put("pushcache_2_a", redisKey, 1, 86400)
 		resultList[i] = s.InfoFormat(&PushCa{
 		resultList[i] = s.InfoFormat(&PushCa{
@@ -1108,7 +1137,6 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
 		resultList[i].CaIndex = id
 		resultList[i].CaIndex = id
 		id++
 		id++
 	}
 	}
-	logx.Info("数据处理耗时:", time.Since(t2))
 	return
 	return
 }
 }
 
 
@@ -1487,7 +1515,6 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
 			return MapToarr(keyData)
 			return MapToarr(keyData)
 		}
 		}
 		for _, ruleV := range *res_ {
 		for _, ruleV := range *res_ {
-
 			o_entniche = common.StructToMapMore(ruleV["o_entniche"])
 			o_entniche = common.StructToMapMore(ruleV["o_entniche"])
 			if o_entniche["a_items"] != nil {
 			if o_entniche["a_items"] != nil {
 				a_item := common.ObjArrToMapArr(o_entniche["a_items"].([]interface{}))
 				a_item := common.ObjArrToMapArr(o_entniche["a_items"].([]interface{}))

+ 9 - 35
jyBXSubscribe/rpc/model/service/matchjob.go

@@ -2,15 +2,12 @@ package service
 
 
 import (
 import (
 	util "app.yhyue.com/moapp/jybase/common"
 	util "app.yhyue.com/moapp/jybase/common"
-	. "app.yhyue.com/moapp/jybase/mongodb"
-	"app.yhyue.com/moapp/jybase/mysql"
+	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
 	IC "jyBXSubscribe/rpc/init"
 	IC "jyBXSubscribe/rpc/init"
+	"log"
 )
 )
 
 
-var Mysql *mysql.Mysql
-var Mgo *MongodbSim
-
 //用户基本信息
 //用户基本信息
 type UserInfo struct {
 type UserInfo struct {
 	Entniche *Entniche
 	Entniche *Entniche
@@ -40,8 +37,8 @@ func (m *MatchJob) Start(entId, entUserId int) (map[string]interface{}, int) {
 func (m *MatchJob) LoadSubSet(entId int) map[*UserInfo]bool {
 func (m *MatchJob) LoadSubSet(entId int) map[*UserInfo]bool {
 	defer util.Catch()
 	defer util.Catch()
 	Users := map[*UserInfo]bool{}
 	Users := map[*UserInfo]bool{}
-	sess := Mgo.GetMgoConn()
-	defer Mgo.DestoryMongoConn(sess)
+	sess := IC.Mgo.GetMgoConn()
+	defer IC.Mgo.DestoryMongoConn(sess)
 	it := sess.DB("qfw").C("entniche_rule").Find(map[string]interface{}{
 	it := sess.DB("qfw").C("entniche_rule").Find(map[string]interface{}{
 		"i_entid": entId,
 		"i_entid": entId,
 	}).Select(map[string]interface{}{
 	}).Select(map[string]interface{}{
@@ -50,18 +47,17 @@ func (m *MatchJob) LoadSubSet(entId int) map[*UserInfo]bool {
 		"i_userid":   1,
 		"i_userid":   1,
 		"o_entniche": 1,
 		"o_entniche": 1,
 	}).Iter()
 	}).Iter()
+	log.Println("it", it)
 	for _temp := make(map[string]interface{}); it.Next(&_temp); {
 	for _temp := make(map[string]interface{}); it.Next(&_temp); {
 		func(temp map[string]interface{}) {
 		func(temp map[string]interface{}) {
+			log.Println("temp", temp)
 			entId := util.IntAll(temp["i_entid"])
 			entId := util.IntAll(temp["i_entid"])
 			deptId := util.IntAll(temp["i_deptid"])
 			deptId := util.IntAll(temp["i_deptid"])
 			userId := util.IntAll(temp["i_userid"])
 			userId := util.IntAll(temp["i_userid"])
 			if entId == 0 || (deptId == 0 && userId == 0) {
 			if entId == 0 || (deptId == 0 && userId == 0) {
 				return
 				return
-			} else if Ents[entId] == nil {
-				logx.Info("没有找到该企业", entId)
-				return
 			}
 			}
-			entName := Ents[entId].Name
+			entName := fmt.Sprint(entId)
 			if deptId > 0 && EntDepts[deptId] == nil {
 			if deptId > 0 && EntDepts[deptId] == nil {
 				logx.Info("没有找到该部门", entName, entId, deptId)
 				logx.Info("没有找到该部门", entName, entId, deptId)
 				return
 				return
@@ -77,13 +73,7 @@ func (m *MatchJob) LoadSubSet(entId int) map[*UserInfo]bool {
 			}
 			}
 			//
 			//
 			if deptId > 0 { //部门订阅
 			if deptId > 0 { //部门订阅
-				if Ents[entId].Model != 1 {
-					logx.Info("不是统一订阅模式,过滤掉", entName, entId, deptName, deptId)
-					return
-				} else if EntDepts[deptId] == nil {
-					logx.Info("没有找到该部门,过滤掉", entName, entId, deptName, deptId)
-					return
-				} else if EntDepts[deptId].Subdis == 0 {
+				if EntDepts[deptId].Subdis == 0 {
 					logx.Info("该部门的订阅分发没有开启,过滤掉", entName, entId, deptName, deptId)
 					logx.Info("该部门的订阅分发没有开启,过滤掉", entName, entId, deptName, deptId)
 					return
 					return
 				} else if EntDepts[deptId].Nodiff == 0 && EntDeptDis[deptId] == nil {
 				} else if EntDepts[deptId].Nodiff == 0 && EntDeptDis[deptId] == nil {
@@ -98,15 +88,9 @@ func (m *MatchJob) LoadSubSet(entId int) map[*UserInfo]bool {
 					}
 					}
 				}
 				}
 			} else if userId > 0 { //个人订阅
 			} else if userId > 0 { //个人订阅
-				if Ents[entId].Model != 2 {
-					logx.Info("不是个人订阅模式,过滤掉", entName, entId, userId)
-					return
-				} else if EntUsers[userId] == nil {
+				if EntUsers[userId] == nil {
 					logx.Info("没有找到该用户,过滤掉", entName, entId, userId)
 					logx.Info("没有找到该用户,过滤掉", entName, entId, userId)
 					return
 					return
-				} else if EntUsers[userId].Power == 0 {
-					logx.Info("该用户没有权限,过滤掉", entName, entId, userId)
-					return
 				}
 				}
 			}
 			}
 			user := &UserInfo{
 			user := &UserInfo{
@@ -121,17 +105,7 @@ func (m *MatchJob) LoadSubSet(entId int) map[*UserInfo]bool {
 			}
 			}
 			logx.Info("加载订阅设置", "entId", entId, "entName", entName, "deptId", deptId, "deptName", deptName, "userId", userId)
 			logx.Info("加载订阅设置", "entId", entId, "entName", entName, "deptId", deptId, "deptName", deptName, "userId", userId)
 			Users[user] = true
 			Users[user] = true
-			if deptId <= 0 {
-				return
-			}
 			//分发规则
 			//分发规则
-			if EntDepts[deptId].Nodiff == 1 {
-				logx.Info("该部门开启了全员无差别,分发规则无效", entName, entId, deptName, deptId)
-				return
-			} else if EntDeptDis[deptId] == nil {
-				logx.Info("该部门没有分发规则", entName, entId, deptName, deptId)
-				return
-			}
 			itemMap := map[string]interface{}{}
 			itemMap := map[string]interface{}{}
 			items, _ := subSet["a_items"].([]interface{})
 			items, _ := subSet["a_items"].([]interface{})
 			for _, v := range items {
 			for _, v := range items {

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно