1234567891011121314151617181920212223242526272829303132333435 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "hongze/hongze_mobile_admin/utils"
- )
- type OpenIdList struct {
- OpenId string
- UserId int
- }
- func GetAdminOpenIdByMobile(mobile string) (items []*OpenIdList, err error) {
- sql := `SELECT DISTINCT ur.open_id,wu.user_id FROM wx_user AS wu
- INNER JOIN company AS c ON c.company_id = wu.company_id
- INNER join user_record as ur on wu.user_id=ur.user_id
- WHERE ur.open_id != "" and ur.create_platform=1 AND wu.mobile=? `
- _, err = orm.NewOrm().Raw(sql, mobile).QueryRows(&items)
- return
- }
- // 根据手机号获取用户的openid查研观向小助手专用
- func GetUserRecordListByMobile(platform int, bindAccount string) (items []*OpenIdList, err error) {
- var sql string
- if utils.RunMode == "release" {
- sql = `SELECT cr.open_id FROM user_record as u
- INNER JOIN cygx_user_record AS cr ON cr.union_id = u.union_id
- WHERE create_platform=? AND bind_account IN (` + bindAccount + `)`
- } else {
- platform = 1
- sql = `SELECT open_id FROM user_record WHERE create_platform =? AND bind_account IN (` + bindAccount + `)`
- }
- _, err = orm.NewOrm().Raw(sql, platform).QueryRows(&items)
- return
- }
|