main.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package main
  2. import (
  3. "data_tidb/config"
  4. "github.com/spf13/cobra"
  5. "jygit.jydev.jianyu360.cn/data_processing/common_utils/log"
  6. "jygit.jydev.jianyu360.cn/data_processing/common_utils/udp"
  7. )
  8. var (
  9. UdpClient udp.UdpClient
  10. )
  11. func init() {
  12. config.Init("./common.toml")
  13. InitLog()
  14. InitMgo()
  15. InitMysql()
  16. InitField()
  17. //InitOss(false)
  18. //redis.InitRedis1("qyxy_id=127.0.0.1:8379", 1)
  19. //redis.InitRedis1("qyxy_id=192.168.3.166:4379", 1)
  20. log.Info("init success")
  21. //启动 nohup ./MTB bidding &
  22. }
  23. func main() {
  24. //go SaveFunc()
  25. //go SaveExpandFunc()
  26. //go SaveDetailFunc()
  27. //go SaveAttrFunc()
  28. //go SaveIntentFunc()
  29. //go SaveBidderFunc()
  30. //go SaveGoodsFunc()
  31. //go saveErrMethod()
  32. taskB()
  33. //rootCmd := &cobra.Command{Use: "my cmd"}
  34. //rootCmd.AddCommand(bidding())
  35. //rootCmd.AddCommand(project())
  36. //rootCmd.AddCommand(projectAdd())
  37. //if err := rootCmd.Execute(); err != nil {
  38. // fmt.Println("rootCmd.Execute failed", err.Error())
  39. //}
  40. //UdpClient = udp.UdpClient{Local: config.Conf.Udp.LocPort, BufSize: 1024}
  41. //UdpClient.Listen(processUdpMsg)
  42. //log.Info("Udp服务监听", zap.String("port:", config.Conf.Udp.LocPort))
  43. c := make(chan bool, 1)
  44. <-c
  45. }
  46. // @Description 标讯数据
  47. // @Author J 2022/9/20 17:52
  48. func bidding() *cobra.Command {
  49. cmdClient := &cobra.Command{
  50. Use: "bidding",
  51. Short: "Start processing bidding data",
  52. Run: func(cmd *cobra.Command, args []string) {
  53. //go SaveFunc()
  54. //go SaveTagFunc()
  55. //go SaveExpandFunc()
  56. //go SaveAttrFunc()
  57. //go SaveImfFunc()
  58. //go SaveIntentFunc()
  59. //go SaveWinnerFunc()
  60. //go SavePackageFunc()
  61. //go SavePurFunc()
  62. //go saveErrMethod()
  63. taskB()
  64. },
  65. }
  66. //cmdClient.Flags().StringVarP(&cfg, "conf", "c", "", "server config [toml]")
  67. return cmdClient
  68. }
  69. // @Description 项目数据
  70. // @Author J 2022/9/20 17:52
  71. func project() *cobra.Command {
  72. cmdClient := &cobra.Command{
  73. Use: "project",
  74. Short: "Start processing project data",
  75. Run: func(cmd *cobra.Command, args []string) {
  76. //go SaveProFunc()
  77. //go SaveProTagFunc()
  78. //go SaveProbFunc()
  79. //go SaveRelationFunc()
  80. taskP()
  81. },
  82. }
  83. //cmdClient.Flags().StringVarP(&cfg, "conf", "c", "", "server config [toml]")
  84. return cmdClient
  85. }
  86. // @Description 项目数据
  87. // @Author J 2022/9/20 17:52
  88. func projectAdd() *cobra.Command {
  89. var pici int64
  90. cmdClient := &cobra.Command{
  91. Use: "project",
  92. Short: "Start processing project data",
  93. Run: func(cmd *cobra.Command, args []string) {
  94. //go SaveProFunc()
  95. //go SaveProTagFunc()
  96. //go SaveProbFunc()
  97. go SaveRelationFunc()
  98. taskPAdd(pici)
  99. },
  100. }
  101. cmdClient.Flags().Int64VarP(&pici, "pici", "p", 0, "")
  102. return cmdClient
  103. }