feat:机器人消息模板管理
This commit is contained in:
parent
73e8458a8a
commit
28c0f10625
@ -58,6 +58,13 @@ public class AccountRegister extends BaseEntity<AccountRegister> implements Ser
|
||||
*/
|
||||
@TableField("app_key")
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* channel 服务提供商
|
||||
*/
|
||||
@TableField("channel_provider")
|
||||
private String channelProvider;
|
||||
|
||||
/**
|
||||
* 账户类型:机器人、普通用户
|
||||
*/
|
||||
|
||||
@ -60,9 +60,8 @@ public class AccountService {
|
||||
}
|
||||
String userIdWrapper = userAccountReq.getUserId() + "_" + appTypeEnum.getCode();
|
||||
//后续AppKey可能会更换,普通用户通过userId、appType、appKey维度来保证唯一性
|
||||
UserAccountResp userAccountResp = createAccountRegister(userAccountReq.getUserId(),
|
||||
userIdWrapper, appType, AccountTypeEnum.USER.getCode(),
|
||||
userAccountReq.getHeadImageUrl(), userAccountReq.getNickName());
|
||||
UserAccountResp userAccountResp = createAccountRegister(userAccountReq.getUserId(), userIdWrapper, appType,
|
||||
AccountTypeEnum.USER.getCode(), userAccountReq.getHeadImageUrl(), userAccountReq.getNickName());
|
||||
return userAccountResp;
|
||||
}
|
||||
|
||||
@ -82,23 +81,25 @@ public class AccountService {
|
||||
public UserAccountResp createAccountRegister(String userId, String userIdWrapper, String appType,
|
||||
String accountType, String headImageUrl, String nickName) {
|
||||
//1.检查账户是否已经创建
|
||||
String appKey = imChannelProvider.getProviderAppKey();
|
||||
AccountRegister accountRegister = accountRegisterDao.lambdaQuery().eq(AccountRegister::getIsDelete, 0)
|
||||
.eq(AccountRegister::getAccountWrapper, userIdWrapper)
|
||||
.eq(AccountRegister::getAppKey, imChannelProvider.getProviderAppKey()).one();
|
||||
.eq(AccountRegister::getAppKey, appKey).one();
|
||||
if (accountRegister == null) {
|
||||
accountRegister = new AccountRegister();
|
||||
}
|
||||
if (StringUtils.isBlank(accountRegister.getImAccount())) {
|
||||
//2.重新注册账户,如果已注册,就查询该账户信息
|
||||
UserAccountResp accountResp = createNimAccount(userIdWrapper, headImageUrl, nickName, imChannelProvider.getProviderAppKey());
|
||||
UserAccountResp accountResp = createNimAccount(userIdWrapper, headImageUrl, nickName, appKey);
|
||||
if (accountResp != null && StringUtils.isNotBlank(accountResp.getImAccount())) {
|
||||
accountRegister.setImAccount(accountResp.getImAccount());
|
||||
accountRegister.setToken(accountResp.getToken());
|
||||
accountRegister.setAppKey(imChannelProvider.getProviderAppKey());
|
||||
accountRegister.setAppKey(appKey);
|
||||
accountRegister.setAccountId(userId);
|
||||
accountRegister.setAccountWrapper(userIdWrapper);
|
||||
accountRegister.setAccountType(accountType);
|
||||
accountRegister.setAppType(appType);
|
||||
accountRegister.setChannelProvider(imChannelProvider.getProviderAppKey());
|
||||
accountRegister.setCreateAt(new Date());
|
||||
accountRegister.setUpdateAt(new Date());
|
||||
accountRegisterDao.saveOrUpdate(accountRegister);
|
||||
|
||||
@ -42,6 +42,7 @@ CREATE TABLE IF NOT EXISTS im_account_register
|
||||
account_id varchar(100) not null comment '用户账户:机器人robotId、普通用户userId',
|
||||
account_wrapper varchar(100) not null comment '普通用户账户,通过appType包装',
|
||||
app_key varchar(100) not null comment '网易云信app_key',
|
||||
channel_provider varchar(20) not null comment 'IM服务提供商',
|
||||
im_account varchar(100) default '' not null comment '已生成IM账号',
|
||||
account_type varchar(20) default '' not null comment '账户类型:机器人、普通用户',
|
||||
app_type varchar(20) default '' not null comment 'App终端类型:WORKER、ENTERPRISE、SYSTEM',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user