webcons/src/api/hotinformation.ts

71 lines
1.5 KiB
TypeScript

import axios from 'axios';
/**
* 全部文章类型
*/
export interface Allhotinformation {
status: string;
code: number;
message: string;
data: {
id: number;
created_at: Date;
updated_at: Date;
title: string;
writer: string;
content: string;
type: number;
img: string;
weight: number;
}[];
}
/**
* 文章详细类型
*/
export interface HotinformationDetails {
status: string;
code: number;
message: string;
id: number;
created_at: Date;
updated_at: Date;
title: string;
writer: string;
content: string;
type: number;
img: string;
weight: number;
}
/**
*获取全部文章接口 类型0是热点资讯1是银龄动态
* @returns
*/
export function GetList(type: number) {
return axios.post<Allhotinformation>('/admin/api/v1/hotinformation/get_list', { type });
}
/**
* 获取文章详细接口
* @returns
*/
export function GetDetails(id: number) {
return axios.post<HotinformationDetails>('/admin/api/v1/hotinformation/get_details', { id });
}
/**
* 更新文章
* @returns
*/
export function Edi(id: number, title: any, writer: any, content: any, type: any, img: any, weight: any) {
return axios.post<HotinformationDetails>('/admin/api/v1/hotinformation/edi', { id, title, writer, content, type, img, weight });
}
/**
* 删除文章
* @param id
* @returns
*/
export function Del(id: number) {
return axios.post<HotinformationDetails>('/admin/api/v1/hotinformation/del', { id });
}