feat(distribution): 分站发布群只使用自己的二维码池
主站单独维护分站码池,池空时不再借用主站或其他分站,并去掉已停用的固定二维码入口。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -170,3 +170,52 @@ export async function batchDeleteQrCodes(ids: number[]) {
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
function siteQrCodeBase(siteId: number) {
|
||||
return `/admin/distribution/sites/${siteId}/qrcodes`
|
||||
}
|
||||
|
||||
export async function fetchSiteQrCodes(siteId: number, query: QrCodeListQuery = {}) {
|
||||
const { data } = await apiClient.get<ApiResponse<PaginatedResult<ChatQrCode>>>(
|
||||
siteQrCodeBase(siteId),
|
||||
{
|
||||
params: {
|
||||
status: query.status || undefined,
|
||||
keyword: query.keyword?.trim() || undefined,
|
||||
page: query.page || 1,
|
||||
limit: query.limit || 20,
|
||||
},
|
||||
silent: true,
|
||||
}
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function fetchSiteQrCodeStats(siteId: number) {
|
||||
const { data } = await apiClient.get<ApiResponse<QrCodeStats>>(
|
||||
`${siteQrCodeBase(siteId)}/stats`,
|
||||
{ silent: true }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function batchCreateSiteQrCodes(siteId: number, items: CreateQrCodePayload[]) {
|
||||
const { data } = await apiClient.post<ApiResponse<ChatQrCode[]>>(
|
||||
`${siteQrCodeBase(siteId)}/batch`,
|
||||
{ items }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function updateSiteQrCode(siteId: number, id: number, payload: UpdateQrCodePayload) {
|
||||
const { data } = await apiClient.patch<ApiResponse<null>>(
|
||||
`${siteQrCodeBase(siteId)}/${id}`,
|
||||
payload
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function deleteSiteQrCode(siteId: number, id: number) {
|
||||
const { data } = await apiClient.delete<ApiResponse<null>>(`${siteQrCodeBase(siteId)}/${id}`)
|
||||
return data.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user