|
|
@@ -41,7 +41,7 @@ async function callLegacyFunction(token, params, expectedStatus = 200) {
|
|
|
const response = await fetch(`${FUNCTION_URL}/xiaoshu/app/gateway`, {
|
|
|
method: 'POST',
|
|
|
headers: { 'X-Parse-Application-Id': APP_ID, 'Content-Type': 'application/json' },
|
|
|
- body: JSON.stringify(token ? { token, params } : params),
|
|
|
+ body: JSON.stringify({ ...(token ? { token } : {}), params }),
|
|
|
});
|
|
|
const payload = await response.json().catch(() => ({}));
|
|
|
if (response.status !== expectedStatus) throw new Error(`app gateway ${params.action} 期望 ${expectedStatus},实际 ${response.status}: ${payload.retmsg || payload.error || ''}`);
|
|
|
@@ -106,6 +106,8 @@ try {
|
|
|
if (!Array.isArray(content.result) || content.result.length !== 2 || Number(content.page?.itemCount) < 90000) throw new Error('公开内容分页校验失败');
|
|
|
const contentExact = await callLegacyFunction('', { action: 'content_list', page: 1, pageSize: 1, objectId: content.result[0].objectId });
|
|
|
if (contentExact.result?.[0]?.objectId !== content.result[0].objectId || contentExact.page?.itemCount !== 1) throw new Error('内容 objectId 精确查询校验失败');
|
|
|
+ const contentDetail = await callLegacyFunction('', { action: 'content_get', id: content.result[0].objectId });
|
|
|
+ if (contentDetail.result?.objectId !== content.result[0].objectId) throw new Error('内容详情 ID 校验失败');
|
|
|
|
|
|
const profile = await callLegacyFunction(login.sessionToken, { action: 'user_get' });
|
|
|
if (profile.retcode !== 0 || profile.result?.objectId !== userId) throw new Error('app gateway 用户会话校验失败');
|