|
@@ -10,6 +10,7 @@ type User struct {
|
|
|
UserId int `orm:"pk" description:"用户id"`
|
|
|
OpenId string `description:"openid"`
|
|
|
UnionId string `description:"unionid"`
|
|
|
+ NickName string `description:"用户昵称"`
|
|
|
RealName string `description:"姓名"`
|
|
|
Phone string `description:"手机号"`
|
|
|
AreaCode string `description:"区号"`
|
|
@@ -41,26 +42,6 @@ func (u *User) Update(cols []string) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-type UserItem struct {
|
|
|
- UserId int `description:"用户id"`
|
|
|
- OpenId string `description:"open_id"`
|
|
|
- UnionId string `description:"union_id"`
|
|
|
- NickName string `description:"用户昵称"`
|
|
|
- RealName string `description:"用户实际名称"`
|
|
|
- Phone string `description:"手机号码"`
|
|
|
- Componey string `description:"所属公司"`
|
|
|
- AreaCode string `description:"区号"`
|
|
|
- SellerId int `description:"销售id"`
|
|
|
- Email string `description:"邮箱"`
|
|
|
- Headimgurl string `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
|
|
|
- ValidEndTime time.Time `description:"服务截至时间"`
|
|
|
- RegisterTime time.Time `description:"登录时间,用户首次登录小程序的时间"`
|
|
|
- CreateTime time.Time `description:"系统中新增用户的时间"`
|
|
|
- ModifyTime time.Time `description:"系统中用户信息更新的时间"`
|
|
|
- IsRegistered bool `description:"是否注册:1:已注册,0:未注册"`
|
|
|
- LastUpdateTime time.Time `description:"用户最近一次登录时间"`
|
|
|
-}
|
|
|
-
|
|
|
type UserView struct {
|
|
|
Headimgurl string `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
|
|
|
RealName string `description:"用户实际名称"`
|
|
@@ -92,14 +73,6 @@ func GetUserByOpenId(openId string) (item *User, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// 根据openid获取用户关系
|
|
|
-func GetUserItemByOpenId(openId string) (item *UserItem, err error) {
|
|
|
- sql := `SELECT * FROM user WHERE open_id=? `
|
|
|
- o := orm.NewOrm()
|
|
|
- err = o.Raw(sql, openId).QueryRow(&item)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
// 变更联系人是否已注册状态
|
|
|
func ModifyUserRegisterStatus(userId int, status bool, registerTime, modifyTime time.Time) (err error) {
|
|
|
o := orm.NewOrm()
|
|
@@ -125,21 +98,15 @@ func GetUserList(condition string, pars []interface{}) (items []*User, err error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetUserItemByPhone(phone string) (item *UserItem, err error) {
|
|
|
+func GetUserByPhone(phone string) (item *User, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT * FROM user WHERE phone=? `
|
|
|
err = o.Raw(sql, phone).QueryRow(&item)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetUserItemByEmail(email string) (item *UserItem, err error) {
|
|
|
+func GetUserByEmail(email string) (item *User, err error) {
|
|
|
sql := `SELECT * FROM user WHERE email=? `
|
|
|
err = orm.NewOrm().Raw(sql, email).QueryRow(&item)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
-func GetUserItemByUserId(userId int) (item *UserItem, err error) {
|
|
|
- sql := `SELECT * FROM user WHERE user_id=? `
|
|
|
- err = orm.NewOrm().Raw(sql, userId).QueryRow(&item)
|
|
|
- return
|
|
|
-}
|