bugly.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package main
  2. import (
  3. "context"
  4. "flag"
  5. "go-common/app/service/ep/footman/conf"
  6. "go-common/app/service/ep/footman/service"
  7. "go-common/library/cache/memcache"
  8. "go-common/library/container/pool"
  9. "go-common/library/database/orm"
  10. "go-common/library/log"
  11. xhttp "go-common/library/net/http/blademaster"
  12. "go-common/library/net/netutil/breaker"
  13. "go-common/library/time"
  14. )
  15. func main() {
  16. var (
  17. versionPath string
  18. cookiePath string
  19. tokenPath string
  20. action string
  21. )
  22. flag.StringVar(&versionPath, "v", "", "版本批次文件路径")
  23. flag.StringVar(&cookiePath, "c", "", "cookie文件路径")
  24. flag.StringVar(&tokenPath, "t", "", "token文件路径")
  25. flag.StringVar(&action, "a", "", "操作类型")
  26. flag.Parse()
  27. c := &conf.Config{
  28. HTTPClient: &xhttp.ClientConfig{
  29. App: &xhttp.App{
  30. Key: "c05dd4e1638a8af0",
  31. Secret: "7daa7f8c06cd33c5c3067063c746fdcb",
  32. },
  33. Dial: time.Duration(20000000000),
  34. Timeout: time.Duration(100000000000),
  35. KeepAlive: time.Duration(600000000000),
  36. Breaker: &breaker.Config{
  37. Window: time.Duration(100000000000),
  38. Sleep: time.Duration(20000000000),
  39. Bucket: 10,
  40. Ratio: 0.5,
  41. Request: 100,
  42. },
  43. },
  44. Bugly: &conf.BuglyConf{
  45. Host: "https://bugly.qq.com",
  46. Cookie: cookiePath,
  47. Token: tokenPath,
  48. Version: versionPath,
  49. },
  50. ORM: &orm.Config{
  51. DSN: "root:123456@tcp(172.18.33.130:3306)/footman?timeout=200ms&readTimeout=2000ms&writeTimeout=2000ms&parseTime=true&loc=Local&charset=utf8,utf8mb4",
  52. Active: 5,
  53. Idle: 5,
  54. IdleTimeout: time.Duration(20000000000),
  55. },
  56. Mail: &conf.Mail{
  57. Host: "smtp.exmail.qq.com",
  58. Port: 465,
  59. Username: "merlin@bilibili.com",
  60. Password: "",
  61. NoticeOwner: []string{"fengyifeng@bilibili.com"},
  62. },
  63. Memcache: &conf.Memcache{
  64. Expire: time.Duration(10000000),
  65. Config: &memcache.Config{
  66. Name: "merlin",
  67. Proto: "tcp",
  68. Addr: "172.22.33.137:11216",
  69. DialTimeout: time.Duration(1000),
  70. ReadTimeout: time.Duration(1000),
  71. WriteTimeout: time.Duration(1000),
  72. Config: &pool.Config{
  73. Active: 10,
  74. IdleTimeout: time.Duration(1000),
  75. },
  76. },
  77. },
  78. Bugly2Tapd: &conf.Bugly2Tapd{
  79. ProjectIds: []string{"900028525"},
  80. },
  81. }
  82. s := service.New(c)
  83. log.Info("v1.0.40")
  84. switch action {
  85. case "insertTapd":
  86. s.BuglyInsertTapd(context.Background())
  87. default:
  88. s.GetSaveIssuesWithMultiVersion(context.Background())
  89. s.UpdateBuglyStatusInTapd(context.Background())
  90. s.UpdateBugInTapd(context.Background())
  91. }
  92. defer s.Close()
  93. }