wx_token.go 630 B

1234567891011121314151617181920212223242526
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. type WxToken struct {
  6. AccessToken string `description:"微信token"` // 微信token
  7. ExpiresIn int64 `description:"过期时间"` // 过期时间
  8. Id int `description:"id"` // id
  9. }
  10. // Update 更新对应字段数据
  11. func (w *WxToken) Update(cols []string) (err error) {
  12. o := orm.NewOrm()
  13. _, err = o.Update(w, cols...)
  14. return
  15. }
  16. // GetById 根据id获取accessToken信息
  17. func GetWxTokenById() (info WxToken, err error) {
  18. o := orm.NewOrm()
  19. sql := `SELECT * FROM wx_token WHERE id = ?`
  20. err = o.Raw(sql, 0).QueryRow(&info)
  21. return
  22. }