diff --git a/backend/app/http/v1/content.go b/backend/app/http/v1/content.go index 25e92b8..703fc2b 100644 --- a/backend/app/http/v1/content.go +++ b/backend/app/http/v1/content.go @@ -22,7 +22,7 @@ type Content struct{} // @Produce json // @Param keyword query string false "Search keyword" // @Param genre query string false "Genre" -// @Param tenantId query int64 false "Filter by creator" +// @Param tenant_id query int64 false "Filter by creator" // @Param sort query string false "Sort order" Enums(latest, hot, price_asc) // @Param page query int false "Page number" // @Success 200 {object} requests.Pager{items=[]dto.ContentItem} diff --git a/backend/app/http/v1/dto/content.go b/backend/app/http/v1/dto/content.go index e5941a6..16f6007 100644 --- a/backend/app/http/v1/dto/content.go +++ b/backend/app/http/v1/dto/content.go @@ -10,7 +10,7 @@ type ContentListFilter struct { // Genre 内容类型/分类筛选。 Genre *string `query:"genre"` // TenantID 租户ID筛选(内容所属店铺)。 - TenantID *int64 `query:"tenantId"` + TenantID *int64 `query:"tenant_id"` // Sort 排序规则(latest/hot/price_asc)。 Sort *string `query:"sort"` // IsPinned 置顶内容筛选(true 仅返回置顶)。 diff --git a/frontend/portal/src/api/content.js b/frontend/portal/src/api/content.js index db4d2f7..9440dcf 100644 --- a/frontend/portal/src/api/content.js +++ b/frontend/portal/src/api/content.js @@ -2,10 +2,10 @@ import { request } from '../utils/request'; export const contentApi = { list: (params) => { - if (params.tenantId) { - const { tenantId, ...rest } = params; + if (params.tenant_id) { + const { tenant_id: tenantID, ...rest } = params; const qs = new URLSearchParams(rest).toString(); - return request(`/creators/${tenantId}/contents?${qs}`); + return request(`/creators/${tenantID}/contents?${qs}`); } const qs = new URLSearchParams(params).toString(); return request(`/contents?${qs}`); diff --git a/frontend/portal/src/views/tenant/HomeView.vue b/frontend/portal/src/views/tenant/HomeView.vue index df2ea46..d1bd169 100644 --- a/frontend/portal/src/views/tenant/HomeView.vue +++ b/frontend/portal/src/views/tenant/HomeView.vue @@ -196,7 +196,7 @@ const fetchData = async (isLoadMore = false) => { try { const id = route.params.id; const query = { - tenantId: id, + tenant_id: id, sort: 'latest', page: page.value, limit: limit, @@ -210,7 +210,7 @@ const fetchData = async (isLoadMore = false) => { // Only fetch tenant info & featured on first load if (!isLoadMore && page.value === 1) { reqs.push(tenantApi.get(id)); - reqs.push(contentApi.list({ tenantId: id, is_pinned: true })); + reqs.push(contentApi.list({ tenant_id: id, is_pinned: true })); } const results = await Promise.all(reqs);