feat: 写手端逻辑处理

This commit is contained in:
rd
2025-08-12 10:28:12 +08:00
parent 8cda6cae64
commit d01dd6d558
13 changed files with 164 additions and 138 deletions

View File

@ -3,131 +3,149 @@
*/
import Http from '@/api';
import { useRoute } from 'vue-router';
const getWriterCode = () => {
const route = useRoute();
return route.params.writerCode as string;
return route?.params?.writerCode as string;
};
// 内容稿件-批量添加(写手)
export const postWorksBatchWriter = (params: {}) => {
export const postWorksBatchWriter = (params = {}, writerCode: string) => {
return Http.post('/v1/writer/works/batch', params, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件-分页(写手)
export const getWorksPageWriter = (params: {}) => {
export const getWorksPageWriter = (writerCode: string, params = {}) => {
return Http.get('/v1/writer/works', params, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件-详情(写手)
export const getWorksDetailWriter = (id: string) => {
return Http.get(`/v1/writer/works/${id}`, {
headers: { 'writer-code': getWriterCode() },
});
export const getWorksDetailWriter = (writerCode: string, id: string) => {
return Http.get(
`/v1/writer/works/${id}`,
{},
{
headers: { 'writer-code': writerCode },
},
);
};
// 内容稿件-修改(写手)
export const putWorksUpdateWriter = (params = {}) => {
export const putWorksUpdateWriter = (writerCode: string, params = {}) => {
const { id, ...rest } = params as { id: string; [key: string]: any };
return Http.put(`/v1/writer/works/${id}`, rest, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件-删除(写手)
export const deleteWorkWriter = (id: string) => {
export const deleteWorkWriter = (writerCode: string, id: string) => {
return Http.delete(`/v1/writer/works/${id}`, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件-获取模板(写手)
export const getTemplateUrlWriter = () => {
return Http.get('/v1/writer/works/template', {
headers: { 'writer-code': getWriterCode() },
});
export const getTemplateUrlWriter = (writerCode: string) => {
return Http.get(
'/v1/writer/works/template',
{},
{
headers: { 'writer-code': writerCode },
},
);
};
// 内容稿件审核-分页(写手)
export const getWorkAuditsPageWriter = (params: any) => {
export const getWorkAuditsPageWriter = (writerCode: string, params = {}) => {
return Http.get('/v1/writer/work-audits', params, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件审核-详情(写手)
export const getWorkAuditsDetailWriter = (id: string) => {
return Http.get(`/v1/writer/work-audits/${id}`, {
headers: { 'writer-code': getWriterCode() },
});
export const getWorkAuditsDetailWriter = (writerCode: string, id: string) => {
return Http.get(
`/v1/writer/work-audits/${id}`,
{},
{
headers: { 'writer-code': writerCode },
},
);
};
// 内容稿件审核-多个详情(写手)
export const getWorkAuditsBatchDetailWriter = (params: any) => {
export const getWorkAuditsBatchDetailWriter = (writerCode: string, params = {}) => {
return Http.get('/v1/writer/work-audits/list', params, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件-审核(写手)
export const patchWorkAuditsAuditWriter = (id: string, params = {}) => {
return Http.patch(`/v1/writer/work-audits/${id}/audit`, params, {
headers: { 'writer-code': getWriterCode() },
});
export const patchWorkAuditsAuditWriter = (id: string, writerCode: string) => {
return Http.patch(
`/v1/writer/work-audits/${id}/audit`,
{},
{
headers: { 'writer-code': writerCode },
},
);
};
// 内容稿件-批量审核(写手)
export const patchWorkAuditsBatchAuditWriter = (params: {}) => {
export const patchWorkAuditsBatchAuditWriter = (writerCode: string, params: {}) => {
return Http.patch('/v1/writer/work-audits/batch-audit', params, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件审核-修改(写手)
export const putWorkAuditsUpdateWriter = (params = {}) => {
export const putWorkAuditsUpdateWriter = (writerCode: string, params = {}) => {
const { id: auditId, ...rest } = params as { id: string; [key: string]: any };
return Http.put(`/v1/writer/work-audits/${auditId}`, rest, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件审核-审核通过(写手)
export const putWorkAuditsAuditPassWriter = (params = {}) => {
export const putWorkAuditsAuditPassWriter = (writerCode: string, params = {}) => {
const { id: auditId, ...rest } = params as { id: string; [key: string]: any };
return Http.put(`/v1/writer/work-audits/${auditId}/audit-pass`, rest, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件审核-AI审查(写手)
export const postWorkAuditsAiReviewWriter = (params = {}) => {
const { id: auditId, ...rest } = params as { id: string; [key: string]: any };
const { id: auditId, writerCode, ...rest } = params as { id: string; writerCode: string; [key: string]: any };
return Http.post(`/v1/writer/work-audits/${auditId}/ai-review`, rest, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件审核-获取AI审查结果(写手)
export const getWorkAuditsAiReviewResultWriter = (id: string, ticket: string) => {
return Http.get(`/v1/writer/work-audits/${id}/ai-review/${ticket}`, {
headers: { 'writer-code': getWriterCode() },
});
export const getWorkAuditsAiReviewResultWriter = (id: string, ticket: string, writerCode: string) => {
return Http.get(
`/v1/writer/work-audits/${id}/ai-review/${ticket}`,
{},
{
headers: { 'writer-code': writerCode },
},
);
};
// 内容稿件-通过链接获取稿件
export const postWorksByLinkWriter = (params = {}) => {
export const postWorksByLinkWriter = (writerCode: string, params = {}) => {
return Http.post('/v1/writer/works/by-link', params, {
headers: { 'writer-code': getWriterCode() },
headers: { 'writer-code': writerCode },
});
};
// 内容稿件-通过文档获取稿件
export const postWorksByFileWriter = (params = {}, config = {}) => {
return Http.post('/v1/writer/works/by-file', params, {
...config,
headers: { 'writer-code': getWriterCode() },
});
return Http.post('/v1/writer/works/by-file', params, config);
};