蛋蛋星球 后台端
 
 
 
 

50 řádky
1.2 KiB

  1. package svc
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/md"
  6. "applet/app/utils"
  7. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func AdminLog(c *gin.Context) {
  11. var req *md.AdminLogListReq
  12. if err := c.ShouldBindJSON(&req); err != nil {
  13. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  14. return
  15. }
  16. var resp md.AdminLogListResp
  17. noticeList := make([]md.AdminLogList, 0)
  18. NewAdminLogDb := implement.NewAdminLogDb(db.Db)
  19. notice, total, _ := NewAdminLogDb.FindAdminLogAndTotal(req.Page, req.Limit, req.Type, req.Memo, req.StartTime, req.EndTime)
  20. resp.Total = total
  21. resp.TypeList = []map[string]interface{}{
  22. {"name": "后台登录", "type": "后台登录"},
  23. }
  24. if notice != nil {
  25. for _, v := range *notice {
  26. NewAdminDb := implement.NewAdminDb(db.Db)
  27. admin, _ := NewAdminDb.GetAdmin(v.AdminId)
  28. phone := ""
  29. if admin != nil {
  30. phone = admin.Username
  31. }
  32. tmp := md.AdminLogList{
  33. Id: utils.IntToStr(v.Id),
  34. Type: v.Type,
  35. Memo: v.Memo,
  36. Time: v.Time.Format("2006-01-02 15:04:05"),
  37. Ip: v.Ip,
  38. Phone: phone,
  39. AdminId: utils.IntToStr(v.AdminId),
  40. }
  41. noticeList = append(noticeList, tmp)
  42. }
  43. }
  44. resp.List = noticeList
  45. e.OutSuc(c, resp, nil)
  46. return
  47. }