Files
shz-admin/src/services/jobportal/outdoorFair.ts

284 lines
7.0 KiB
TypeScript
Raw Normal View History

2026-06-18 02:30:11 +08:00
import { request } from '@umijs/max';
/** 户外招聘会列表项 */
export interface OutdoorFairItem {
id: number;
/** 招聘会标题 */
title: string;
/** 举办单位 */
hostUnit: string;
/** 招聘会类型 */
fairType: string;
/** 举办区域 */
region: string;
/** 绑定场地ID */
venueId?: number;
/** 绑定场地 */
venueName?: string;
2026-06-18 02:30:11 +08:00
/** 举办地址 */
address: string;
/** 展位数量 */
boothCount: number;
/** 举办时间 */
holdTime: string;
/** 截止时间 */
endTime: string;
/** 开放申请 */
applyStartTime: string;
/** 截止申请 */
applyEndTime: string;
/** 是否开启线上申请 */
onlineApply: boolean;
/** 招聘会照片 */
photoUrl: string;
/** 当前企业ID */
companyId?: number;
/** 当前企业名称 */
companyName?: string;
/** 当前企业是否已报名 */
signedUp?: boolean;
/** 当前企业公共 H5 页面链接 */
h5Url?: string;
/** 二维码内容,通常与 h5Url 一致 */
qrCodeContent?: string;
/** 当前企业报名审核状态0待审核 1通过 2驳回 */
reviewStatus?: string;
/** 当前企业报名审核备注 */
reviewRemark?: string;
2026-06-18 02:30:11 +08:00
createTime?: string;
updateTime?: string;
}
/** 户外招聘会查询参数 */
export interface OutdoorFairListParams {
title?: string;
hostUnit?: string;
fairType?: string;
region?: string;
venueId?: number;
onlineApply?: boolean;
2026-06-18 02:30:11 +08:00
current?: number;
pageSize?: number;
}
/** 户外招聘会列表响应 */
export interface OutdoorFairListResult {
code: number;
msg?: string;
total: number;
rows: OutdoorFairItem[];
}
/** 户外招聘会新增/编辑表单 */
export interface OutdoorFairForm {
id?: number;
title: string;
hostUnit: string;
fairType: string;
region: string;
venueId?: number;
venueName?: string;
2026-06-18 02:30:11 +08:00
address: string;
boothCount: number;
holdTime: string;
endTime: string;
applyStartTime: string;
applyEndTime: string;
onlineApply: boolean;
photoUrl: string;
}
/** 通用响应 */
export interface OutdoorFairCommonResult {
code: number;
msg?: string;
data?: any;
url?: string;
fileName?: string;
newFileName?: string;
originalFilename?: string;
2026-06-18 02:30:11 +08:00
}
/** 企业报名/二维码信息 */
export interface OutdoorFairCompanyQrCodeInfo {
fairId: number;
companyId: number;
companyName?: string;
signedUp?: boolean;
reviewStatus?: string;
reviewRemark?: string;
deviceId?: number;
deviceCode?: string;
h5Url: string;
qrCodeContent: string;
}
/** 户外招聘会字典新增表单 */
export interface OutdoorFairDictForm {
dictType: 'outdoor_fair_type' | 'outdoor_fair_region';
dictLabel: string;
}
2026-06-18 02:30:11 +08:00
const CMS_OUTDOOR_FAIR_BASE = '/api/cms/outdoor-fair';
2026-06-18 02:30:11 +08:00
const formatDateTime = (value: any) => {
if (value && typeof value.format === 'function') {
return value.format('YYYY-MM-DD HH:mm:ss');
}
return value;
};
2026-06-18 02:30:11 +08:00
const toApiPayload = (data: OutdoorFairForm) => ({
...data,
holdTime: formatDateTime(data.holdTime),
endTime: formatDateTime(data.endTime),
applyStartTime: formatDateTime(data.applyStartTime),
applyEndTime: formatDateTime(data.applyEndTime),
});
2026-06-18 02:30:11 +08:00
/**
*
* GET /api/cms/outdoor-fair/list
*/
export async function getOutdoorFairList(params?: OutdoorFairListParams) {
return request<OutdoorFairListResult>(`${CMS_OUTDOOR_FAIR_BASE}/list`, {
method: 'GET',
params,
});
}
2026-06-18 02:30:11 +08:00
/**
*
* GET /api/cms/outdoor-fair/{id}
*/
export async function getOutdoorFairInfo(id: number) {
return request<OutdoorFairCommonResult>(`${CMS_OUTDOOR_FAIR_BASE}/${id}`, {
method: 'GET',
});
2026-06-18 02:30:11 +08:00
}
/** 招聘会统计-时间桶序列项(曲线图用) */
export interface OutdoorFairStatisticsSeriesItem {
time: string;
fairCount: number;
companyCount: number;
jobCount: number;
}
/** 招聘会数同比/环比 */
export interface OutdoorFairStatisticsRate {
fairCount: number;
previousFairCount: number;
/** 增长率:(current-previous)/previous上期为 0 时为 null */
rate?: number | null;
}
/** 招聘会统计结果dashboard */
export interface OutdoorFairStatisticsResult {
granularity: 'day' | 'week' | 'month' | 'year';
totals: { fairCount: number; companyCount: number; jobCount: number };
yoy: OutdoorFairStatisticsRate;
mom: OutdoorFairStatisticsRate;
series: OutdoorFairStatisticsSeriesItem[];
}
/** 招聘会统计查询参数 */
export interface OutdoorFairStatisticsParams {
/** 粒度day/week/month/year */
granularity?: 'day' | 'week' | 'month' | 'year';
/** 起始时间 yyyy-MM-dd HH:mm:ss */
startTime?: string;
/** 截止时间 yyyy-MM-dd HH:mm:ss */
endTime?: string;
}
/**
*
* GET /api/cms/outdoor-fair/statistics
* skipErrorHandler: 由调用方自行处理错误 null msg "null"
*/
export async function getOutdoorFairStatistics(params: OutdoorFairStatisticsParams) {
return request<{ code: number; msg?: string; data: OutdoorFairStatisticsResult }>(
`${CMS_OUTDOOR_FAIR_BASE}/statistics`,
{ method: 'GET', params, skipErrorHandler: true },
);
}
2026-06-18 02:30:11 +08:00
/**
*
* POST /api/cms/outdoor-fair
*/
export async function addOutdoorFair(data: OutdoorFairForm) {
return request<OutdoorFairCommonResult>(CMS_OUTDOOR_FAIR_BASE, {
method: 'POST',
data: toApiPayload(data),
});
2026-06-18 02:30:11 +08:00
}
/**
*
* PUT /api/cms/outdoor-fair
*/
export async function updateOutdoorFair(data: OutdoorFairForm) {
return request<OutdoorFairCommonResult>(CMS_OUTDOOR_FAIR_BASE, {
method: 'PUT',
data: toApiPayload(data),
});
2026-06-18 02:30:11 +08:00
}
/**
*
* DELETE /api/cms/outdoor-fair/{id}
*/
export async function deleteOutdoorFair(id: number) {
return request<OutdoorFairCommonResult>(`${CMS_OUTDOOR_FAIR_BASE}/${id}`, {
method: 'DELETE',
});
}
/**
* 使
* POST /api/cms/outdoor-fair/dict-data
*/
export async function addOutdoorFairDictOption(data: OutdoorFairDictForm) {
return request<OutdoorFairCommonResult>(`${CMS_OUTDOOR_FAIR_BASE}/dict-data`, {
method: 'POST',
data,
});
}
/**
*
* POST /api/cms/outdoor-fair/{fairId}/company/signup
*/
export async function signupOutdoorFair(fairId: number) {
return request<{ code: number; msg?: string; data: OutdoorFairCompanyQrCodeInfo }>(
`${CMS_OUTDOOR_FAIR_BASE}/${fairId}/company/signup`,
{ method: 'POST' },
);
}
/**
*
* GET /api/cms/outdoor-fair/{fairId}/company/qrcode
*/
export async function getMyOutdoorFairQrCode(fairId: number) {
return request<{ code: number; msg?: string; data: OutdoorFairCompanyQrCodeInfo }>(
`${CMS_OUTDOOR_FAIR_BASE}/${fairId}/company/qrcode`,
{ method: 'GET' },
);
}
/**
*
* POST /api/common/upload
*/
export async function uploadOutdoorFairPhoto(file: File) {
const formData = new FormData();
formData.append('file', file);
return request<OutdoorFairCommonResult>('/api/common/upload', {
method: 'POST',
data: formData,
});
2026-06-18 02:30:11 +08:00
}