query.go 632 B

123456789101112131415
  1. package user_view_history
  2. import "hongze/hongze_yb/global"
  3. // GetReportByUserId 根据userId查询文章记录
  4. func GetReportByUserId(userId,reportId uint64) (item *UserViewHistory, err error) {
  5. err = global.DEFAULT_MYSQL.Where("user_id = ? and research_report_id = ? and research_report_type_id = 0", userId, reportId).First(&item).Error
  6. return
  7. }
  8. // GetReportTypeByUserId 根据userId查询章节记录
  9. func GetReportTypeByUserId(userId,reportTypeId uint64) (item *UserViewHistory, err error) {
  10. err = global.DEFAULT_MYSQL.Where("user_id = ? and research_report_type_id = ?", userId, reportTypeId).First(&item).Error
  11. return
  12. }