...
|
...
|
@@ -78,8 +78,8 @@ type ImportEmployeeData struct { |
|
|
|
|
|
// ChangePhoneData 修改手机号
|
|
|
type ChangePhoneData struct {
|
|
|
OldPhone string `json:"oldPhone"`
|
|
|
NewPhone string `json:"newPhone"`
|
|
|
OldPhone string `json:"old_phone"`
|
|
|
NewPhone string `json:"new_phone"`
|
|
|
}
|
|
|
|
|
|
//SyncEmployeeService 同步用户数据
|
...
|
...
|
@@ -150,7 +150,7 @@ func (service SyncEmployeeService) DoAction(action string, byteData []byte) erro |
|
|
// case "batchRemove":
|
|
|
// //移动通讯录用户部门 暂时不需要
|
|
|
// return nil
|
|
|
case "changePhone": // TODO 修改手机号
|
|
|
case "changePhoneAllCompany": // TODO 修改手机号
|
|
|
// 修改手机号
|
|
|
var (
|
|
|
err error
|
...
|
...
|
@@ -445,7 +445,7 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e |
|
|
return err
|
|
|
}
|
|
|
|
|
|
// ChangePhone 修改手机号
|
|
|
// ChangePhone TODO 修改手机号
|
|
|
func (service SyncEmployeeService) changePhone(data ChangePhoneData) error {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
...
|
...
|
@@ -457,15 +457,31 @@ func (service SyncEmployeeService) changePhone(data ChangePhoneData) error { |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var uDao *dao.UsersDao
|
|
|
if uDao, err = factory.CreateUsersDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
var pDao *dao.PartnerInfoDao
|
|
|
if pDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 更新高管手机号
|
|
|
if err = uDao.UpdateUserPhone(data.OldPhone, data.NewPhone); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 更新合伙人手机号
|
|
|
if err = pDao.UpdatePartnerPhone(data.OldPhone, data.NewPhone); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
err = transactionContext.CommitTransaction()
|
|
|
return err
|
|
|
}
|
...
|
...
|
|