Skip to content

Commit

Permalink
feat: 更改解析请求地址 (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-boide authored Sep 4, 2024
1 parent 25d2bbe commit b081681
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions entry/src/main/ets/common/constants/CommonConstants.ets
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
3 changes: 2 additions & 1 deletion entry/src/main/ets/common/model/XmlAnalysis.ets
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -53,7 +54,7 @@ export class XmlAnalysis {
searchUrl: this.searchUrl
}
axios.defaults.timeout = 5000
let response: AxiosResponse<object> = await axios.post('http://legado.wisdoms.xin/analysisBook', data)
let response: AxiosResponse<object> = 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
Expand Down
3 changes: 2 additions & 1 deletion entry/src/main/ets/pages/view/Find/CategoryList/Index.ets
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit b081681

Please sign in to comment.