fix: align tenant_id content filter

This commit is contained in:
2026-01-09 10:25:26 +08:00
parent cd96033a3d
commit bf0b57f537
4 changed files with 7 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ type Content struct{}
// @Produce json // @Produce json
// @Param keyword query string false "Search keyword" // @Param keyword query string false "Search keyword"
// @Param genre query string false "Genre" // @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 sort query string false "Sort order" Enums(latest, hot, price_asc)
// @Param page query int false "Page number" // @Param page query int false "Page number"
// @Success 200 {object} requests.Pager{items=[]dto.ContentItem} // @Success 200 {object} requests.Pager{items=[]dto.ContentItem}

View File

@@ -10,7 +10,7 @@ type ContentListFilter struct {
// Genre 内容类型/分类筛选。 // Genre 内容类型/分类筛选。
Genre *string `query:"genre"` Genre *string `query:"genre"`
// TenantID 租户ID筛选内容所属店铺 // TenantID 租户ID筛选内容所属店铺
TenantID *int64 `query:"tenantId"` TenantID *int64 `query:"tenant_id"`
// Sort 排序规则latest/hot/price_asc // Sort 排序规则latest/hot/price_asc
Sort *string `query:"sort"` Sort *string `query:"sort"`
// IsPinned 置顶内容筛选true 仅返回置顶)。 // IsPinned 置顶内容筛选true 仅返回置顶)。

View File

@@ -2,10 +2,10 @@ import { request } from '../utils/request';
export const contentApi = { export const contentApi = {
list: (params) => { list: (params) => {
if (params.tenantId) { if (params.tenant_id) {
const { tenantId, ...rest } = params; const { tenant_id: tenantID, ...rest } = params;
const qs = new URLSearchParams(rest).toString(); const qs = new URLSearchParams(rest).toString();
return request(`/creators/${tenantId}/contents?${qs}`); return request(`/creators/${tenantID}/contents?${qs}`);
} }
const qs = new URLSearchParams(params).toString(); const qs = new URLSearchParams(params).toString();
return request(`/contents?${qs}`); return request(`/contents?${qs}`);

View File

@@ -196,7 +196,7 @@ const fetchData = async (isLoadMore = false) => {
try { try {
const id = route.params.id; const id = route.params.id;
const query = { const query = {
tenantId: id, tenant_id: id,
sort: 'latest', sort: 'latest',
page: page.value, page: page.value,
limit: limit, limit: limit,
@@ -210,7 +210,7 @@ const fetchData = async (isLoadMore = false) => {
// Only fetch tenant info & featured on first load // Only fetch tenant info & featured on first load
if (!isLoadMore && page.value === 1) { if (!isLoadMore && page.value === 1) {
reqs.push(tenantApi.get(id)); 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); const results = await Promise.all(reqs);