fix: align tenant_id content filter
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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 仅返回置顶)。
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user