feat(im): 添加即时通讯功能模块

- 添加了 IM API 接口定义,包含登录、消息、群组、好友等接口
- 实现了 ImSDK 核心功能,支持发送各类消息和管理会话
- 集成了 WebSocket 连接管理和自动重连机制
- 添加了本地联系人缓存并优化对话标题显示逻辑
- 实现了 HarmonyOS 平台 HTTP 客户端基础功能
这个提交包含在:
XuqmGroup 2026-04-28 16:55:12 +08:00
父节点 962e1dc722
当前提交 ec23b9890b
共有 5 个文件被更改,包括 1109 次插入1 次删除

查看文件

@ -83,7 +83,12 @@
| 平台 | Registry | 命令 | | 平台 | Registry | 命令 |
|------|----------|------| |------|----------|------|
| npm (RN SDK / Vue3 SDK) | https://nexus.xuqinmin.com/repository/npm-hosted/ | `npm publish` | | npm (RN SDK / Vue3 SDK) | https://nexus.xuqinmin.com/repository/npm-hosted/ | `npm publish` |
| Android Maven | https://nexus.xuqinmin.com/repository/android-hosted/ | `./gradlew publish` | | npm download | https://nexus.xuqinmin.com/repository/npm/ | client consumption |
| Android Maven upload | https://nexus.xuqinmin.com/repository/android-hosted/ | `./gradlew publish` |
| Android Maven download | https://nexus.xuqinmin.com/repository/android/ | client consumption |
| Java Maven upload (release) | https://nexus.xuqinmin.com/repository/maven-releases/ | `mvn deploy` |
| Java Maven upload (snapshot) | https://nexus.xuqinmin.com/repository/maven-snapshots/ | `mvn deploy` |
| Java Maven download | https://nexus.xuqinmin.com/repository/maven-public/ | client consumption |
| iOS SPM | Git Tag | `git tag x.y.z && git push origin x.y.z` | | iOS SPM | Git Tag | `git tag x.y.z && git push origin x.y.z` |
| iOS CocoaPods | https://xuqinmin.com/xuqinmin12/xuqm-specs | `pod repo push xuqm-specs XuqmSDK.podspec` | | iOS CocoaPods | https://xuqinmin.com/xuqinmin12/xuqm-specs | `pod repo push xuqm-specs XuqmSDK.podspec` |
| HarmonyOS | ohpm (OpenHarmony Package Manager) | `ohpm publish` | | HarmonyOS | ohpm (OpenHarmony Package Manager) | `ohpm publish` |

43
im-sdk/pom.xml 普通文件
查看文件

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xuqm</groupId>
<artifactId>xuqmgroup-server-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>im-sdk</artifactId>
<name>im-sdk</name>
<description>Java SDK for XuqmGroup IM service and REST APIs</description>
<dependencies>
<dependency>
<groupId>com.xuqm</groupId>
<artifactId>common</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>xuqm-maven-releases</id>
<url>https://nexus.xuqinmin.com/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>xuqm-maven-snapshots</id>
<url>https://nexus.xuqinmin.com/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>

文件差异内容过多而无法显示 加载差异

查看文件

@ -0,0 +1,50 @@
package com.xuqm.im.controller;
import com.xuqm.common.exception.BusinessException;
import com.xuqm.common.model.ApiResponse;
import com.xuqm.im.entity.ImAccountEntity;
import com.xuqm.im.service.ImAccountService;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Objects;
@RestController
@RequestMapping("/api/im/accounts")
public class AccountController {
private final ImAccountService accountService;
public AccountController(ImAccountService accountService) {
this.accountService = accountService;
}
@GetMapping("/{userId}")
public ResponseEntity<ApiResponse<ImAccountEntity>> get(
@AuthenticationPrincipal String currentUserId,
@RequestParam String appId,
@PathVariable String userId) {
return ResponseEntity.ok(ApiResponse.success(accountService.getAccount(appId, userId)));
}
@PutMapping("/{userId}")
public ResponseEntity<ApiResponse<ImAccountEntity>> update(
@AuthenticationPrincipal String currentUserId,
@RequestParam String appId,
@PathVariable String userId,
@RequestParam(required = false) String nickname,
@RequestParam(required = false) String avatar,
@RequestParam(required = false) ImAccountEntity.Gender gender) {
if (!Objects.equals(currentUserId, userId)) {
throw new BusinessException(403, "Only the account owner can update profile");
}
return ResponseEntity.ok(ApiResponse.success(
accountService.updateAccount(appId, userId, nickname, avatar, gender)));
}
}

查看文件

@ -15,6 +15,7 @@
<module>common</module> <module>common</module>
<module>tenant-service</module> <module>tenant-service</module>
<module>im-service</module> <module>im-service</module>
<module>im-sdk</module>
<module>push-service</module> <module>push-service</module>
<module>update-service</module> <module>update-service</module>
<module>demo-service</module> <module>demo-service</module>