12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package models
- import "rdluck_tools/orm"
- type HongzeUsers struct {
- RealName string
- CompanyName string
- Mobile string
- IsRegister string
- UserType string
- }
- func GetHongzeUsers() (items []*HongzeUsers, err error) {
- sql := `select wu.real_name,c.company_name,left(wu.mobile, 11) as mobile ,if(wu.open_id is null,'否','是') as is_register,if(c.type in (1),'是','否') as user_type
- from wx_user wu
- inner join company c on c.company_id = wu.company_id
- where c.company_id <> 1 and c.company_id <> 16
- and c.type in (1)
- order by company_name desc `
- _, err = orm.NewOrm().Raw(sql).QueryRows(&items)
- return
- }
- type WxUser struct {
- UserId int64
- Mobile string
- Email string
- CompanyId int
- ExpiredIn int64
- OpenId string
- }
- func GetWxUserByUserId(userId int) (item *WxUser, err error) {
- sql := `SELECT * FROM wx_user WHERE user_id=? `
- err = orm.NewOrm().Raw(sql, userId).QueryRow(&item)
- return
- }
- func GetWxUserByMobile(mobile string) (item *WxUser, err error) {
- sql := `SELECT * FROM wx_user WHERE mobile=? `
- err = orm.NewOrm().Raw(sql, mobile).QueryRow(&item)
- return
- }
|