user_invitee.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type UserInvitee struct {
  7. Id int `orm:"column(id);pk"`
  8. InviteeUserId string `description:"产业D"`
  9. InviteedUserId string `description:"用户ID"`
  10. CreateTime time.Time `description:"创建时间"`
  11. InviteedMobile string `description:"手机号"`
  12. InviteedCompanyId int `description:"公司ID"`
  13. InviteeMobile string `description:"邀请人手机号"`
  14. InviteeCompany string `description:"邀请人公司名称"`
  15. InviteeCompanyId int `description:"邀请人公司ID"`
  16. InviteeEmail string `description:"邀请人邮箱"`
  17. }
  18. // 添加收藏信息
  19. func AddUserInvite(item *UserInvitee) (lastId int64, err error) {
  20. o := orm.NewOrmUsingDB("weekly_report")
  21. lastId, err = o.Insert(item)
  22. return
  23. }
  24. // 获取数量
  25. func GetUserInviteeCount(userId int) (count int, err error) {
  26. o := orm.NewOrmUsingDB("weekly_report")
  27. sql := `SELECT COUNT(1) AS count FROM user_invitee WHERE inviteed_user_id=? `
  28. err = o.Raw(sql, userId).QueryRow(&count)
  29. return
  30. }