12345678910111213141516171819202122 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- )
- type OpenApiUser struct {
- Appid string `orm:"column(appid);pk" json:"appid" description:"开放平台appid"`
- Secret string `orm:"column(secret);" json:"secret" description:"开放平台秘钥"`
- Ip string `orm:"column(ip);" json:"ip" description:"限制请求来源ip,多个ip用英文,隔开"`
- Remark string `orm:"column(remark);" json:"remark" description:"备注信息"`
- CreateTime string `orm:"column(create_time);" json:"create_time" description:"创建时间"`
- ModifyTime string `orm:"column(modify_time);" json:"modify_time" description:"最近一次更新时间"`
- }
- // GetByAppid 根据appid获取开放api用户信息
- func GetByAppid(appid string) (item *OpenApiUser, err error) {
- sql := `SELECT * FROM open_api_user WHERE appid=? LIMIT 1`
- o := orm.NewOrmUsingDB("weekly")
- err = o.Raw(sql, appid).QueryRow(&item)
- return
- }
|