修改完成待测试
This commit is contained in:
@@ -3,11 +3,33 @@ import {
|
||||
normalizeComplianceDocument,
|
||||
normalizeComplianceDocumentKey,
|
||||
normalizeHelpArticles,
|
||||
normalizePromotionPlacement
|
||||
normalizePromotionPlacement,
|
||||
normalizeSiteArticles
|
||||
} from './site-content-contract.js'
|
||||
import { requestStrict } from './request-client.js'
|
||||
|
||||
export const siteContentApi = {
|
||||
async getSiteArticles(requestOptions = {}) {
|
||||
const limit = requestOptions.limit ?? 20
|
||||
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100) {
|
||||
throw new TypeError('官网文章数量上限无效')
|
||||
}
|
||||
const articleType = typeof requestOptions.articleType === 'string'
|
||||
? requestOptions.articleType.trim()
|
||||
: ''
|
||||
const articles = await requestStrict({
|
||||
url: '/genealogy/app/site/articles',
|
||||
method: 'GET',
|
||||
data: {
|
||||
limit,
|
||||
...(articleType ? { articleType } : {})
|
||||
}
|
||||
}, {
|
||||
requestController: requestOptions.requestController ?? null
|
||||
})
|
||||
return normalizeSiteArticles(articles)
|
||||
},
|
||||
|
||||
async getHelpArticles(requestOptions = {}) {
|
||||
const helpArticles = await requestStrict({
|
||||
url: '/genealogy/app/help-articles',
|
||||
@@ -25,6 +47,7 @@ export const siteContentApi = {
|
||||
method: 'GET',
|
||||
data: { platform: 'app', placement }
|
||||
}, {
|
||||
authenticated: false,
|
||||
requestController: requestOptions.requestController ?? null
|
||||
})
|
||||
return normalizeAppPromotions(promotions, placement)
|
||||
|
||||
Reference in New Issue
Block a user