feat: add article and production modules
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
import BaseService from '@/api/core/base'
|
||||
import request from '@/utils/http'
|
||||
|
||||
export interface ArticleCategoryRow {
|
||||
id?: string | number
|
||||
name: string
|
||||
slug?: string
|
||||
parent_id?: string | number
|
||||
article_count?: number
|
||||
sort?: number
|
||||
enabled?: number
|
||||
description?: string
|
||||
created_date?: string
|
||||
updated_date?: string
|
||||
}
|
||||
|
||||
export interface ArticleTagRow {
|
||||
id?: string | number
|
||||
name: string
|
||||
slug?: string
|
||||
article_count?: number
|
||||
sort?: number
|
||||
heat?: number
|
||||
enabled?: number
|
||||
description?: string
|
||||
created_date?: string
|
||||
updated_date?: string
|
||||
}
|
||||
|
||||
export interface ArticleContentRow {
|
||||
id?: string | number
|
||||
title: string
|
||||
content_type?: string
|
||||
slug?: string
|
||||
category_id?: string | number
|
||||
category_name?: string
|
||||
channel?: string
|
||||
visibility?: number
|
||||
author?: string
|
||||
source?: string
|
||||
cover?: string
|
||||
seo_keywords?: string
|
||||
seo_title?: string
|
||||
seo_description?: string
|
||||
summary?: string
|
||||
content?: string
|
||||
status?: number
|
||||
is_top?: number
|
||||
is_recommend?: number
|
||||
allow_comment?: number
|
||||
sort?: number
|
||||
view_count?: number
|
||||
like_count?: number
|
||||
comment_count?: number
|
||||
favorite_count?: number
|
||||
published_at?: number | string
|
||||
offline_at?: number | string
|
||||
tag_ids?: Array<string | number>
|
||||
tag_names?: string
|
||||
created_date?: string
|
||||
updated_date?: string
|
||||
}
|
||||
|
||||
export const ArticleContentService = {
|
||||
...BaseService<ArticleContentRow>({ baseUrl: '/article/index' })
|
||||
}
|
||||
|
||||
export const ArticleCategoryService = {
|
||||
...BaseService<ArticleCategoryRow>({ baseUrl: '/article/category' })
|
||||
}
|
||||
|
||||
export const ArticleTagService = {
|
||||
...BaseService<ArticleTagRow>({ baseUrl: '/article/tag' })
|
||||
}
|
||||
|
||||
const pluginApi = {
|
||||
async test(params = {}) {
|
||||
return request.get<{ msg?: string; data?: unknown }>({
|
||||
url: '/article/index',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
contentList(params = {}) {
|
||||
return ArticleContentService.list(params as Record<string, any>)
|
||||
},
|
||||
|
||||
categoryList(params = {}) {
|
||||
return ArticleCategoryService.list(params as Record<string, any>)
|
||||
},
|
||||
|
||||
tagList(params = {}) {
|
||||
return ArticleTagService.list(params as Record<string, any>)
|
||||
},
|
||||
|
||||
async recycleList(params = {}) {
|
||||
return request.get<{ code: number; msg: string; data: Record<string, unknown>[] }>({
|
||||
url: '/article/recycle',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
async recycleRestore(id: string | number) {
|
||||
return request.put({
|
||||
url: `/article/recycle/${id}/restore`,
|
||||
params: { id }
|
||||
})
|
||||
},
|
||||
|
||||
async recycleDelete(id: string | number) {
|
||||
return request.del({
|
||||
url: `/article/recycle/${id}`,
|
||||
params: { id }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default pluginApi
|
||||
Reference in New Issue
Block a user