package services

import (
	"hongze/hongze_cygx/models"
	"hongze/hongze_cygx/utils"
)

func GetChooseCategoryMap(wxUser *models.WxUserItem) (mapResp map[int]bool, err error) {
	if wxUser.Mobile == "" {
		return
	}
	defer func() {
		if err != nil {
			go utils.SendAlarmMsg("GetChooseCategoryMap, ErrMsg: "+err.Error(), 3)
		}
	}()
	mapResp = make(map[int]bool, 0)
	list, err := models.GetCygxXzsChooseCategoryList(wxUser.Mobile)
	if err != nil && err.Error() != utils.ErrNoRow() {
		return
	}
	if len(list) > 0 {
		for _, v := range list {
			mapResp[v.CategoryId] = true
		}
	}
	return

}
