package models import "github.com/beego/beego/v2/client/orm" func PcGetWxToken() (item *WxToken, err error) { sql := `SELECT * FROM wx_pc_token ` o := orm.NewOrm() err = o.Raw(sql).QueryRow(&item) return } func PcAddWxToken(token string, expiresIn int64) (err error) { sql := `INSERT INTO wx_pc_token(access_token, expires_in)VALUES(?,?) ` o := orm.NewOrm() _, err = o.Raw(sql, token, expiresIn).Exec() return } func PcUpdateWxToken(token string, expiresIn int64, id int) (err error) { sql := `UPDATE wx_pc_token SET access_token=?, expires_in=? WHERE id=? ` o := orm.NewOrm() _, err = o.Raw(sql, token, expiresIn, id).Exec() return }