log.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package service
  2. import (
  3. "time"
  4. "go-common/app/admin/main/creative/model/academy"
  5. "go-common/app/admin/main/creative/model/logcli"
  6. "go-common/app/admin/main/creative/model/music"
  7. "go-common/app/admin/main/creative/model/task"
  8. "go-common/library/conf/env"
  9. "go-common/library/log"
  10. bm "go-common/library/net/http/blademaster"
  11. "go-common/library/queue/databus/report"
  12. )
  13. // SendAcademyLog academy log to manager.
  14. func (s *Service) SendAcademyLog(c *bm.Context, lp *academy.LogParam) (err error) {
  15. if env.DeployEnv == env.DeployEnvDev {
  16. return
  17. }
  18. logData := &report.ManagerInfo{
  19. Business: academy.LogClientAcademy,
  20. Type: 0,
  21. Uname: lp.UName,
  22. UID: lp.UID,
  23. Oid: lp.TID,
  24. Action: lp.Action,
  25. Ctime: time.Now(),
  26. Index: []interface{}{lp.TID},
  27. Content: map[string]interface{}{
  28. "academy_manager": lp,
  29. },
  30. }
  31. log.Info("s.SendAcademyLog logData(%+v) log param(%+v)", logData, lp)
  32. report.Manager(logData)
  33. return
  34. }
  35. // SendMusicLog send to log archive music
  36. func (s *Service) SendMusicLog(c *bm.Context, clientType int, ap *music.LogParam) (err error) {
  37. logData := &report.ManagerInfo{
  38. Uname: ap.UName,
  39. UID: ap.UID,
  40. Business: logcli.LogClientArchiveMusic,
  41. Type: clientType,
  42. Oid: ap.ID,
  43. Action: ap.Action,
  44. Ctime: time.Now(),
  45. Index: []interface{}{ap.ID},
  46. Content: map[string]interface{}{
  47. "object": ap,
  48. },
  49. }
  50. log.Info("sendMusicLog logData(%+v) ap(%+v)", logData, ap)
  51. report.Manager(logData)
  52. return
  53. }
  54. // SendTaskLog task log to manager.
  55. func (s *Service) SendTaskLog(c *bm.Context, lp *task.LogParam) (err error) {
  56. if env.DeployEnv == env.DeployEnvDev {
  57. return
  58. }
  59. logData := &report.ManagerInfo{
  60. Business: task.LogClientTask,
  61. Type: 0,
  62. Uname: lp.UName,
  63. UID: lp.UID,
  64. Oid: lp.OID,
  65. Action: lp.Action,
  66. Ctime: time.Now(),
  67. Index: []interface{}{lp.OID},
  68. Content: map[string]interface{}{
  69. "params": lp.Content,
  70. },
  71. }
  72. log.Info("s.SendTaskLog logData(%+v) log param(%+v)", logData, lp)
  73. report.Manager(logData)
  74. return
  75. }