新增获取解密手机号
This commit is contained in:
@@ -61,3 +61,30 @@ func (r *UserService) GetUserBankNumByDoctorId(doctorId int64) (string, error) {
|
||||
|
||||
return doctorBankCard.BankCardCode, nil
|
||||
}
|
||||
|
||||
// GetUserMobile 获取用户手机号
|
||||
func (r *UserService) GetUserMobile(userId, familyId int64) (string, error) {
|
||||
var mobile string
|
||||
|
||||
// 获取用户数据
|
||||
userDao := dao.UserDao{}
|
||||
user, err := userDao.GetUserById(userId)
|
||||
if err != nil || user == nil {
|
||||
return "", errors.New("用户错误")
|
||||
}
|
||||
|
||||
mobile = user.Mobile
|
||||
|
||||
if familyId != 0 {
|
||||
// 存在家庭成员
|
||||
patientFamilyDao := dao.PatientFamilyDao{}
|
||||
patientFamily, err := patientFamilyDao.GetPatientFamilyById(familyId)
|
||||
if err != nil || patientFamily == nil {
|
||||
return "", errors.New("获取失败")
|
||||
}
|
||||
|
||||
mobile = patientFamily.Mobile
|
||||
}
|
||||
|
||||
return mobile, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user