1234567891011121314151617181920212223242526 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- )
- type WxToken struct {
- AccessToken string `description:"微信token"` // 微信token
- ExpiresIn int64 `description:"过期时间"` // 过期时间
- Id int `description:"id"` // id
- }
- // Update 更新对应字段数据
- func (w *WxToken) Update(cols []string) (err error) {
- o := orm.NewOrm()
- _, err = o.Update(w, cols...)
- return
- }
- // GetById 根据id获取accessToken信息
- func GetWxTokenById() (info WxToken, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM wx_token WHERE id = ?`
- err = o.Raw(sql, 0).QueryRow(&info)
- return
- }
|