wechat_send_msg.go 544 B

12345678910111213141516171819
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. type OpenIdList struct {
  6. OpenId string
  7. UserId int
  8. }
  9. func GetAdminOpenIdByMobile(mobile string) (items []*OpenIdList, err error) {
  10. sql := `SELECT DISTINCT ur.open_id,wu.user_id FROM wx_user AS wu
  11. INNER JOIN company AS c ON c.company_id = wu.company_id
  12. INNER join user_record as ur on wu.user_id=ur.user_id
  13. WHERE ur.open_id != "" and ur.create_platform=1 AND wu.mobile=? `
  14. _, err = orm.NewOrm().Raw(sql, mobile).QueryRows(&items)
  15. return
  16. }