REQ-3284: 创建用于发送自定义消息的IM账号
This commit is contained in:
parent
907fd6c62a
commit
3247dfbd33
@ -464,11 +464,28 @@ public class AccountService {
|
||||
return lambdaQuery;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Optional<AccountRegister> findCustomMessageSendAccount() {
|
||||
String appKey = imChannel.getProviderAppKey();
|
||||
AccountRegister customSendAccount = queryCustomAccount(
|
||||
AccountTypeEnum.CUSTOM, AppTypeEnum.SYSTEM, appKey);
|
||||
return Optional.ofNullable(customSendAccount);
|
||||
return Optional.of(getOrCrateCustomMessageSendAccount());
|
||||
}
|
||||
|
||||
}
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AccountRegister getOrCrateCustomMessageSendAccount() {
|
||||
AccountRegister customSendAccount = getCustomMessageSendAccount();
|
||||
if (customSendAccount == null) {
|
||||
UserAccountReq createCustomAccountReq = new UserAccountReq();
|
||||
createCustomAccountReq.setAppType("system");
|
||||
createCustomAccountReq.setUserId("custom_message");
|
||||
registerCustomAccount(createCustomAccountReq, iNotifyService);
|
||||
customSendAccount = getCustomMessageSendAccount();
|
||||
}
|
||||
return customSendAccount;
|
||||
}
|
||||
|
||||
private AccountRegister getCustomMessageSendAccount() {
|
||||
String appKey = imChannel.getProviderAppKey();
|
||||
return queryCustomAccount(
|
||||
AccountTypeEnum.CUSTOM, AppTypeEnum.SYSTEM, appKey);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user