package cygx

import (
	"errors"
	"fmt"
	"hongze/hz_crm_api/models/cygx"
	"hongze/hz_crm_api/services/alarm_msg"
	"hongze/hz_crm_api/utils"
)

// 根据用户ID获取那些用户设置了互动提醒
func GetCygxUserRemindListMap(userIds []int) (mapResp map[int]bool) {
	lenArr := len(userIds)
	if lenArr == 0 {
		return
	}
	var err error
	defer func() {
		if err != nil {
			fmt.Println(err)
			go alarm_msg.SendAlarmMsg("根据用户ID获取那些用户设置了互动提醒,信息失败,GetCygxUserRemindListMap Err:"+err.Error(), 3)
		}
	}()
	var condition string
	var pars []interface{}

	condition = ` AND  user_id IN (` + utils.GetOrmInReplace(lenArr) + `)`
	pars = append(pars, userIds)
	//获取分类名称
	userRemindList, e := cygx.GetCygxUserRemindList(condition, pars, 0, 0)
	if e != nil {
		err = errors.New("GetCygxUserRemindList, Err: " + e.Error())
		return
	}
	mapResp = make(map[int]bool, 0)
	for _, v := range userRemindList {
		mapResp[v.UserId] = true
	}
	return
}