package yb_activity_remind

import "hongze/hongze_yb/global"

type UserRemind struct {
	ActivityRemindID	int	`json:"activityRemindId"`
	UserId				int	`json:"userId"`
	ActivityId			int	`json:"activityId"`
}

// RemindExist 根据用户ID和活动ID获取提醒信息
func RemindExist(userId, activityId int) (remind *YbActivityRemind, err error) {
	err = global.DEFAULT_MYSQL.Table("yb_activity_remind").Where("user_id = ? AND activity_id = ?", userId, activityId).First(&remind).Error
	return
}

// GetRemindsByUserIdAndActivityIds 根据用户ID和活动IDs获取提醒信息
func GetRemindsByUserIdAndActivityIds(userId int, activityIds []int) (reminds []UserRemind, err error) {
	fields := []string{"activity_remind_id", "user_id", "activity_id"}
	err = global.DEFAULT_MYSQL.Model(YbActivityRemind{}).Select(fields).Where("user_id = ? AND activity_id IN (?)", userId, activityIds).Scan(&reminds).Error
	return
}