feat: Refactor service management scripts to use a unified dev script
- Added package.json to manage development scripts. - Updated restart-services.ps1 to call the new dev script for starting services. - Refactored start-admin.ps1, start-backend.ps1, start-frontend.ps1, and start-mcp.ps1 to utilize the dev script for starting respective services. - Enhanced stop-services.ps1 to improve process termination logic by matching command patterns.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export function formatDateTime(value: string | null | undefined) {
|
||||
if (!value) {
|
||||
return 'Not available'
|
||||
return '暂无'
|
||||
}
|
||||
|
||||
const date = new Date(value)
|
||||
@@ -9,12 +9,85 @@ export function formatDateTime(value: string | null | undefined) {
|
||||
return value
|
||||
}
|
||||
|
||||
return new Intl.DateTimeFormat('en-US', {
|
||||
return new Intl.DateTimeFormat('zh-CN', {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short',
|
||||
}).format(date)
|
||||
}
|
||||
|
||||
export function formatPostType(value: string | null | undefined) {
|
||||
switch (value) {
|
||||
case 'article':
|
||||
return '文章'
|
||||
case 'note':
|
||||
return '笔记'
|
||||
case 'page':
|
||||
return '页面'
|
||||
case 'snippet':
|
||||
return '片段'
|
||||
default:
|
||||
return value || '文章'
|
||||
}
|
||||
}
|
||||
|
||||
export function formatCommentScope(value: string | null | undefined) {
|
||||
switch (value) {
|
||||
case 'paragraph':
|
||||
return '段落'
|
||||
case 'article':
|
||||
return '全文'
|
||||
default:
|
||||
return value || '全文'
|
||||
}
|
||||
}
|
||||
|
||||
export function formatFriendLinkStatus(value: string | null | undefined) {
|
||||
switch (value) {
|
||||
case 'approved':
|
||||
return '已通过'
|
||||
case 'rejected':
|
||||
return '已拒绝'
|
||||
case 'pending':
|
||||
return '待审核'
|
||||
default:
|
||||
return value || '待审核'
|
||||
}
|
||||
}
|
||||
|
||||
export function formatReviewType(value: string | null | undefined) {
|
||||
switch (value) {
|
||||
case 'book':
|
||||
return '图书'
|
||||
case 'movie':
|
||||
return '电影'
|
||||
case 'game':
|
||||
return '游戏'
|
||||
case 'anime':
|
||||
return '动画'
|
||||
case 'music':
|
||||
return '音乐'
|
||||
default:
|
||||
return value || '未分类'
|
||||
}
|
||||
}
|
||||
|
||||
export function formatReviewStatus(value: string | null | undefined) {
|
||||
switch (value) {
|
||||
case 'published':
|
||||
return '已发布'
|
||||
case 'draft':
|
||||
return '草稿'
|
||||
case 'archived':
|
||||
return '已归档'
|
||||
case 'completed':
|
||||
return '已完成'
|
||||
case 'in-progress':
|
||||
return '进行中'
|
||||
default:
|
||||
return value || '未知状态'
|
||||
}
|
||||
}
|
||||
|
||||
export function emptyToNull(value: string) {
|
||||
const trimmed = value.trim()
|
||||
return trimmed ? trimmed : null
|
||||
|
||||
Reference in New Issue
Block a user