biservice.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Code generated by goctl. DO NOT EDIT!
  2. // Source: biService.proto
  3. package main
  4. import (
  5. "bp.jydev.jianyu360.cn/BaseService/biService/entity"
  6. IC "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/config"
  7. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/server"
  8. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
  9. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
  10. "flag"
  11. "fmt"
  12. "github.com/zeromicro/go-zero/core/conf"
  13. "github.com/zeromicro/go-zero/core/logx"
  14. "github.com/zeromicro/go-zero/zrpc"
  15. "google.golang.org/grpc"
  16. )
  17. var configFile = flag.String("f", "etc/biservice.yaml", "the config file")
  18. func main() {
  19. flag.Parse()
  20. conf.MustLoad(*configFile, &IC.IC)
  21. ctx := svc.NewServiceContext(IC.IC)
  22. srv := server.NewBiServiceServer(ctx)
  23. logx.MustSetup(IC.IC.Logx)
  24. entity.PublicKey = IC.IC.PublicKey
  25. entity.InitMysql(IC.IC.Mysql.JianYu, IC.IC.Mysql.JyDoc, IC.IC.Mysql.Bi, IC.IC.Mysql.Tidb, IC.IC.Mysql.BiTidb, IC.IC.Mysql.CallTidb, IC.IC.Mysql.BiService, IC.IC.Mysql.WorkOrder)
  26. entity.InitMail(IC.IC.Mail)
  27. entity.InitMongo(IC.IC.Mongo.Qfw.MongodbAddr, IC.IC.Mongo.Qfw.DbName, IC.IC.Mongo.Qfw.Size)
  28. entity.InitBiddingMgo(IC.IC.Mongo.Bidding.MongodbAddr, IC.IC.Mongo.Bidding.DbName, IC.IC.Mongo.Bidding.UserName, IC.IC.Mongo.Bidding.Password, IC.IC.Mongo.Bidding.Size)
  29. entity.InitQyxyMgo(IC.IC.Mongo.Qyxy.MongodbAddr, IC.IC.Mongo.Qyxy.DbName, IC.IC.Mongo.Qyxy.UserName, IC.IC.Mongo.Qyxy.Password, IC.IC.Mongo.Qyxy.Size)
  30. entity.InitEs(IC.IC.Es.Version, IC.IC.Es.Address, IC.IC.Es.UserName, IC.IC.Es.Password, IC.IC.Es.DbSize)
  31. entity.InitEntEs(IC.IC.EntEs.Version, IC.IC.EntEs.Address, IC.IC.EntEs.UserName, IC.IC.EntEs.Password, IC.IC.EntEs.DbSize)
  32. entity.InitArea()
  33. entity.InitRedis(IC.IC.RedisAddress)
  34. entity.InitConfig(IC.IC.ExportDirectory, IC.IC.ComFileDir, IC.IC.UpdateProjectUrl, IC.IC.ExportUrl, IC.IC.ComFileUrl, IC.IC.ExportCount)
  35. //合力亿捷
  36. entity.GetHlyj(IC.IC.Hlyj.Appid, IC.IC.Hlyj.Account, IC.IC.Hlyj.Secret, IC.IC.Hlyj.TokenUrl, IC.IC.Hlyj.CallUrl, IC.IC.Hlyj.Integratedid, IC.IC.Hlyj.CallFlag)
  37. entity.InitMiddleground(IC.IC.RpcServerConf.Etcd.Hosts, IC.IC.ResourceCenterKey)
  38. /*entity.FileCenterRpc = filecenter.NewFileCenter(zrpc.MustNewClient(IC.IC.FileCenterRpc))
  39. entity.OssBucketName = IC.IC.OssBucketName
  40. entity.OssUrl = IC.IC.OssUrl
  41. //nsq
  42. config := nsq.NewConfig()
  43. consumer, err := nsq.NewConsumer(IC.IC.TopicName, "jy_position_sync", config)
  44. if err != nil {
  45. fmt.Println(err)
  46. }
  47. consumer.AddHandler(&entity.Handler{})
  48. err = consumer.ConnectToNSQLookupd(IC.IC.NsqUrl)
  49. if err != nil {
  50. fmt.Println(err)
  51. }*/
  52. s := zrpc.MustNewServer(IC.IC.RpcServerConf, func(grpcServer *grpc.Server) {
  53. pb.RegisterBiServiceServer(grpcServer, srv)
  54. })
  55. defer s.Stop()
  56. fmt.Printf("Starting rpc server at %s...\n", IC.IC.ListenOn)
  57. s.Start()
  58. }