logs_cache.go 575 B

123456789101112131415161718192021
  1. package cache
  2. import (
  3. "eta/eta_mobile/models"
  4. "eta/eta_mobile/utils"
  5. "fmt"
  6. "time"
  7. )
  8. // record more information
  9. func RecordNewLogs(adminId int, request, response string, realName, operateIp, model string) bool {
  10. log := &models.OperateLogs{AdminId: adminId, SysUserRealName: realName, OperateTime: time.Now(), Request: request, Response: response, OperateIp: operateIp, Model: model}
  11. if utils.Re == nil {
  12. err := utils.Rc.LPush(utils.CACHE_KEY_LOGS, log)
  13. if err != nil {
  14. fmt.Println("RecordNewLogs LPush Err:" + err.Error())
  15. }
  16. return true
  17. }
  18. return false
  19. }