Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: CI/CD Pipeline

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

env:
DOCKER_REGISTRY: ccr.ccs.tencentyun.com
DOCKER_NAMESPACE: your-namespace
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

- name: Build with Maven
run: mvn clean package -DskipTests -Pprod

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: jar-files
path: "**/target/*.jar"
retention-days: 7

docker-build:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: jar-files
path: .

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Tencent Cloud Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}

- name: Build and push im-gateway
uses: docker/build-push-action@v4
with:
context: ./im-gateway
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/im-gateway:${{ github.sha }}

- name: Build and push ruoyi-auth
uses: docker/build-push-action@v4
with:
context: ./framework/ruoyi-auth
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-auth:${{ github.sha }}

- name: Build and push ruoyi-system
uses: docker/build-push-action@v4
with:
context: ./framework/ruoyi-modules/ruoyi-system
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-system:${{ github.sha }}

- name: Build and push ruoyi-gen
uses: docker/build-push-action@v4
with:
context: ./framework/ruoyi-modules/ruoyi-gen
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-gen:${{ github.sha }}

- name: Build and push ruoyi-job
uses: docker/build-push-action@v4
with:
context: ./framework/ruoyi-modules/ruoyi-job
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-job:${{ github.sha }}

- name: Build and push ruoyi-resource
uses: docker/build-push-action@v4
with:
context: ./framework/ruoyi-modules/ruoyi-resource
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-resource:${{ github.sha }}

- name: Build and push im-core-server
uses: docker/build-push-action@v4
with:
context: ./im-core/im-core-server
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/im-core-server:${{ github.sha }}


deploy:
needs: docker-build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
steps:
- name: Deploy to production
run: echo "Deployment steps would go here"
- name: Manual approval
uses: trstringer/manual-approval@v1
with:
secret: ${{ github.token }}
approvers: your-github-username
minimum-approvals: 1
exclude-authors: github-actions[bot]
130 changes: 130 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
stages:
- build
- docker-build
- docker-push
- deploy

variables:
DOCKER_REGISTRY: ccr.ccs.tencentyun.com # 腾讯云容器镜像仓库地址
DOCKER_NAMESPACE: your-namespace # 替换为你的命名空间
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"

# 缓存Maven依赖
cache:
paths:
- .m2/repository/
- target/

# 构建阶段
build:
stage: build
image: maven:3.8.6-openjdk-17
script:
- mvn clean package -DskipTests -Pprod
artifacts:
paths:
- "**/target/*.jar"
expire_in: 1 week

# 构建Docker镜像
docker-build:
stage: docker-build
image: docker:20.10.16
services:
- docker:20.10.16-dind
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
script:
# 登录腾讯云容器镜像仓库
- echo "$DOCKER_REGISTRY_PASSWORD" | docker login -u "$DOCKER_REGISTRY_USERNAME" --password-stdin $DOCKER_REGISTRY

# 构建网关服务镜像
- cd im-gateway
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/im-gateway:$CI_COMMIT_SHORT_SHA .
- cd ..

# 构建认证服务镜像
- cd framework/ruoyi-auth
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-auth:$CI_COMMIT_SHORT_SHA .
- cd ../..

# 构建系统服务镜像
- cd framework/ruoyi-modules/ruoyi-system
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-system:$CI_COMMIT_SHORT_SHA .
- cd ../../..

# 构建代码生成服务镜像
- cd framework/ruoyi-modules/ruoyi-gen
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-gen:$CI_COMMIT_SHORT_SHA .
- cd ../../..

# 构建定时任务服务镜像
- cd framework/ruoyi-modules/ruoyi-job
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-job:$CI_COMMIT_SHORT_SHA .
- cd ../../..

# 构建资源服务镜像
- cd framework/ruoyi-modules/ruoyi-resource
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-resource:$CI_COMMIT_SHORT_SHA .
- cd ../../..

# 构建工作流服务镜像
- cd framework/ruoyi-modules/ruoyi-workflow
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-workflow:$CI_COMMIT_SHORT_SHA .
- cd ../../..

# 构建AI服务镜像
- cd im-core/ai-server
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ai-server:$CI_COMMIT_SHORT_SHA .
- cd ../..

# 构建核心服务镜像
- cd im-core/im-core-server
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/im-core-server:$CI_COMMIT_SHORT_SHA .
- cd ../..

# 构建开放API服务镜像
- cd im-core/rest-open-api-server
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/rest-open-api-server:$CI_COMMIT_SHORT_SHA .
- cd ../..

# 推送Docker镜像
docker-push:
stage: docker-push
image: docker:20.10.16
services:
- docker:20.10.16-dind
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
script:
# 登录腾讯云容器镜像仓库
- echo "$DOCKER_REGISTRY_PASSWORD" | docker login -u "$DOCKER_REGISTRY_USERNAME" --password-stdin $DOCKER_REGISTRY

# 推送所有服务镜像
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/im-gateway:$CI_COMMIT_SHORT_SHA
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-auth:$CI_COMMIT_SHORT_SHA
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-system:$CI_COMMIT_SHORT_SHA
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-gen:$CI_COMMIT_SHORT_SHA
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-job:$CI_COMMIT_SHORT_SHA
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-resource:$CI_COMMIT_SHORT_SHA
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-workflow:$CI_COMMIT_SHORT_SHA
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ai-server:$CI_COMMIT_SHORT_SHA
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/im-core-server:$CI_COMMIT_SHORT_SHA
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/rest-open-api-server:$CI_COMMIT_SHORT_SHA

# 部署阶段(可选)
deploy:
stage: deploy
image: alpine:latest
script:
- echo "Deployment steps would go here"
when: manual # 手动触发部署
only:
- master # 只在master分支上运行
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public static void main(String[] args) {
SpringApplication application = new SpringApplication(RuoYiAuthApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("认证授权中心启动成功");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public static void main(String[] args) {
SpringApplication application = new SpringApplication(RuoYiDemoApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ 演示模块启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("演示模块启动成功");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void main(String[] args) {
SpringApplication application = new SpringApplication(RuoYiTestMqApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ MQ案例模块启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("MQ案例模块启动成功");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public static void main(String[] args) {
SpringApplication application = new SpringApplication(RuoYiGenApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ 代码生成模块启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("代码生成模块启动成功");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void main(String[] args) {
SpringApplication application = new SpringApplication(RuoYiJobApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ 任务调度模块启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("任务调度模块启动成功");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public static void main(String[] args) {
SpringApplication application = new SpringApplication(RuoYiResourceApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ 资源服务模块启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("资源服务模块启动成功");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public static void main(String[] args) {
SpringApplication application = new SpringApplication(RuoYiSystemApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("系统模块启动成功");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public static void main(String[] args) {
SpringApplication application = new SpringApplication(RuoYiWorkflowApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ 工作流模块启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("工作流模块启动成功");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
public class RuoYiMonitorApplication {
public static void main(String[] args) {
SpringApplication.run(RuoYiMonitorApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 监控中心启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("监控中心启动成功");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public static void main(String[] args) {
SpringApplication application = new SpringApplication(ImCoreServerApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ ImCoreServer启动成功 ლ(´ڡ`ლ)゙ ");
System.out.println("ImCoreServer启动成功");
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.imai.core.api.controller;

import com.imai.core.domain.bo.ImConversationBo;
import com.imai.core.domain.bo.ImGroupConversationBo;
import com.imai.core.domain.vo.ImConversationVo;
import com.imai.core.service.IImConversationService;
import com.imai.ws.enums.ConversationType;
import com.imai.ws.enums.ConversationTypeEnum;

import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
Expand All @@ -19,7 +18,6 @@
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.web.core.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand Down Expand Up @@ -124,17 +122,17 @@ public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PostMapping("/createStranger/{targetUserId}")
public R<ImConversationVo> createStrangerConversation(@NotNull(message = "目标用户ID不能为空") @PathVariable Long targetUserId) {
ImConversationBo bo = new ImConversationBo();
bo.setConversationType((long) ConversationType.STRANGER_CHAT.getCode()); // 陌生人单聊类型
bo.setConversationType((long) ConversationTypeEnum.STRANGER_CHAT.getCode()); // 陌生人单聊类型
bo.setConversationStatus(1L); // 正常状态
bo.setDeleted(0L); // 未删除
// bo.setExtras("{}"); // 默认空的扩展属性

// 调用服务创建陌生人会话
Boolean success = imConversationService.createStrangerConversation(bo, targetUserId);
if (!success) {
return R.fail("创建陌生人会话失败");
}

return R.ok(imConversationService.queryById(bo.getId()));
}

Expand Down
Loading
Loading