- 实现了Android SDK的完整IM功能接口,包括消息、群组、好友、会话等核心功能 - 添加了消息收发、历史记录、撤回编辑等完整的消息操作能力 - 实现了群组管理功能,包括创建、成员管理、权限设置等操作 - 添加了好友关系链管理,支持添加、删除、分组等操作 - 实现了会话管理功能,包括置顶、免打扰、已读状态等 - 添加了黑名单、资料管理、搜索等辅助功能 - 补齐了批量操作接口,提升客户端操作效率 - 实现了WebSocket连接管理和事件监听机制 - 添加了离线消息同步和状态管理功能
62 行
2.1 KiB
Java
62 行
2.1 KiB
Java
package com.xuqm.im.service;
|
|
|
|
import com.xuqm.common.exception.BusinessException;
|
|
import com.xuqm.im.entity.WebhookConfigEntity;
|
|
import com.xuqm.im.repository.WebhookConfigRepository;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
|
|
@Service
|
|
public class WebhookConfigService {
|
|
|
|
private final WebhookConfigRepository repository;
|
|
|
|
public WebhookConfigService(WebhookConfigRepository repository) {
|
|
this.repository = repository;
|
|
}
|
|
|
|
public List<WebhookConfigEntity> list(String appId) {
|
|
return repository.findByAppId(appId);
|
|
}
|
|
|
|
public WebhookConfigEntity get(String appId, String id) {
|
|
return repository.findByIdAndAppId(id, appId)
|
|
.orElseThrow(() -> new BusinessException(404, "回调配置不存在"));
|
|
}
|
|
|
|
public WebhookConfigEntity create(String appId, String url, String secret, Boolean enabled) {
|
|
WebhookConfigEntity entity = new WebhookConfigEntity();
|
|
entity.setId(UUID.randomUUID().toString());
|
|
entity.setAppId(appId);
|
|
entity.setUrl(url);
|
|
entity.setSecret(secret);
|
|
entity.setEnabled(enabled == null || enabled);
|
|
entity.setCreatedAt(LocalDateTime.now());
|
|
return repository.save(entity);
|
|
}
|
|
|
|
public WebhookConfigEntity update(String appId, String id, String url, String secret, Boolean enabled) {
|
|
WebhookConfigEntity entity = repository.findByIdAndAppId(id, appId)
|
|
.orElseThrow(() -> new BusinessException(404, "回调配置不存在"));
|
|
if (url != null) {
|
|
entity.setUrl(url);
|
|
}
|
|
if (secret != null) {
|
|
entity.setSecret(secret);
|
|
}
|
|
if (enabled != null) {
|
|
entity.setEnabled(enabled);
|
|
}
|
|
return repository.save(entity);
|
|
}
|
|
|
|
public void delete(String appId, String id) {
|
|
WebhookConfigEntity entity = repository.findByIdAndAppId(id, appId)
|
|
.orElseThrow(() -> new BusinessException(404, "回调配置不存在"));
|
|
repository.delete(entity);
|
|
}
|
|
}
|