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
// @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}

View File

@@ -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 仅返回置顶)。

View File

@@ -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}`);

View File

@@ -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);