...
|
...
|
@@ -5,6 +5,8 @@ import ( |
|
|
"oppmg/models"
|
|
|
"oppmg/protocol"
|
|
|
"oppmg/services/ucenter"
|
|
|
"oppmg/utils"
|
|
|
"strings"
|
|
|
"time"
|
|
|
|
|
|
"github.com/astaxie/beego/orm"
|
...
|
...
|
@@ -488,3 +490,55 @@ func CompanyInfoForUCenter(uCenterid int64) (protocol.ResponseCenterCompany, err |
|
|
}
|
|
|
return resp, nil
|
|
|
}
|
|
|
|
|
|
//统一用户中心 修改手机号
|
|
|
func ChangePhoneForUCenter(ucid int64, phone string) (rsp interface{}, err error) {
|
|
|
var (
|
|
|
user *models.User
|
|
|
)
|
|
|
if user, err = models.GetUserByUCenter(ucid); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
return rsp, nil
|
|
|
}
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if user.Phone == strings.TrimSpace(phone) {
|
|
|
return
|
|
|
}
|
|
|
if err = utils.UpdateTableByMap(user, map[string]interface{}{"Phone": strings.TrimSpace(phone)}); err != nil {
|
|
|
log.Error(err.Error())
|
|
|
return
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//统一用户中心 注销手机登录
|
|
|
func RevokeForUCenter(ucid int64) (rsp interface{}, err error) {
|
|
|
var (
|
|
|
user *models.User
|
|
|
userAuth *models.UserAuth
|
|
|
updateMap = make(map[string]interface{})
|
|
|
)
|
|
|
if user, err = models.GetUserByUCenter(ucid); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
return rsp, nil
|
|
|
}
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if userAuth, err = models.GetUserAuthByDeviceTye(user.Id, 1); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
return rsp, nil
|
|
|
}
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
{
|
|
|
updateMap["AccessToken"] = ""
|
|
|
updateMap["RefreshToken"] = ""
|
|
|
updateMap["AuthCode"] = ""
|
|
|
}
|
|
|
if err = utils.UpdateTableByMap(userAuth, updateMap); err != nil {
|
|
|
log.Error(err.Error())
|
|
|
return
|
|
|
}
|
|
|
return
|
|
|
} |
...
|
...
|
|