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
8 changes: 7 additions & 1 deletion .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
Expand Down Expand Up @@ -56,3 +56,9 @@ jobs:

- name: Run backend tests
run: pytest -q

- name: Check timezone behavior under independent host timezones
run: |
for zone in UTC Asia/Shanghai America/New_York; do
TZ="$zone" python -m pytest -q tests/common/test_types.py tests/common/test_query_time.py tests/utils/test_time_util.py tests/config/test_scheduler_database.py tests/utils/test_cron_util.py tests/module_admin/controller/test_job_controller.py tests/config/test_scheduler_job_persistence.py
done
106 changes: 106 additions & 0 deletions .github/workflows/timezone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Timezone Integration

on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:

jobs:
databases:
runs-on: ubuntu-latest
env:
TZ: America/New_York
PYTHONUTF8: '1'
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: timezone_test
TZ: Asia/Shanghai
ports: ['3306:3306']
options: >-
--health-cmd="mysqladmin ping -h localhost -ptimezone_test"
--health-interval=10s --health-timeout=5s --health-retries=12
postgres:
image: postgres:14
env:
POSTGRES_PASSWORD: timezone_test
TZ: America/New_York
PGTZ: America/New_York
ports: ['5432:5432']
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s --health-timeout=5s --health-retries=12
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: '3.10'
cache: pip
cache-dependency-path: ruoyi-fastapi-backend/requirements*.txt
- name: Install verification dependencies
working-directory: ruoyi-fastapi-backend
run: python -m pip install -r requirements.txt asyncpg psycopg2-binary pytest pytest-asyncio aiosqlite
- name: Create isolated source configurations
working-directory: ruoyi-fastapi-backend
run: |
mkdir -p .cache/timezone-ci
python - <<'PY'
import json
from pathlib import Path
for dialect, port, username, database in [('mysql', 3306, 'root', 'mysql'), ('postgresql', 5432, 'postgres', 'postgres')]:
source = dict(db_type=dialect, db_host='127.0.0.1', db_port=port, db_username=username,
db_password='timezone_test', db_database=database)
Path(f'.cache/timezone-ci/{dialect}.json').write_text(json.dumps(source))
PY
- name: Verify empty databases, drivers, generated CRUD and persistent schedulers
working-directory: ruoyi-fastapi-backend
run: |
python -m scripts.verify_timezone_database --config .cache/timezone-ci/mysql.json --report .cache/timezone-ci/mysql-report.json
python -m scripts.verify_timezone_database --config .cache/timezone-ci/postgresql.json --report .cache/timezone-ci/postgresql-report.json
- uses: actions/upload-artifact@v6
if: always()
with:
name: timezone-database-reports
path: ruoyi-fastapi-backend/.cache/timezone-ci/*-report.json
include-hidden-files: true

web-app:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: '22'
cache: npm
# Lockfiles are ignored by this repository; cache by the committed manifest.
cache-dependency-path: ruoyi-fastapi-frontend/package.json
- uses: pnpm/action-setup@v5
with:
package_json_file: ruoyi-fastapi-app/package.json
- name: Install Web dependencies
working-directory: ruoyi-fastapi-frontend
run: npm install --no-package-lock
- name: Install App dependencies
working-directory: ruoyi-fastapi-app
run: pnpm install --no-frozen-lockfile
- name: Run time contracts in three host timezones
run: node ruoyi-fastapi-test/time-contract/run-host-timezones.mjs
- name: Build Web targets
working-directory: ruoyi-fastapi-frontend
run: |
npm run build:prod
npm run build:docker
- name: Build App targets
working-directory: ruoyi-fastapi-app
run: |
pnpm build:h5
pnpm build:mp-weixin
- name: Validate all Compose configurations
run: |
docker compose -f docker-compose.my.yml config --quiet
docker compose -f docker-compose.pg.yml config --quiet
docker compose -f ruoyi-fastapi-test/docker-compose.test.my.yml config --quiet
docker compose -f ruoyi-fastapi-test/docker-compose.test.pg.yml config --quiet
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ htmlcov/
.coverage
.coverage.*
.cache
.pnpm-store/
nosetests.xml
coverage.xml
*.cover
Expand Down
9 changes: 8 additions & 1 deletion docker-compose.my.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ services:
dockerfile: Dockerfile
image: ruoyi-frontend:latest
container_name: ruoyi-frontend
environment:
TZ: UTC
ports:
- "12580:80"
volumes:
Expand All @@ -22,6 +24,8 @@ services:
dockerfile: Dockerfile.my
image: ruoyi-backend-my:latest
container_name: ruoyi-backend-my
environment:
TZ: UTC
ports:
- "19099:9099"
depends_on:
Expand All @@ -37,6 +41,7 @@ services:
image: mysql:8.0
container_name: ruoyi-mysql
environment:
TZ: UTC
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ruoyi-fastapi
ports:
Expand All @@ -56,6 +61,8 @@ services:
ruoyi-redis:
image: redis:latest
container_name: ruoyi-redis
environment:
TZ: UTC
ports:
- "16379:6379"
networks:
Expand All @@ -70,4 +77,4 @@ services:
networks:
ruoyi-network:
name: ruoyi-network
driver: bridge
driver: bridge
9 changes: 8 additions & 1 deletion docker-compose.pg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ services:
dockerfile: Dockerfile
image: ruoyi-frontend:latest
container_name: ruoyi-frontend
environment:
TZ: UTC
ports:
- "12580:80"
volumes:
Expand All @@ -22,6 +24,8 @@ services:
dockerfile: Dockerfile.pg
image: ruoyi-backend-pg:latest
container_name: ruoyi-backend-pg
environment:
TZ: UTC
ports:
- "19099:9099"
depends_on:
Expand All @@ -37,6 +41,7 @@ services:
image: postgres:14
container_name: ruoyi-pg
environment:
TZ: UTC
POSTGRES_PASSWORD: root
POSTGRES_DB: ruoyi-fastapi
POSTGRES_INITDB_ARGS: --encoding=UTF8 --lc-collate=C --lc-ctype=C
Expand All @@ -56,6 +61,8 @@ services:
ruoyi-redis:
image: redis:latest
container_name: ruoyi-redis
environment:
TZ: UTC
ports:
- "16379:6379"
networks:
Expand All @@ -70,4 +77,4 @@ services:
networks:
ruoyi-network:
name: ruoyi-network
driver: bridge
driver: bridge
8 changes: 8 additions & 0 deletions ruoyi-fastapi-app/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "ruoyi-fastapi-app",
"version": "1.10.0",
"type": "module",
"packageManager": "pnpm@10.28.1",
"scripts": {
"test:time": "node --test tests/time*.test.js",
"dev": "uni -p mp-weixin",
"build": "npm run build:mp-weixin",
"dev:app": "uni -p app",
Expand Down Expand Up @@ -59,8 +61,14 @@
"@dcloudio/uni-mp-weixin": "3.0.0-4080720251210001",
"@dcloudio/uni-mp-xhs": "3.0.0-4080720251210001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4080720251210001",
"@formatjs/intl-datetimeformat": "7.6.1",
"@formatjs/intl-getcanonicallocales": "3.2.11",
"@formatjs/intl-locale": "5.3.10",
"@formatjs/intl-numberformat": "9.4.0",
"@formatjs/intl-pluralrules": "6.3.13",
"@vue/shared": "3.4.21",
"@weapp-tailwindcss/merge-v3": "^0.1.5",
"dayjs": "1.11.23",
"node-forge": "^1.4.0",
"pinia": "2.2.4",
"vue": "^3.4.21",
Expand Down
8 changes: 7 additions & 1 deletion ruoyi-fastapi-app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ import config from "./config";
import { getToken } from "@/utils/auth";
import { useConfigStore } from "@/store";
import { getCurrentInstance } from "vue";
import { onLaunch } from "@dcloudio/uni-app";
import { onLaunch, onShow } from "@dcloudio/uni-app";

import { refreshDeviceTimezone } from "@/utils/time";

const { proxy } = getCurrentInstance();

onLaunch(() => {
initApp();
});

onShow(() => {
refreshDeviceTimezone();
});

// 初始化应用
function initApp() {
// 初始化应用配置
Expand Down
96 changes: 55 additions & 41 deletions ruoyi-fastapi-app/src/api/system/user.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,55 @@
import upload from "@/utils/upload";
import request from "@/utils/request";

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
const data = {
oldPassword,
newPassword,
};
return request({
url: "/system/user/profile/updatePwd",
method: "put",
data: data,
});
}

// 查询用户个人信息
export function getUserProfile() {
return request({
url: "/system/user/profile",
method: "get",
});
}

// 修改用户个人信息
export function updateUserProfile(data) {
return request({
url: "/system/user/profile",
method: "put",
data: data,
});
}

// 用户头像上传
export function uploadAvatar(data) {
return upload({
url: "/system/user/profile/avatar",
name: data.name,
filePath: data.filePath,
});
}
import upload from "@/utils/upload";
import request from "@/utils/request";

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
const data = {
oldPassword,
newPassword,
};
return request({
url: "/system/user/profile/updatePwd",
method: "put",
data: data,
});
}

// 查询用户个人信息
export function getUserProfile() {
return request({
url: "/system/user/profile",
method: "get",
});
}

// 查询服务端支持的显示时区
export function getTimezoneOptions() {
return request({ url: "/system/user/profile/timezones", method: "get" });
}

// 修改当前账号的显示时区
export function updateUserTimezone(timeZone) {
return request({
url: "/system/user/profile/timezone",
method: "put",
data: { timeZone },
});
}

// 修改用户个人信息
export function updateUserProfile(data) {
return request({
url: "/system/user/profile",
method: "put",
data: data,
});
}

// 用户头像上传
export function uploadAvatar(data) {
return upload({
url: "/system/user/profile/avatar",
name: data.name,
filePath: data.filePath,
});
}
6 changes: 6 additions & 0 deletions ruoyi-fastapi-app/src/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
"navigationBarTitleText": "应用设置"
}
},
{
"path": "pages/mine/setting/timezone",
"style": {
"navigationBarTitleText": "时区设置"
}
},
{
"path": "pages/mine/help/index",
"style": {
Expand Down
Loading
Loading