|
@@ -386,11 +386,11 @@ namespace WingNotificationModule.Service
|
|
|
{
|
|
|
tokens = await _authenticationService.GetTokensWithClientIdAsync(new GetTokensWithClientIdRequest() { ClientId = request.ClientId });
|
|
|
}
|
|
|
- var tokenInfo = tokens.FirstOrDefault() ?? new TokenDTO();
|
|
|
+ var tokenInfo = tokens?.FirstOrDefault() ?? new TokenDTO();
|
|
|
string accountName = "";
|
|
|
- if (string.IsNullOrEmpty(tokenInfo.ClientId))
|
|
|
+ if (string.IsNullOrEmpty(tokenInfo?.ClientId))
|
|
|
{
|
|
|
- if (broadcastRequest.ReceiverType == ApplicantTypeEnum.Client)
|
|
|
+ if (request.ReceiverType == ApplicantTypeEnum.Client)
|
|
|
{
|
|
|
var userList = CacheMaintenance.Instance.Get<IUserInfoManager>().Where(x => x.Code == request.ClientId)?.ToList() ?? new List<CacheUserDTO>();
|
|
|
if (userList.Count > 0)
|
|
@@ -406,7 +406,7 @@ namespace WingNotificationModule.Service
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else if (broadcastRequest.ReceiverType == ApplicantTypeEnum.Device)
|
|
|
+ else if (request.ReceiverType == ApplicantTypeEnum.Device)
|
|
|
{
|
|
|
var deviceList = CacheMaintenance.Instance.Get<IDeviceInfosManager>().Where(x => x.Code == request.ClientId)?.ToList() ?? new List<CacheDeviceDTO>();
|
|
|
if (deviceList.Count > 0)
|
|
@@ -421,17 +421,22 @@ namespace WingNotificationModule.Service
|
|
|
accountName = tokenInfo.AccountName;
|
|
|
}
|
|
|
var clientInfos = new List<ClientInfoDTO>()
|
|
|
- {
|
|
|
- new ClientInfoDTO() {
|
|
|
- ClientId = request.ClientId,
|
|
|
- Name = accountName,
|
|
|
- IsReaded = false
|
|
|
- }
|
|
|
- };
|
|
|
+ {
|
|
|
+ new ClientInfoDTO() {
|
|
|
+ ClientId = request.ClientId,
|
|
|
+ Name = accountName,
|
|
|
+ IsReaded = false
|
|
|
+ }
|
|
|
+ };
|
|
|
JObject jsonObj = JObject.Parse(request.JsonMessage);
|
|
|
+ var code = "";
|
|
|
+ if (jsonObj.ContainsKey("Code"))
|
|
|
+ {
|
|
|
+ code = jsonObj["Code"].ToString();
|
|
|
+ }
|
|
|
req = new AddMessagesDBRequest()
|
|
|
{
|
|
|
- Code = jsonObj["Code"].ToString(),
|
|
|
+ Code = code,
|
|
|
NotificationType = request.NotificationType,
|
|
|
Content = request.JsonMessage,
|
|
|
ServerHost = ConfigurationManager.Host,
|
|
@@ -494,9 +499,14 @@ namespace WingNotificationModule.Service
|
|
|
}
|
|
|
}
|
|
|
JObject jsonObj = JObject.Parse(broadcastRequest.JsonMessage);
|
|
|
+ var code = "";
|
|
|
+ if (jsonObj.ContainsKey("Code"))
|
|
|
+ {
|
|
|
+ code = jsonObj["Code"].ToString();
|
|
|
+ }
|
|
|
req = new AddMessagesDBRequest()
|
|
|
{
|
|
|
- Code = jsonObj["Code"].ToString(),
|
|
|
+ Code = code,
|
|
|
NotificationType = broadcastRequest.NotificationType,
|
|
|
Content = broadcastRequest.JsonMessage,
|
|
|
ServerHost = ConfigurationManager.Host,
|