diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets index 2c42ecb4..643a7307 100644 --- a/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/entry/src/main/ets/common/constants/CommonConstants.ets @@ -274,4 +274,9 @@ export default class CommonConstants { static readonly COMMON_HEIGHT_21_6: number = 21.6; static readonly COMMON_WIDTH_40: number = 40; static readonly COMMON_HEIGHT_40: number = 40; + + /* + * 接口请求域名 + * */ + static readonly BASE_URL: string = 'https://legado.miaogongzi.cc/api/LegadoServer'; } \ No newline at end of file diff --git a/entry/src/main/ets/common/model/XmlAnalysis.ets b/entry/src/main/ets/common/model/XmlAnalysis.ets index bc9684db..aee96759 100644 --- a/entry/src/main/ets/common/model/XmlAnalysis.ets +++ b/entry/src/main/ets/common/model/XmlAnalysis.ets @@ -4,6 +4,7 @@ import { BookSource } from '../../database/entities/BookSource'; import { ExploreQuery } from '../../database/types/BookSourceType'; import axios, { AxiosError, AxiosResponse } from '@ohos/axios'; import { isNetworkUrl } from '../utils/utils'; +import CommonConstants from '../constants/CommonConstants'; export interface IXmlAnalysis { @@ -53,7 +54,7 @@ export class XmlAnalysis { searchUrl: this.searchUrl } axios.defaults.timeout = 5000 - let response: AxiosResponse = await axios.post('http://legado.wisdoms.xin/analysisBook', data) + let response: AxiosResponse = await axios.post(CommonConstants.BASE_URL + '/search/analysisBook', data) if (response.data){ bookList = (response.data as SearchBook[]).map(item => { item.bookType = this.xmlDate.bookSource?.bookSourceType ?? 0 diff --git a/entry/src/main/ets/pages/view/Find/CategoryList/Index.ets b/entry/src/main/ets/pages/view/Find/CategoryList/Index.ets index 85825f0e..478318cd 100644 --- a/entry/src/main/ets/pages/view/Find/CategoryList/Index.ets +++ b/entry/src/main/ets/pages/view/Find/CategoryList/Index.ets @@ -7,6 +7,7 @@ import { isNetworkUrl } from '../../../../common/utils/utils'; import axios, { AxiosResponse } from '@ohos/axios'; import noFind from '../../../../componets/common/noFind'; import { CardItem } from '../components/CardItem'; +import CommonConstants from '../../../../common/constants/CommonConstants'; interface RouteParams { bookSourceUrl: string, @@ -67,7 +68,7 @@ struct CateGoryListPage { } this.loading = true try { - const res: AxiosResponse = await axios.post('http://legado.wisdoms.xin/analysisRules', exploreQuery) + const res: AxiosResponse = await axios.post(CommonConstants.BASE_URL + '/common/analysisRules', exploreQuery) console.info('TagInfo, 解析内容:', JSON.stringify(res.data)) const bookList = (res.data as ExploreRule[]).map(item => { if (item.coverUrl && !isNetworkUrl(item.coverUrl)) { diff --git a/entry/src/main/ets/pages/view/Find/components/BookFindContent.ets b/entry/src/main/ets/pages/view/Find/components/BookFindContent.ets index f59f7eaa..7ce1ee11 100644 --- a/entry/src/main/ets/pages/view/Find/components/BookFindContent.ets +++ b/entry/src/main/ets/pages/view/Find/components/BookFindContent.ets @@ -12,6 +12,7 @@ import { ExploreItem, ExploreQuery } from '../../../../database/types/BookSource import mayAlsoLike from '../mayAlsoLike' import { CardItem } from './CardItem' import { router } from '@kit.ArkUI' +import CommonConstants from '../../../../common/constants/CommonConstants'; @Component export default struct BookFindContent { @@ -49,7 +50,7 @@ export default struct BookFindContent { coverUrl: this.exploreRule.coverUrl, wordCount: this.exploreRule.wordCount } - axios.post('http://legado.wisdoms.xin/analysisRules', exploreQuery).then((res: AxiosResponse) => { + axios.post(CommonConstants.BASE_URL + '/common/analysisRules', exploreQuery).then((res: AxiosResponse) => { console.info('TagInfo, 解析内容:', JSON.stringify(res.data)) this.bookList = (res.data as ExploreRule[]).map(item => { if (item.coverUrl && !isNetworkUrl(item.coverUrl)) {