Merge branch 'master' of http://124.243.245.42:3000/sh/shz-admin
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
This commit is contained in:
68
src/services/cms/newsInfo.ts
Normal file
68
src/services/cms/newsInfo.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { request } from '@umijs/max';
|
||||
import { normalizeNewsContent } from '@/utils/newsImageUrl';
|
||||
|
||||
const BASE_URL = '/api/cms/newsInfo';
|
||||
|
||||
export async function getNewsInfoList(params?: API.NewsInfo.NewsInfoListParams) {
|
||||
return request<API.NewsInfo.NewsInfoPageResult>(`${BASE_URL}/list`, {
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getNewsInfoDetail(id: number) {
|
||||
return request<API.NewsInfo.NewsInfoDetailResult>(`${BASE_URL}/${id}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
export async function addNewsInfo(data: API.NewsInfo.NewsInfoPayload) {
|
||||
return request<API.Result>(BASE_URL, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
data: { ...data, content: normalizeNewsContent(data.content) },
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateNewsInfo(data: API.NewsInfo.NewsInfoPayload) {
|
||||
return request<API.Result>(BASE_URL, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
data: { ...data, content: normalizeNewsContent(data.content) },
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteNewsInfo(ids: string) {
|
||||
return request<API.Result>(`${BASE_URL}/${ids}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
export async function changeNewsInfoStatus(id: number, status: '0' | '1') {
|
||||
return request<API.Result>(`${BASE_URL}/changeStatus`, {
|
||||
method: 'PUT',
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
export async function uploadNewsImage(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return request<API.NewsInfo.NewsInfoUploadResult>('/api/common/upload', {
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getPublishedNewsInfoList(params?: API.NewsInfo.NewsInfoListParams) {
|
||||
return request<API.NewsInfo.NewsInfoPageResult>('/api/app/newsInfo/list', {
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getPublishedNewsInfoDetail(id: number) {
|
||||
return request<API.NewsInfo.NewsInfoDetailResult>(`/api/app/newsInfo/${id}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user