feat(agent,settlement): 크리에이터 기준 정산 상세 API/뷰 개선 및 페이지네이션/정렬 일관성 확보
- api/agent: 정산 상세 조회 API 다수 추가(라이브/콘텐츠/커뮤니티/콘텐츠·채널 후원) - 공통 파라미터 빌더 및 1→0 기반 페이지 변환 유틸 도입으로 Spring Pageable 규약 준수 - 정산 상세 뷰(라이브/콘텐츠/커뮤니티/콘텐츠 후원/채널 후원): 닉네임 표시, 페이지·정렬 파라미터 적용 - 로딩/에러/빈 결과 초기화 처리 강화, 합계 초기화로 실패 시 데이터 오해 방지 - AgentList: 정산 상세 라우팅 시 닉네임 query 전달로 상단 타이틀 표시 개선
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
// 공통: 페이지 파라미터 변환(1-based UI → 0-based Spring Pageable)
|
||||
function toZeroBased(page) {
|
||||
const p = Number(page || 1)
|
||||
return Math.max(0, p - 1)
|
||||
}
|
||||
|
||||
// 에이전트 리스트 조회
|
||||
// 서버 스펙에 페이지네이션이 없다면 단순 GET으로 사용
|
||||
// 추후 필요 시 params(page,size) 확장 가능
|
||||
@@ -72,6 +78,53 @@ async function removeAgentCreator(payload) {
|
||||
return Vue.axios.post('/admin/partner/agent/assignment/remove', payload)
|
||||
}
|
||||
|
||||
// =========================
|
||||
// 정산 상세 - 에이전트별(크리에이터 기준 집계)
|
||||
// 공통 Request: startDateStr, endDateStr, Spring Pageable(page,size,sort)
|
||||
// 공통 Response: ApiResponse<GetAgentSettlementByCreatorResponse>
|
||||
// { success, message, data: { totalCount, total:{...}, items:[...] } }
|
||||
|
||||
function buildSettlementParams({ startDateStr, endDateStr, page = 1, size = 20, sort }) {
|
||||
const params = {
|
||||
startDateStr,
|
||||
endDateStr,
|
||||
page: toZeroBased(page),
|
||||
size
|
||||
}
|
||||
if (sort) params.sort = sort
|
||||
return params
|
||||
}
|
||||
|
||||
async function getAgentLiveSettlementByCreator(agentId, { startDateStr, endDateStr, page = 1, size = 20, sort } = {}) {
|
||||
return Vue.axios.get(`/admin/partner/agent/${agentId}/calculate/live-by-creator`, {
|
||||
params: buildSettlementParams({ startDateStr, endDateStr, page, size, sort })
|
||||
})
|
||||
}
|
||||
|
||||
async function getAgentContentSettlementByCreator(agentId, { startDateStr, endDateStr, page = 1, size = 20, sort } = {}) {
|
||||
return Vue.axios.get(`/admin/partner/agent/${agentId}/calculate/content-by-creator`, {
|
||||
params: buildSettlementParams({ startDateStr, endDateStr, page, size, sort })
|
||||
})
|
||||
}
|
||||
|
||||
async function getAgentCommunitySettlementByCreator(agentId, { startDateStr, endDateStr, page = 1, size = 20, sort } = {}) {
|
||||
return Vue.axios.get(`/admin/partner/agent/${agentId}/calculate/community-by-creator`, {
|
||||
params: buildSettlementParams({ startDateStr, endDateStr, page, size, sort })
|
||||
})
|
||||
}
|
||||
|
||||
async function getAgentContentDonationSettlementByCreator(agentId, { startDateStr, endDateStr, page = 1, size = 20, sort } = {}) {
|
||||
return Vue.axios.get(`/admin/partner/agent/${agentId}/calculate/content-donation-by-creator`, {
|
||||
params: buildSettlementParams({ startDateStr, endDateStr, page, size, sort })
|
||||
})
|
||||
}
|
||||
|
||||
async function getAgentChannelDonationSettlementByCreator(agentId, { startDateStr, endDateStr, page = 1, size = 20, sort } = {}) {
|
||||
return Vue.axios.get(`/admin/partner/agent/${agentId}/calculate/channel-donation-by-creator`, {
|
||||
params: buildSettlementParams({ startDateStr, endDateStr, page, size, sort })
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
getAgentList,
|
||||
getAgentSettlementRatioList,
|
||||
@@ -83,4 +136,10 @@ export {
|
||||
searchAdminAgentAssignableCreators,
|
||||
assignAgentCreator,
|
||||
removeAgentCreator,
|
||||
// 에이전트 정산 상세 (크리에이터 기준)
|
||||
getAgentLiveSettlementByCreator,
|
||||
getAgentContentSettlementByCreator,
|
||||
getAgentCommunitySettlementByCreator,
|
||||
getAgentContentDonationSettlementByCreator,
|
||||
getAgentChannelDonationSettlementByCreator,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user