clpt_session.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxClptSession struct {
  7. SessionId int `orm:"column(session_id);pk"`
  8. Mobile string
  9. UserId int
  10. AccessToken string
  11. ExpireTime time.Time
  12. CreateTime time.Time
  13. LastUpdatedTime time.Time
  14. OpenId string `description:"用户openid,最大长度:32"`
  15. UnionId string `description:"用户unionid,最大长度:64"`
  16. }
  17. // 根据用户id字符串获取用户绑定时间 (查研观向与买方研选小程序)
  18. func GetCygxClptSessionrByUserIdsMyfx(userIds string) (items []*CygxClptSession, err error) {
  19. o := orm.NewOrmUsingDB("hz_cygx")
  20. sql := `SELECT user_id,min(created_time) as create_time FROM cygx_clpt_session WHERE user_id in (` + userIds + `) group by user_id`
  21. _, err = o.Raw(sql).QueryRows(&items)
  22. return
  23. }
  24. type CygxMfyxWebSession struct {
  25. Mobile string
  26. UserId int
  27. AccessToken string
  28. ExpireTime time.Time
  29. CreateTime time.Time
  30. LastUpdatedTime time.Time
  31. OpenId string `description:"用户openid,最大长度:32"`
  32. UnionId string `description:"用户unionid,最大长度:64"`
  33. SessionStatus int `description:"token状态,0正常,1被顶号"`
  34. }
  35. // 根据用户id字符串获取用户绑定时间 (买方研选网页版)
  36. func GetCygxMfyxWebSessionByUserIdsMyfx(userIds string) (items []*CygxMfyxWebSession, err error) {
  37. o := orm.NewOrmUsingDB("hz_cygx")
  38. sql := `SELECT user_id,min(created_time) as create_time FROM cygx_mfyx_web_session WHERE user_id in (` + userIds + `) group by user_id`
  39. _, err = o.Raw(sql).QueryRows(&items)
  40. return
  41. }