mirror of
https://github.com/kongyuebin1/dongfeng-pay.git
synced 2024-12-27 12:42:24 +08:00
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
|
package fast
|
||
|
|
||
|
import (
|
||
|
"github.com/astaxie/beego/logs"
|
||
|
"github.com/beego/beego/v2/client/orm"
|
||
|
)
|
||
|
|
||
|
type RpUserInfo struct {
|
||
|
Id string `orm:"pk;column(id)"`
|
||
|
CreateTime string
|
||
|
Status string
|
||
|
UserNo string
|
||
|
UserName string
|
||
|
AccountNo string
|
||
|
Mobile string
|
||
|
Password string
|
||
|
PayPwd string
|
||
|
LastSmsVerifyCodeTime string
|
||
|
Email string
|
||
|
Ips string
|
||
|
}
|
||
|
|
||
|
func (c *RpUserInfo) TableName() string {
|
||
|
return "rp_user_info"
|
||
|
|
||
|
}
|
||
|
|
||
|
func tableName() string {
|
||
|
return "rp_user_info"
|
||
|
}
|
||
|
|
||
|
func GetUserInfoByUserName(userName string) *RpUserInfo {
|
||
|
|
||
|
o := orm.NewOrm()
|
||
|
userInfo := new(RpUserInfo)
|
||
|
|
||
|
_, err := o.QueryTable(tableName()).Filter("mobile", userName).All(userInfo)
|
||
|
|
||
|
if err != nil {
|
||
|
logs.Error("根据用户名从数据获取用户信息失败:", err)
|
||
|
}
|
||
|
|
||
|
return userInfo
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
** 更新用户信息
|
||
|
*/
|
||
|
func UpdateUserInfo(userInfo *RpUserInfo) bool {
|
||
|
o := orm.NewOrm()
|
||
|
|
||
|
if _, err := o.Update(userInfo); err != nil {
|
||
|
logs.Error("更新用户信息失败,错误:%s", err)
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
return true
|
||
|
}
|