mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36: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 { EnvModel } from '../data/env';
|
||||
import { promiseExec } from '../config/util';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const route = Router();
|
||||
|
||||
|
@ -25,7 +26,9 @@ export default (app: Router) => {
|
|||
const currentVersionFile = fs.readFileSync(config.versionFile, 'utf8');
|
||||
const version = currentVersionFile.match(versionRegx)![1];
|
||||
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', '');
|
||||
const lastCommitId = (
|
||||
await promiseExec(`cd ${config.rootPath} && git rev-parse --short HEAD`)
|
||||
|
@ -50,7 +53,7 @@ export default (app: Router) => {
|
|||
data: {
|
||||
isInitialized,
|
||||
version,
|
||||
lastCommitTime,
|
||||
lastCommitTime: dayjs(lastCommitTime).unix(),
|
||||
lastCommitId,
|
||||
branch,
|
||||
},
|
||||
|
|
|
@ -50,7 +50,7 @@ interface TSystemInfo {
|
|||
branch: 'develop' | 'master';
|
||||
isInitialized: boolean;
|
||||
lastCommitId: string;
|
||||
lastCommitTime: string;
|
||||
lastCommitTime: number;
|
||||
version: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,9 @@ const About = ({ systemInfo }: { systemInfo: SharedContext['systemInfo'] }) => {
|
|||
{TVersion[systemInfo.branch]} v{systemInfo.version}
|
||||
</Descriptions.Item>
|
||||
<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 label="更新ID" span={3}>
|
||||
{systemInfo.lastCommitId}
|
||||
|
|
Loading…
Reference in New Issue
Block a user