123456789101112131415161718192021222324252627282930313233 |
- package report
- import (
- "fmt"
- "hongze/hongze_yb/global"
- "hongze/hongze_yb/models/tables/user_access_record"
- "hongze/hongze_yb/services/user"
- "time"
- )
- // AddUserAccessRecord 新增报告浏览记录
- func AddUserAccessRecord(userInfo user.UserInfo, reportId int, classifyName string, reportChapterId int, authOk bool) {
- var err error
- defer func() {
- if err != nil {
- global.LOG.Critical(fmt.Sprintf("AddUserAccessRecord: userId=%d, err:%s", userInfo.UserID, err.Error()))
- }
- }()
- if reportId > 0 {
- record := new(user_access_record.UserAccessRecord)
- record.Uid = int(userInfo.UserID)
- record.Token = userInfo.LoginToken
- record.CreateTime = time.Now()
- record.Remark = "2" // 无权限
- if authOk {
- record.Remark = "0"
- }
- record.ReportId = reportId
- record.ReportChapterId = reportChapterId
- err = record.Create()
- }
- return
- }
|