|
@@ -125,6 +125,14 @@ namespace Hotline.Users
|
|
|
/// <returns></returns>
|
|
|
public async Task<TrOnDutyResponseDto> TrOnDutyAsync(string userId,string? TelId,string? TelNo,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 };
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//检查配置
|
|
|
bool IsNeedTelNo = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.IsNeedTelNo).SettingValue[0]);
|
|
|
if (IsNeedTelNo && string.IsNullOrEmpty(TelNo))
|
|
@@ -147,6 +155,7 @@ namespace Hotline.Users
|
|
|
var telModel = await _trClient.QueryTelsAsync(new Tr.Sdk.Tels.QueryTelRequest() { TelNo = TelNo }, cancellationToken);
|
|
|
TelId = telModel[0].Id;
|
|
|
rsp.TelPwd = telModel[0].Password;
|
|
|
+ rsp.Description = telModel[0].Description;
|
|
|
}
|
|
|
if (!IsNeedTelNo || !IsTelNeedVerify)
|
|
|
{
|
|
@@ -154,9 +163,7 @@ namespace Hotline.Users
|
|
|
}
|
|
|
|
|
|
rsp.TelNo = TelNo;
|
|
|
- var workingTel = await _workRepository.GetCurrentWorkByUserAsync(userId, cancellationToken);
|
|
|
- if (workingTel is not null)
|
|
|
- throw UserFriendlyException.SameMessage($"当前用户已上班,userId:{userId}");
|
|
|
+
|
|
|
|
|
|
var telIsWorking = await _workRepository.AnyAsync(d => d.TelId == TelId && !d.EndTime.HasValue, cancellationToken);
|
|
|
if (telIsWorking)
|