更新项目文档;一些小改动
This commit is contained in:
parent
68217b81dc
commit
d4edba9212
138
README.md
138
README.md
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
代码仓库:[GitHub](https://github.com/coder-xiaomo/epp) [Gitee](https://gitee.com/coder-xiaomo/epp) [自建](https://git.only4.work/coder-xiaomo/epp)
|
代码仓库:[GitHub](https://github.com/coder-xiaomo/epp) [Gitee](https://gitee.com/coder-xiaomo/epp) [自建](https://git.only4.work/coder-xiaomo/epp)
|
||||||
|
|
||||||
|
本项目采用 monorepo 单仓库模式进行维护,项目完整代码均在此仓库中。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
@ -308,16 +310,24 @@ npm run package
|
|||||||
|
|
||||||
##### 配置业务域名
|
##### 配置业务域名
|
||||||
|
|
||||||
TODO
|
修改 `backend/microservice-provider-access-8002/src/main/resources/static/access/renderer.js` 文件
|
||||||
|
|
||||||
修改 `backend\microservice-provider-access-8002\src\main\resources\static\access\assets\js\websocket.js` 文件
|
|
||||||
|
|
||||||
```
|
```
|
||||||
window.wsUrl = 'ws://127.0.0.1:80/access/websocket/1';
|
const baseUrl = "https://【⚠此处修改为你的业务域名】/" // 以 / 结尾,例如:https://epp.only4.work/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
修改 `backend/microservice-provider-access-8002/src/main/resources/static/access/assets/js/websocket.js` 文件
|
||||||
|
|
||||||
|
```
|
||||||
|
window.wsUrl = 'ws://【⚠此处修改为你的业务域名】/access/websocket/1';
|
||||||
|
```
|
||||||
|
|
||||||
|
> 注意,如果使用了 SSL 证书,那么 ws:// 要换成 wss://
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### 配置小程序 APPID 与 APPSECRET
|
##### 配置小程序 APPID 与 APPSECRET
|
||||||
|
|
||||||
修改 `backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/service/WeChatTokenServiceImpl.java` 文件
|
修改 `backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/service/WeChatTokenServiceImpl.java` 文件
|
||||||
@ -330,6 +340,16 @@ window.wsUrl = 'ws://127.0.0.1:80/access/websocket/1';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### 配置门禁端生成的小程序码环境
|
||||||
|
|
||||||
|
修改 `backend/microservice-provider-access-8002/src/main/resources/static/access/renderer.js` 文件
|
||||||
|
|
||||||
|
```
|
||||||
|
const envVersion = "【⚠此处修改为当前小程序环境】" // 正式版为 "release",体验版为 "trial",开发版为 "develop"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### 打 jar 包
|
##### 打 jar 包
|
||||||
|
|
||||||
IDEA 中右侧 Maven 双击 Lifestyle 的 package,打包完成后的 jar 包可在以下位置找到
|
IDEA 中右侧 Maven 双击 Lifestyle 的 package,打包完成后的 jar 包可在以下位置找到
|
||||||
@ -340,14 +360,52 @@ IDEA 中右侧 Maven 双击 Lifestyle 的 package,打包完成后的 jar 包
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Nacos 配置
|
||||||
|
|
||||||
|
> nacos 后台地址:http://127.0.0.1:8488/nacos/index.html
|
||||||
|
|
||||||
|
1. 进入 ,修改 nacos 登录密码(可选)
|
||||||
|
|
||||||
|
> 左侧 **权限控制** → **用户列表** → **修改**
|
||||||
|
|
||||||
|
2. 修改 nacos 端口为 8488(与后端项目配置文件中保持一致)
|
||||||
|
|
||||||
|
> nacos/conf/application.properties 中的端口号 port 改为 8488
|
||||||
|
|
||||||
|
3. 创建两个命名空间(命名空间ID分别为 `develop` 和 `production`)
|
||||||
|
|
||||||
|
> 左侧 **命名空间** → **新建命名空间**
|
||||||
|
|
||||||
|
| 命名空间名称 | 命名空间ID | 描述 | 配置数 | 操作 |
|
||||||
|
| :--------------- | :--------- | :--------- | :----- | :----------- |
|
||||||
|
| public(保留空间) | | | 0 | 详情删除编辑 |
|
||||||
|
| develop | develop | develop | 0 | 详情删除编辑 |
|
||||||
|
| production | production | production | 0 | 详情删除编辑 |
|
||||||
|
|
||||||
|
##### 新版 Nacos 需要配置密钥
|
||||||
|
|
||||||
|
**若使用的 Nacos 版本小于或等于 Nacos 2.2.0,不需要进行如下配置。**
|
||||||
|
|
||||||
|
🌟若使用的 Nacos 版本大于或等于 Nacos 2.2.0.1,则需要配置自定义密钥:
|
||||||
|
|
||||||
|
```properties
|
||||||
|
nacos.core.auth.plugin.nacos.token.secret.key=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
|
||||||
|
```
|
||||||
|
|
||||||
|
参考:https://nacos.io/zh-cn/docs/v2/guide/user/auth.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### nginx 代理配置(可选)
|
#### nginx 代理配置(可选)
|
||||||
|
|
||||||
配置文件在 `nginx-conf` 目录下(不能直接拿来用,需要根据自己的实际情况来改)
|
配置文件在 `nginx-conf` 目录下(不能直接拿来用,需要根据自己的实际情况来改)
|
||||||
|
|
||||||
|
> 以下配置仅供参考
|
||||||
|
|
||||||
```conf
|
```conf
|
||||||
server
|
server
|
||||||
{
|
{
|
||||||
server_name epp.only4.work; # ⚠ Api 业务域名
|
server_name epp.only4.work; # ⚠ Api 业务域名
|
||||||
listen 80;
|
listen 80;
|
||||||
listen 443 ssl http2;
|
listen 443 ssl http2;
|
||||||
|
|
||||||
@ -355,7 +413,7 @@ server
|
|||||||
location / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:5203; # ⚠ Gateway 微服务项目本地运行的端口
|
proxy_pass http://127.0.0.1:5203; # ⚠ Gateway 微服务项目本地运行的端口
|
||||||
|
|
||||||
# websocket
|
# websocket # ⚠ 门禁端用户扫码后通过 websocket 推送到门禁端完成开门
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "Upgrade";
|
proxy_set_header Connection "Upgrade";
|
||||||
@ -369,8 +427,6 @@ server
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 启动项目
|
## 启动项目
|
||||||
|
|
||||||
### Step0: [开发] 启动项目开发环境
|
### Step0: [开发] 启动项目开发环境
|
||||||
@ -421,23 +477,64 @@ Nacos 后台地址为:http://localhost:8848/nacos/index.html,默认用户名
|
|||||||
|
|
||||||
#### [部署&开发] 启动 MySQL
|
#### [部署&开发] 启动 MySQL
|
||||||
|
|
||||||
略
|
```
|
||||||
|
# Ubuntu 下
|
||||||
|
sudo systemctl start mysql
|
||||||
|
```
|
||||||
|
|
||||||
#### [部署&开发] 启动各个微服务
|
#### [部署&开发] 启动各个微服务
|
||||||
|
|
||||||
开发:直接在 IDEA 中启动即可
|
开发环境:Windows下
|
||||||
|
|
||||||
部署:
|
> 直接在 IDEA 中启动即可
|
||||||
|
>
|
||||||
|
> 若系统内存够用,可以适当调大内存参数,如:-Xmx1024M -Xms256M
|
||||||
|
|
||||||
```
|
```bash
|
||||||
# 启动 UserProvider
|
|
||||||
# 启动 Gateway
|
# 启动 Gateway
|
||||||
# ......
|
java -jar -Xmx512M -Xms128M -Dspring.profiles.active=develop ./microservice-gateway-0.0.1-SNAPSHOT.jar
|
||||||
|
|
||||||
|
# 启动 UserProvider
|
||||||
|
java -jar -Xmx512M -Xms128M -Dspring.profiles.active=develop ./microservice-provider-user-8001-0.0.1-SNAPSHOT.jar
|
||||||
|
|
||||||
|
# 启动 AccessProvider
|
||||||
|
java -jar -Xmx512M -Xms128M -Dspring.profiles.active=develop ./microservice-provider-access-8002-0.0.1-SNAPSHOT.jar
|
||||||
|
|
||||||
|
# 启动 ShopProvider
|
||||||
|
java -jar -Xmx512M -Xms128M -Dspring.profiles.active=develop ./microservice-provider-shop-8003-0.0.1-SNAPSHOT.jar
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
生产环境:Ubuntu下
|
||||||
|
|
||||||
|
> 假设生产环境已有如下配置:
|
||||||
|
>
|
||||||
|
> - JDK 中 java 可执行文件所在路径为:/www/wwwroot/env/jdk-11/bin/java
|
||||||
|
> - jar 包所在路径为:/www/wwwroot/workspace/
|
||||||
|
>
|
||||||
|
> 若系统内存够用,可以适当调大内存参数,如:-Xmx1024M -Xms256M
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 启动 Gateway
|
||||||
|
/www/wwwroot/env/jdk-11/bin/java -jar -Xmx512M -Xms128M -Dspring.profiles.active=production -Dserver.port=8000 /www/wwwroot/workspace/microservice-gateway-0.0.1-SNAPSHOT.jar
|
||||||
|
|
||||||
|
# 启动 UserProvider
|
||||||
|
/www/wwwroot/env/jdk-11/bin/java -jar -Xmx512M -Xms128M -Dspring.profiles.active=production /www/wwwroot/workspace/microservice-provider-user-8001-0.0.1-SNAPSHOT.jar
|
||||||
|
|
||||||
|
# 启动 AccessProvider
|
||||||
|
/www/wwwroot/env/jdk-11/bin/java -jar -Xmx512M -Xms128M -Dspring.profiles.active=production /www/wwwroot/workspace/microservice-provider-access-8002-0.0.1-SNAPSHOT.jar
|
||||||
|
|
||||||
|
# 启动 ShopProvider
|
||||||
|
/www/wwwroot/env/jdk-11/bin/java -jar -Xmx512M -Xms128M -Dspring.profiles.active=production /www/wwwroot/workspace/microservice-provider-shop-8003-0.0.1-SNAPSHOT.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
#### [可选] 启动 nginx
|
#### [可选] 启动 nginx
|
||||||
|
|
||||||
略
|
```bash
|
||||||
|
# Ubuntu 下
|
||||||
|
sudo systemctl start nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -461,6 +558,17 @@ npm run serve
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 项目相关地址
|
||||||
|
|
||||||
|
### 门禁端网页
|
||||||
|
|
||||||
|
https://epp.only4.work/access/index.html
|
||||||
|
|
||||||
|
Nacos 注册中心
|
||||||
|
|
||||||
|
http://106.75.217.14:8488/nacos/index.html
|
||||||
|
|
||||||
|
|
||||||
## 停止项目
|
## 停止项目
|
||||||
|
|
||||||
这个应该不用多说吧
|
这个应该不用多说吧
|
||||||
|
99
TODOs.md
99
TODOs.md
@ -25,9 +25,7 @@
|
|||||||
|
|
||||||
后台管理 按照id进行筛选
|
后台管理 按照id进行筛选
|
||||||
|
|
||||||
& 演示时快速创建账号
|
发给老班看一看
|
||||||
& 小程序提审(提审时隐藏小商店 调试按钮、上帝按钮)
|
|
||||||
& 发给老班看一看
|
|
||||||
|
|
||||||
数据库填充测试数据(以及创建一些测试账号)并备份,线上演示数据修改删除避免真删
|
数据库填充测试数据(以及创建一些测试账号)并备份,线上演示数据修改删除避免真删
|
||||||
|
|
||||||
@ -35,32 +33,85 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
项目开发中遇到的问题
|
更多:
|
||||||
小程序双端不一致的问题,参数转义,页面CSS样式是不完全一样的。
|
|
||||||
|
完成项目代码中的 TODO 部分
|
||||||
|
|
||||||
|
身份码后端接口考虑与其他系统的集成逻辑
|
||||||
|
|
||||||
|
Java代码中小程序AppID、密钥处理,小程序代码中小程序AppID处理
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 后端项目启动命令
|
||||||
|
|
||||||
|
```bash
|
||||||
|
; /www/wwwroot/env/jdk-11/bin/java -jar -Xmx1024M -Xms256M /www/wwwroot/workspace/microservice-gateway-0.0.1-SNAPSHOT.jar --server.port=7087
|
||||||
|
/www/wwwroot/env/jdk-11/bin/java -jar -Xmx512M -Xms128M -Dspring.profiles.active=production -Dserver.port=8000 /www/wwwroot/workspace/microservice-gateway-0.0.1-SNAPSHOT.jar
|
||||||
|
/www/wwwroot/env/jdk-11/bin/java -jar -Xmx512M -Xms128M -Dspring.profiles.active=production /www/wwwroot/workspace/microservice-provider-user-8001-0.0.1-SNAPSHOT.jar
|
||||||
|
/www/wwwroot/env/jdk-11/bin/java -jar -Xmx512M -Xms128M -Dspring.profiles.active=production /www/wwwroot/workspace/microservice-provider-access-8002-0.0.1-SNAPSHOT.jar
|
||||||
|
/www/wwwroot/env/jdk-11/bin/java -jar -Xmx512M -Xms128M -Dspring.profiles.active=production /www/wwwroot/workspace/microservice-provider-shop-8003-0.0.1-SNAPSHOT.jar
|
||||||
|
|
||||||
|
java -jar -Xmx512M -Xms128M -Dspring.profiles.active=develop ./microservice-gateway-0.0.1-SNAPSHOT.jar
|
||||||
|
java -jar -Xmx512M -Xms128M -Dspring.profiles.active=develop ./microservice-provider-user-8001-0.0.1-SNAPSHOT.jar
|
||||||
|
java -jar -Xmx512M -Xms128M -Dspring.profiles.active=develop ./microservice-provider-access-8002-0.0.1-SNAPSHOT.jar
|
||||||
|
java -jar -Xmx512M -Xms128M -Dspring.profiles.active=develop ./microservice-provider-shop-8003-0.0.1-SNAPSHOT.jar
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# BT宝塔登录密钥
|
||||||
|
|
||||||
|
==================================================================
|
||||||
|
外网面板地址: http://106.75.217.14:18734/107bb99c
|
||||||
|
内网面板地址: http://10.23.189.141:18734/107bb99c
|
||||||
|
username: qmud57rc
|
||||||
|
password: 80347b8d
|
||||||
|
If you cannot access the panel,
|
||||||
|
release the following panel port [18734] in the security group
|
||||||
|
若无法访问面板,请检查防火墙/安全组是否有放行面板[18734]端口
|
||||||
|
==================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# IP 配置
|
# IP 配置
|
||||||
|
|
||||||
develop
|
develop
|
||||||
|
|
||||||
内网穿透:106.75.217.14
|
内网穿透:106.75.217.14
|
||||||
|
|
||||||
nacos:http://106.75.217.14:8488/nacos/index.html
|
nacos:http://106.75.217.14:8488/nacos/index.html
|
||||||
|
|
||||||
数据库:本地
|
数据库:本地
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
production
|
production
|
||||||
|
|
||||||
nacos:http://106.75.217.14:8488/nacos/index.html
|
nacos:http://106.75.217.14:8488/nacos/index.html
|
||||||
|
|
||||||
数据库:服务器上
|
数据库:服务器上
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# QCloud
|
# QCloud
|
||||||
|
|
||||||
主账号ID 100014397291
|
主账号ID 100014397291
|
||||||
|
|
||||||
用户名 epp
|
用户名 epp
|
||||||
|
|
||||||
登录密码 -
|
登录密码 -
|
||||||
|
|
||||||
SecretId AKIDSkmeXTHsTqzwe8ZDiGcomW4OYXcZIerp
|
SecretId AKIDSkmeXTHsTqzwe8ZDiGcomW4OYXcZIerp
|
||||||
|
|
||||||
SecretKey 22sVt494mGZeV7sQkqwxnNjneHesqXxA
|
SecretKey 22sVt494mGZeV7sQkqwxnNjneHesqXxA
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 门禁端网页
|
# 门禁端网页
|
||||||
|
|
||||||
https://epp.only4.work/access/index.html
|
https://epp.only4.work/access/index.html
|
||||||
|
|
||||||
https://epp-prod.only4.work/access/index.html
|
https://epp-prod.only4.work/access/index.html
|
||||||
|
|
||||||
|
|
||||||
@ -69,9 +120,11 @@ https://epp-prod.only4.work/access/index.html
|
|||||||
|
|
||||||
> /www/wwwserv/epp/nacos/conf/application.properties port 改为 8488
|
> /www/wwwserv/epp/nacos/conf/application.properties port 改为 8488
|
||||||
|
|
||||||
|
```
|
||||||
cd /www/wwwserv/epp/nacos/bin
|
cd /www/wwwserv/epp/nacos/bin
|
||||||
bash startup.sh -m standalone
|
bash startup.sh -m standalone
|
||||||
bash shutdown.sh
|
bash shutdown.sh
|
||||||
|
```
|
||||||
|
|
||||||
http://106.75.217.14:8488/nacos/index.html
|
http://106.75.217.14:8488/nacos/index.html
|
||||||
nacos
|
nacos
|
||||||
@ -81,51 +134,41 @@ socan
|
|||||||
|
|
||||||
# 启动本地 Nacos
|
# 启动本地 Nacos
|
||||||
|
|
||||||
|
```bash
|
||||||
E:
|
E:
|
||||||
cd E:\nacos\bin
|
cd E:\nacos\bin
|
||||||
startup.cmd -m standalone
|
startup.cmd -m standalone
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 内网穿透
|
# 内网穿透
|
||||||
|
|
||||||
|
```bash
|
||||||
cd E:\Project\毕业设计\epp\intranet-penetration\bin
|
cd E:\Project\毕业设计\epp\intranet-penetration\bin
|
||||||
rathole.exe ../conf/client.toml
|
rathole.exe ../conf/client.toml
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 微信小程序后台设置 小程序最低基础库 2.21.3
|
|
||||||
|
|
||||||
https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/userProfile.html
|
|
||||||
|
|
||||||
|
|
||||||
|
**项目亮点**:
|
||||||
|
|
||||||
优点:
|
|
||||||
订单id使用 雪花id(可以分布式部署)
|
订单id使用 雪花id(可以分布式部署)
|
||||||
|
|
||||||
遇到的问题:
|
|
||||||
|
|
||||||
|
**项目开发中遇到的问题**:
|
||||||
|
|
||||||
nacos CPU占满问题,解决方案:提issue,多次测试,找到问题(HTTPDebug),问题解决
|
nacos CPU占满问题,解决方案:提issue,多次测试,找到问题(HTTPDebug),问题解决
|
||||||
|
|
||||||
iPhone部分版本不支持webp格式图片
|
iPhone部分版本不支持webp格式图片
|
||||||
|
|
||||||
|
小程序双端不一致的问题,参数转义,页面CSS样式是不完全一样的。
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Nacos CPU 跑满问题 我提的 GitHub issue
|
Nacos CPU 跑满问题 我提的 GitHub issue
|
||||||
https://github.com/alibaba/nacos/issues/10080
|
|
||||||
|
|
||||||
-----
|
https://github.com/alibaba/nacos/issues/10080
|
||||||
|
|
||||||
Nacos 2.2.0.1 需要配置
|
|
||||||
nacos.core.auth.plugin.nacos.token.secret.key=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
|
|
||||||
参考:
|
|
||||||
https://nacos.io/zh-cn/docs/v2/guide/user/auth.html
|
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
体温填报接口:
|
|
||||||
今日是否填报过,上报体温,上报的体温的历史记录
|
|
||||||
|
|
||||||
更多:
|
|
||||||
完成项目代码中的 TODO 部分
|
|
||||||
身份码后端接口考虑与其他系统的集成逻辑
|
|
||||||
|
|
||||||
Java代码中小程序AppID、密钥处理,小程序代码中小程序AppID处理
|
|
@ -1,5 +1,6 @@
|
|||||||
// 定义常量
|
// 定义常量
|
||||||
const url = "https://epp.only4.work/access/wechat/getUnlimitedQRCode"
|
const baseUrl = "https://epp.only4.work/"
|
||||||
|
const url = baseUrl + "access/wechat/getUnlimitedQRCode"
|
||||||
const page = "pages/index/index" // "pages/scan/entrance"
|
const page = "pages/index/index" // "pages/scan/entrance"
|
||||||
const envVersion = "develop" // 正式版为 "release",体验版为 "trial",开发版为 "develop"
|
const envVersion = "develop" // 正式版为 "release",体验版为 "trial",开发版为 "develop"
|
||||||
const autoColor = true
|
const autoColor = true
|
||||||
@ -102,7 +103,7 @@ window.changePanelSelectGate = changePanelSelectGate
|
|||||||
|
|
||||||
// 发送请求,获取大门列表
|
// 发送请求,获取大门列表
|
||||||
async function getGateList() {
|
async function getGateList() {
|
||||||
const response = await fetch('https://epp.only4.work/access/gate/guard-client/getGateList');
|
const response = await fetch(baseUrl + 'access/gate/guard-client/getGateList');
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
3
database/备注.md
Normal file
3
database/备注.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
该SQL中包含测试数据,若不需要可以自行删除
|
||||||
|
|
||||||
|
数据表名最后带 1 的为项目未使用到的表,可以直接删除
|
Loading…
Reference in New Issue
Block a user