Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
68 lines
1.3 KiB
TypeScript
68 lines
1.3 KiB
TypeScript
import type { Recordable } from '@vben/types';
|
|
|
|
import { requestClient } from '#/api/request';
|
|
|
|
export namespace PromotionLinkApi {
|
|
export interface PromotionLinkItem {
|
|
id: number;
|
|
name: string;
|
|
url: string;
|
|
create_time: string;
|
|
}
|
|
|
|
export interface PromotionLink {
|
|
total: number;
|
|
items: PromotionLinkItem[];
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 获取推广链接列表数据
|
|
*/
|
|
async function getPromotionLinkList(params: Recordable<any>) {
|
|
return requestClient.get<PromotionLinkApi.PromotionLink>(
|
|
'/promotion/link/list',
|
|
{
|
|
params,
|
|
},
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 创建推广链接
|
|
* @param data 推广链接数据
|
|
*/
|
|
async function createPromotionLink(
|
|
data: Omit<PromotionLinkApi.PromotionLinkItem, 'id'>,
|
|
) {
|
|
return requestClient.post('/promotion/link/create', data);
|
|
}
|
|
|
|
/**
|
|
* 更新推广链接
|
|
*
|
|
* @param id 推广链接 ID
|
|
* @param data 推广链接数据
|
|
*/
|
|
async function updatePromotionLink(
|
|
id: string,
|
|
data: Omit<PromotionLinkApi.PromotionLinkItem, 'id'>,
|
|
) {
|
|
return requestClient.put(`/promotion/link/update/${id}`, data);
|
|
}
|
|
|
|
/**
|
|
* 删除推广链接
|
|
* @param id 推广链接 ID
|
|
*/
|
|
async function deletePromotionLink(id: string) {
|
|
return requestClient.delete(`/promotion/link/delete/${id}`);
|
|
}
|
|
|
|
export {
|
|
createPromotionLink,
|
|
deletePromotionLink,
|
|
getPromotionLinkList,
|
|
updatePromotionLink,
|
|
};
|