logs_cache.go 581 B

123456789101112131415161718192021
  1. package cache
  2. import (
  3. "fmt"
  4. "hongze/hz_crm_api/models"
  5. "hongze/hz_crm_api/utils"
  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. }