作者 tangxvhui

bug 修复

... ... @@ -177,7 +177,7 @@ func AddEmployeeData(data []ModuleEmployee) error {
continue
}
v.OpenId = ucenterReturn.Data.Id
userdata, err = models.GetUserByUCenter(v.OpenId)
userdata, err = models.GetUserByPhone(v.Phone)
if err != nil && err != orm.ErrNoRows {
log.Error("获取用户数据失败,err:%s", err)
return errors.New("获取用户数据失败")
... ... @@ -200,8 +200,12 @@ func AddEmployeeData(data []ModuleEmployee) error {
}
} else {
userdata.NickName = v.Name
userdata.Phone = v.Phone
models.UpdateUserById(userdata, []string{"NickName", "Phone"})
// userdata.Phone = v.Phone
userdata.UserCenterId = v.OpenId
err = models.UpdateUserById(userdata, []string{"NickName", "UserCenterId"})
if err != nil {
log.Error("更新用户数据失败:%s")
}
}
uc := &models.UserCompany{
Id: v.Id,
... ... @@ -294,7 +298,13 @@ func UpdateEmployeeData(data ModuleEmployee) error {
log.Error(e.Error())
return e
}
userdata, err = models.GetUserByUCenter(data.OpenId)
ucenterReturn, err := ucenter.RequestUCenterAddUser(data.Phone, data.Name, "")
if err != nil {
log.Error("请求统一用户中心数据失败:%s", err)
return errors.New("请求统一用户中心失败")
}
data.OpenId = ucenterReturn.Data.Id
userdata, err = models.GetUserByPhone(data.Phone)
if err != nil {
e := fmt.Errorf("获取用户数据失败:%s", err)
log.Error(e.Error())
... ...