1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package cygx
- import (
- "errors"
- "fmt"
- "hongze/hz_crm_api/models"
- "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
- }
- // 获取某一个公司下所有OpenId (查研观向主体)
- func GetUserOpenidByComapnyIdRai(comppanyId int) (openIdArr []string) {
- var err error
- defer func() {
- if err != nil {
- fmt.Println(err)
- go alarm_msg.SendAlarmMsg(fmt.Sprint("获取某一个公司下所有用户的手机号 失败 comppanyId", comppanyId, "err", err.Error()), 2)
- }
- }()
- listUser, e := models.GetWxUserListCompanyId(comppanyId)
- if e != nil {
- err = errors.New("GetWxUserListCompanyId" + e.Error())
- return
- }
- var mobileArr []string
- openIdArr = make([]string, 0)
- for _, v := range listUser {
- mobileArr = append(mobileArr, v.Mobile)
- }
- openIdListJmcj, e := cygx.GetUserRecordListByMobileArr(mobileArr)
- if e != nil {
- err = errors.New("GetUserRecordListByMobileArr" + e.Error())
- return
- }
- for _, v := range openIdListJmcj {
- openIdArr = append(openIdArr, v.OpenId)
- }
- return
- }
|