diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 31a401273..cbdefccf7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,18 +18,18 @@ cd backend 以IDEA编辑器为例,IDEA打开backend文件夹。 - 设置VM Option,最好运行在其他端口,非8080,这里设置8081 +- 设置jdk版本为java 17 ```shell -Dserver.port=8081 ``` -![CleanShot 2025-08-04 at 11 .35.49.png](https://openisle-1307107697.cos.accelerate.myqcloud.com/dynamic_assert/4cf210cfc6ea478a80dfc744c85ccdc4.png) - -- 设置jdk版本为java 17 - -![CleanShot 2025-08-04 at 11 .38.03@2x.png](https://openisle-1307107697.cos.accelerate.myqcloud.com/dynamic_assert/392eeec753ae436ca12a78f750dfea2d.png) +![配置1](contributing_img\backend_img_3.png) +![配置2](contributing_img\backend_img_2.png) - 本机配置MySQL服务(网上很多教程,忽略) + + 可以用Laragon,自带MySQL包括Nodejs,版本建议6.x,7以后需要Lisence + + 下载地址(https://github.com/leokhoa/laragon/releases) - 设置环境变量.env 文件 或.properties 文件(二选一) 1. 环境变量文件生成 @@ -40,21 +40,24 @@ cp open-isle.env.example open-isle.env 修改环境变量,留下需要的,比如你要开发Google登录业务,就需要谷歌相关的变量,数据库是一定要的 -![CleanShot 2025-08-04 at 11 .41.36@2x.png](https://openisle-1307107697.cos.accelerate.myqcloud.com/dynamic_assert/896c8363b6e64ea19d18c12ec4dae2b4.png) +![环境变量](contributing_img\backend_img_7.png) 应用环境文件, 选择刚刚的`open-isle.env` -![CleanShot 2025-08-04 at 11 .44.41.png](https://openisle-1307107697.cos.accelerate.myqcloud.com/dynamic_assert/f588e37838014a6684c141605639b9fa.png) +![环境变量](contributing_img\backend_img_6.png) -2. 直接修改 .properities 文件 +1. 直接修改 .properities 文件 位置src/main/application.properties, 数据库需要修改标红处,其他按需修改 -![CleanShot 2025-08-04 at 11 .47.11@2x.png](https://openisle-1307107697.cos.accelerate.myqcloud.com/dynamic_assert/28c3104448a245419e0b06aee861abb4.png) +![配置数据库](contributing_img\backend_img_5.png) + +执行db/init.sql脚本,导入基本的数据 +![初始化脚本](contributing_img\resources_img.png) 处理完环境问题直接跑起来就能通了 -![CleanShot 2025-08-04 at 11 .49.01@2x.png](https://openisle-1307107697.cos.accelerate.myqcloud.com/dynamic_assert/2c945eae44b1477db09e80fc96b5e02d.png) +![运行画面](contributing_img\backend_img_4.png) > Step3 前端部署 @@ -68,46 +71,25 @@ cd ../frontend_nuxt/ copy环境.env文件 + +利用预发环境 +**(⚠️强烈推荐只部署前端的朋友使用该环境)** ```shell cp .env.staging.example .env ``` -1. 依赖本机部署的后端:打开本文件夹,修改.env 修改为瞄准本机后端端口 - -```yaml -; 本地部署后端 -NUXT_PUBLIC_API_BASE_URL=http://127.0.0.1:8081 -; 预发环境后端 -; NUXT_PUBLIC_API_BASE_URL=https://staging.open-isle.com -; 生产环境后端 -; NUXT_PUBLIC_API_BASE_URL=https://www.open-isle.com -; 开发环境 -NUXT_PUBLIC_WEBSITE_BASE_URL=localhost:3000 +利用生产环境 +```shell +cp .env.production.example .env ``` -2. 依赖预发环境后台环境 - -**(⚠️强烈推荐只部署前端的朋友使用该环境)** - -```yaml -; 本地部署后端 -; NUXT_PUBLIC_API_BASE_URL=https://127.0.0.1:8081 -; 预发环境后端 -NUXT_PUBLIC_API_BASE_URL=https://staging.open-isle.com -; 生产环境后端 -; NUXT_PUBLIC_API_BASE_URL=https://www.open-isle.com +利用本地环境 +```shell +cp .env.dev.example .env ``` -4. 依赖线上后台环境 -```yaml -; 本地部署后端 -; NUXT_PUBLIC_API_BASE_URL=https://127.0.0.1:8081 -; 预发环境后端 -; NUXT_PUBLIC_API_BASE_URL=https://staging.open-isle.com -; 生产环境后端 -NUXT_PUBLIC_API_BASE_URL=https://www.open-isle.com -``` +前端安装编译运行 ```shell # 安装依赖 @@ -118,3 +100,17 @@ npm run dev ``` 如此一来,浏览器访问 http://127.0.0.1:3000 即可访问前端页面 + +## 其他配置 +1. 配置第三方登录 + +这里以github为例 +修改application.properties配置 +![后端配置](contributing_img\backend_img.png) + +修改.env配置 +![前端](contributing_img\fontend_img.png) + +配置第三方登录回调地址 +![github配置](contributing_img\github_img.png) +![github配置2](contributing_img\github_img_2.png) \ No newline at end of file diff --git a/backend/src/main/resources/db/init/init_script.sql b/backend/src/main/resources/db/init/init_script.sql new file mode 100644 index 000000000..bf3ab1099 --- /dev/null +++ b/backend/src/main/resources/db/init/init_script.sql @@ -0,0 +1,27 @@ +-- 2025-09-02 +-- 本地化开发,初始化脚本 +-- 抽奖的时候奖品图片是必须的,把相关代码注释掉即可跳过check + +-- 清空users表 +DELETE FROM `users`; +-- 插入用户,两个普通用户,一个管理员 +INSERT INTO `users` (`id`, `approved`, `avatar`, `created_at`, `display_medal`, `email`, `experience`, `introduction`, `password`, `password_reset_code`, `point`, `register_reason`, `role`, `username`, `verification_code`, `verified`) VALUES + (1, b'1', '', '2025-09-01 16:08:17.426430', 'PIONEER', 'adminmail@openisle.com', 70, NULL, '$2a$10$m.lLbT3wFtnzFMi7JqN17ecv/dzH704WzU1f/xvQ0nVz4XxTXPT0K', NULL, 110, '测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试', 'ADMIN', '管理员', NULL, b'1'), + (2, b'1', '', '2025-09-03 16:08:17.426430', 'PIONEER', 'usermail2@openisle.com', 70, NULL, '$2a$10$m.lLbT3wFtnzFMi7JqN17ecv/dzH704WzU1f/xvQ0nVz4XxTXPT0K', NULL, 110, '测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试', 'USER', '普通用户2', NULL, b'1'), + (3, b'1', '', '2025-09-02 17:21:21.617666', 'PIONEER', 'usermail1@openisle.com', 40, NULL, '$2a$10$m.lLbT3wFtnzFMi7JqN17ecv/dzH704WzU1f/xvQ0nVz4XxTXPT0K', NULL, 40, '测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试', 'USER', '普通用户1', NULL, b'1'); + +-- 清空tags表 +DELETE FROM `tags`; +-- 插入标签,三个测试用标签 +INSERT INTO `tags` (`id`, `approved`, `created_at`, `description`, `icon`, `name`, `small_icon`, `creator_id`) VALUES + (1, b'1', '2025-09-02 10:51:56.000000', '测试用标签1', NULL, '测试用标签1', NULL, NULL), + (2, b'1', '2025-09-02 10:51:56.000000', '测试用标签2', NULL, '测试用标签2', NULL, NULL), + (3, b'1', '2025-09-02 10:51:56.000000', '测试用标签3', NULL, '测试用标签3', NULL, NULL); + +-- 清空categories表 +DELETE FROM `categories`; +-- 插入分类,三个测试用分类 +INSERT INTO `categories` (`id`, `description`, `icon`, `name`, `small_icon`) VALUES + (1, '测试用分类1', '1', '测试用分类1', NULL), + (2, '测试用分类2', '2', '测试用分类2', NULL), + (3, '测试用分类3', '3', '测试用分类3', NULL); \ No newline at end of file diff --git a/contributing_img/backend_img.png b/contributing_img/backend_img.png new file mode 100644 index 000000000..5084f5ff6 Binary files /dev/null and b/contributing_img/backend_img.png differ diff --git a/contributing_img/backend_img_2.png b/contributing_img/backend_img_2.png new file mode 100644 index 000000000..94cd3fb48 Binary files /dev/null and b/contributing_img/backend_img_2.png differ diff --git a/contributing_img/backend_img_3.png b/contributing_img/backend_img_3.png new file mode 100644 index 000000000..948a44c03 Binary files /dev/null and b/contributing_img/backend_img_3.png differ diff --git a/contributing_img/backend_img_4.png b/contributing_img/backend_img_4.png new file mode 100644 index 000000000..263352f10 Binary files /dev/null and b/contributing_img/backend_img_4.png differ diff --git a/contributing_img/backend_img_5.png b/contributing_img/backend_img_5.png new file mode 100644 index 000000000..a2aa10377 Binary files /dev/null and b/contributing_img/backend_img_5.png differ diff --git a/contributing_img/backend_img_6.png b/contributing_img/backend_img_6.png new file mode 100644 index 000000000..66d675da5 Binary files /dev/null and b/contributing_img/backend_img_6.png differ diff --git a/contributing_img/backend_img_7.png b/contributing_img/backend_img_7.png new file mode 100644 index 000000000..1a6c75385 Binary files /dev/null and b/contributing_img/backend_img_7.png differ diff --git a/contributing_img/fontend_img.png b/contributing_img/fontend_img.png new file mode 100644 index 000000000..d622416ea Binary files /dev/null and b/contributing_img/fontend_img.png differ diff --git a/contributing_img/github_img.png b/contributing_img/github_img.png new file mode 100644 index 000000000..b6b9fc688 Binary files /dev/null and b/contributing_img/github_img.png differ diff --git a/contributing_img/github_img_2.png b/contributing_img/github_img_2.png new file mode 100644 index 000000000..288b59489 Binary files /dev/null and b/contributing_img/github_img_2.png differ diff --git a/contributing_img/resources_img.png b/contributing_img/resources_img.png new file mode 100644 index 000000000..3b1d95c00 Binary files /dev/null and b/contributing_img/resources_img.png differ diff --git a/frontend_nuxt/.env.dev.example b/frontend_nuxt/.env.dev.example new file mode 100644 index 000000000..3a38feb58 --- /dev/null +++ b/frontend_nuxt/.env.dev.example @@ -0,0 +1,9 @@ +; 本地部署后端 +NUXT_PUBLIC_API_BASE_URL=https://127.0.0.1:8081 +NUXT_PUBLIC_WEBSITE_BASE_URL=http://localhost:3000 + +NUXT_PUBLIC_GOOGLE_CLIENT_ID=777830451304-nt8afkkap18gui4f9entcha99unal744.apps.googleusercontent.com +NUXT_PUBLIC_GITHUB_CLIENT_ID=Ov23liVkO1NPAX5JyWxJ +NUXT_PUBLIC_DISCORD_CLIENT_ID=1394985417044000779 +NUXT_PUBLIC_TWITTER_CLIENT_ID=ZTRTU05KSk9KTTJrTTdrVC1tc1E6MTpjaQ +NUXT_PUBLIC_TELEGRAM_BOT_ID=8450237135 diff --git a/frontend_nuxt/.env.production.example b/frontend_nuxt/.env.production.example new file mode 100644 index 000000000..273a2dff6 --- /dev/null +++ b/frontend_nuxt/.env.production.example @@ -0,0 +1,11 @@ + +; 生产环境后端 +NUXT_PUBLIC_API_BASE_URL=https://open-isle.com +; 正式环境/生产环境 +NUXT_PUBLIC_WEBSITE_BASE_URL=https://open-isle.com + +NUXT_PUBLIC_GOOGLE_CLIENT_ID=777830451304-nt8afkkap18gui4f9entcha99unal744.apps.googleusercontent.com +NUXT_PUBLIC_GITHUB_CLIENT_ID=Ov23liVkO1NPAX5JyWxJ +NUXT_PUBLIC_DISCORD_CLIENT_ID=1394985417044000779 +NUXT_PUBLIC_TWITTER_CLIENT_ID=ZTRTU05KSk9KTTJrTTdrVC1tc1E6MTpjaQ +NUXT_PUBLIC_TELEGRAM_BOT_ID=8450237135 diff --git a/frontend_nuxt/.env.staging.example b/frontend_nuxt/.env.staging.example index 3a2a26b41..858d1e46b 100644 --- a/frontend_nuxt/.env.staging.example +++ b/frontend_nuxt/.env.staging.example @@ -1,14 +1,7 @@ -; 本地部署后端 -; NUXT_PUBLIC_API_BASE_URL=https://127.0.0.1:8081 ; 预发环境后端 NUXT_PUBLIC_API_BASE_URL=https://staging.open-isle.com -; 生产环境后端 -; NUXT_PUBLIC_API_BASE_URL=https://open-isle.com - ; 预发环境 NUXT_PUBLIC_WEBSITE_BASE_URL=https://staging.open-isle.com -; 正式环境/生产环境 -; NUXT_PUBLIC_WEBSITE_BASE_URL=https://open-isle.com NUXT_PUBLIC_GOOGLE_CLIENT_ID=777830451304-nt8afkkap18gui4f9entcha99unal744.apps.googleusercontent.com NUXT_PUBLIC_GITHUB_CLIENT_ID=Ov23liVkO1NPAX5JyWxJ