|
@@ -123,15 +123,13 @@ namespace Hotline.Users
|
|
|
/// <param name="TelNo"></param>
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<TrOnDutyResponseDto> TrOnDutyAsync(string userId,string? TelId,string? TelNo,CancellationToken cancellationToken)
|
|
|
+ public async Task<TrOnDutyResponseDto> TrOnDutyAsync(string userId, string? TelId, string? TelNo, string? TelPwd, string? Description,CancellationToken cancellationToken)
|
|
|
{
|
|
|
var workingTel = await _workRepository.GetCurrentWorkByUserAsync(userId, cancellationToken);
|
|
|
if (workingTel is not null)
|
|
|
{
|
|
|
- var telModel = await _trClient.QueryTelsAsync(new Tr.Sdk.Tels.QueryTelRequest() { TelNo = TelNo }, cancellationToken);
|
|
|
- return new TrOnDutyResponseDto() { TelNo = workingTel.TelNo, TelPwd = telModel[0].Password,Description = telModel[0].Description };
|
|
|
+ return new TrOnDutyResponseDto() { TelNo = workingTel.TelNo, TelPwd = workingTel.TelPwd, Description = workingTel.Description };
|
|
|
}
|
|
|
-
|
|
|
|
|
|
//检查配置
|
|
|
bool IsNeedTelNo = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.IsNeedTelNo).SettingValue[0]);
|
|
@@ -157,10 +155,7 @@ namespace Hotline.Users
|
|
|
rsp.TelPwd = telModel[0].Password;
|
|
|
rsp.Description = telModel[0].Description;
|
|
|
}
|
|
|
- if (!IsNeedTelNo || !IsTelNeedVerify)
|
|
|
- {
|
|
|
- rsp.TelPwd = string.Empty;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
rsp.TelNo = TelNo;
|
|
|
|
|
@@ -169,8 +164,13 @@ namespace Hotline.Users
|
|
|
if (telIsWorking)
|
|
|
throw UserFriendlyException.SameMessage("当前分机已被占用");
|
|
|
|
|
|
- var work = new Work(userId, user.Name, TelId, TelNo);
|
|
|
+ var work = new Work(userId, user.Name, TelId, TelNo,rsp.TelPwd,rsp.Description);
|
|
|
await _workRepository.AddAsync(work, cancellationToken);
|
|
|
+
|
|
|
+ if (!IsNeedTelNo || !IsTelNeedVerify)
|
|
|
+ {
|
|
|
+ rsp.TelPwd = string.Empty;
|
|
|
+ }
|
|
|
return rsp;
|
|
|
}
|
|
|
|