wx_user_code.go 689 B

12345678910111213141516171819202122232425262728293031
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type WxUserCode struct {
  7. Id int `orm:"column(id);pk"`
  8. WxCode string
  9. UserId int
  10. Code int
  11. FirstLogin int
  12. Authorization string
  13. UserPermission int
  14. CreateTime time.Time
  15. }
  16. // 添加联系人日志信息
  17. func AddWxUserCode(item *WxUserCode) (lastId int64, err error) {
  18. o := orm.NewOrmUsingDB("weekly_report")
  19. lastId, err = o.Insert(item)
  20. return
  21. }
  22. func GetWxUserCode(wxCode string) (item *WxUserCode, err error) {
  23. o := orm.NewOrmUsingDB("weekly_report")
  24. sql := `SELECT * FROM wx_user_code WHERE wx_code=? `
  25. err = o.Raw(sql, wxCode).QueryRow(&item)
  26. return
  27. }