package models import ( "eta_gn/eta_api/global" ) type OpenIdList struct { OpenId string UserId int } func GetOpenIdArr() (items []string, err error) { sql := ` SELECT DISTINCT ur.open_id FROM wx_user AS wu INNER JOIN company AS c ON c.company_id = wu.company_id INNER JOIN company_product AS d ON c.company_id=d.company_id INNER JOIN user_record AS ur ON wu.user_id=ur.user_id WHERE ur.open_id != "" AND ur.subscribe=1 AND ur.create_platform=1 AND d.status IN('正式','试用','永续') ORDER BY FIELD(c.company_id, 16) desc, ur.user_record_id asc` err = global.DmSQL["weekly"].Raw(sql).Scan(&items).Error return } func GetOpenIdArrByClassifyId(classifyId int) (items []string, err error) { sql := ` SELECT DISTINCT ur.open_id FROM wx_user AS wu INNER JOIN company AS c ON c.company_id = wu.company_id INNER JOIN company_product AS d ON c.company_id=d.company_id INNER JOIN user_record AS ur ON wu.user_id=ur.user_id INNER JOIN company_report_permission AS e ON d.company_id=e.company_id INNER JOIN chart_permission AS f ON e.chart_permission_id=f.chart_permission_id INNER JOIN chart_permission_search_key_word_mapping AS g ON f.chart_permission_id=g.chart_permission_id WHERE ur.open_id != "" AND ur.subscribe=1 AND ur.create_platform=1 AND d.status IN('正式','试用','永续') AND e.status IN('正式','试用','永续') AND g.source_from='rddp' AND g.classify_id=? ORDER BY FIELD(c.company_id, 16) DESC, ur.user_record_id ASC ` err = global.DmSQL["weekly"].Raw(sql, classifyId).Scan(&items).Error return }