package yb_activity_view_log

import "hongze/hongze_yb/global"

// GetByActivityIdsAndUserIdAndTime 根据用户id和 活动id，创建时间筛选出用户已经浏览过的记录
func GetByActivityIdsAndUserIdAndTime( activityIds []int, userId uint64, createTime string) (actIds []int, err error)   {
	var viewLog []*YbActivityViewLog
	err = global.DEFAULT_MYSQL.Model(YbActivityViewLog{}).Where("activity_id in (?) and user_id = ? and create_time > ?", activityIds, userId, createTime).Scan(&viewLog).Error
	if err != nil {
		return
	}

	if len(viewLog) > 0 {
		for _, v := range viewLog {
			actIds = append(actIds, v.ActivityId)
		}
	}
	return
}
