mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修复移动端最后更新时间展示
This commit is contained in:
parent
074a90e0ac
commit
3ccb635956
|
@ -8,6 +8,7 @@ import { celebrate, Joi } from 'celebrate';
|
||||||
import UserService from '../services/user';
|
import UserService from '../services/user';
|
||||||
import { EnvModel } from '../data/env';
|
import { EnvModel } from '../data/env';
|
||||||
import { promiseExec } from '../config/util';
|
import { promiseExec } from '../config/util';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
const route = Router();
|
const route = Router();
|
||||||
|
|
||||||
|
@ -25,7 +26,9 @@ export default (app: Router) => {
|
||||||
const currentVersionFile = fs.readFileSync(config.versionFile, 'utf8');
|
const currentVersionFile = fs.readFileSync(config.versionFile, 'utf8');
|
||||||
const version = currentVersionFile.match(versionRegx)![1];
|
const version = currentVersionFile.match(versionRegx)![1];
|
||||||
const lastCommitTime = (
|
const lastCommitTime = (
|
||||||
await promiseExec(`cd ${config.rootPath} && git show -s --format=%ai | head -1`)
|
await promiseExec(
|
||||||
|
`cd ${config.rootPath} && git show -s --format=%ai | head -1`,
|
||||||
|
)
|
||||||
).replace('\n', '');
|
).replace('\n', '');
|
||||||
const lastCommitId = (
|
const lastCommitId = (
|
||||||
await promiseExec(`cd ${config.rootPath} && git rev-parse --short HEAD`)
|
await promiseExec(`cd ${config.rootPath} && git rev-parse --short HEAD`)
|
||||||
|
@ -50,7 +53,7 @@ export default (app: Router) => {
|
||||||
data: {
|
data: {
|
||||||
isInitialized,
|
isInitialized,
|
||||||
version,
|
version,
|
||||||
lastCommitTime,
|
lastCommitTime: dayjs(lastCommitTime).unix(),
|
||||||
lastCommitId,
|
lastCommitId,
|
||||||
branch,
|
branch,
|
||||||
},
|
},
|
||||||
|
|
|
@ -50,7 +50,7 @@ interface TSystemInfo {
|
||||||
branch: 'develop' | 'master';
|
branch: 'develop' | 'master';
|
||||||
isInitialized: boolean;
|
isInitialized: boolean;
|
||||||
lastCommitId: string;
|
lastCommitId: string;
|
||||||
lastCommitTime: string;
|
lastCommitTime: number;
|
||||||
version: string;
|
version: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,9 @@ const About = ({ systemInfo }: { systemInfo: SharedContext['systemInfo'] }) => {
|
||||||
{TVersion[systemInfo.branch]} v{systemInfo.version}
|
{TVersion[systemInfo.branch]} v{systemInfo.version}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="更新时间" span={3}>
|
<Descriptions.Item label="更新时间" span={3}>
|
||||||
{dayjs(systemInfo.lastCommitTime).format('YYYY-MM-DD HH:mm:ss')}
|
{dayjs(systemInfo.lastCommitTime * 1000).format(
|
||||||
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
|
)}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="更新ID" span={3}>
|
<Descriptions.Item label="更新ID" span={3}>
|
||||||
{systemInfo.lastCommitId}
|
{systemInfo.lastCommitId}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user