fanmingyou3_wd

解决语法检查报错

@@ -19,26 +19,30 @@ export class DetailViewModel extends BaseViewModel { @@ -19,26 +19,30 @@ export class DetailViewModel extends BaseViewModel {
19 * 例:https://pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500000008738&contentId=30001373964&relType=1 19 * 例:https://pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500000008738&contentId=30001373964&relType=1
20 * @return {string} resDTO.data 20 * @return {string} resDTO.data
21 */ 21 */
22 - async getDetailPageData(relId: string, contentId: string, relType: string): Promise<ContentDetailDTO> { 22 + getDetailPageData(relId: string, contentId: string, relType: string): Promise<ContentDetailDTO> {
23 Logger.debug(TAG, 'getDetailPageData contentId: ' + contentId); 23 Logger.debug(TAG, 'getDetailPageData contentId: ' + contentId);
24 return new Promise<ContentDetailDTO>((success, error) => { 24 return new Promise<ContentDetailDTO>((success, error) => {
25 - PageRepository.fetchDetailData(relId, contentId, relType)  
26 - .then((resDTO: ResponseDTO<ContentDetailDTO>) => {  
27 - if (this.isRespondsInvalid(resDTO, 'getDetailPageData')) {  
28 - error("detail data invalid"); 25 + PageRepository.fetchDetailData(relId, contentId, relType).then((resDTO: ResponseDTO<ContentDetailDTO>) => {
  26 + if (!resDTO || !resDTO.data) {
  27 + Logger.error(TAG, 'getDetailPageData then resDTO is empty');
  28 + error('resDTO is empty');
  29 + return
  30 + }
  31 + if (resDTO.code != 0) {
  32 + Logger.error(TAG, `getDetailPageData then code:${resDTO.code}, message:${resDTO.message}`);
  33 + error('resDTO Response Code is failure');
29 return 34 return
30 } 35 }
31 Logger.info(TAG, "getDetailPageData then,resDTO.timeStamp:" + resDTO.timestamp); 36 Logger.info(TAG, "getDetailPageData then,resDTO.timeStamp:" + resDTO.timestamp);
32 success(resDTO.data); 37 success(resDTO.data);
33 - })  
34 - .catch((err: Error) => { 38 + }).catch((err: Error) => {
35 Logger.error(TAG, `getDetailPageData catch, error.name : ${err.name}, error.message:${err.message}`); 39 Logger.error(TAG, `getDetailPageData catch, error.name : ${err.name}, error.message:${err.message}`);
36 error(err); 40 error(err);
37 }) 41 })
38 }) 42 })
39 } 43 }
40 44
41 - private dataTranslate(json: string): ContentDetailDTO { 45 + private dataTranslate(json: string): ContentDetailDTO | null {
42 if (StringUtils.isEmpty(json)) { 46 if (StringUtils.isEmpty(json)) {
43 return null; 47 return null;
44 } 48 }
1 { 1 {
  2 + "license": "Apache-2.0",
  3 + "devDependencies": {},
  4 + "author": "",
2 "name": "wddetailplayapi", 5 "name": "wddetailplayapi",
3 - "version": "1.0.0",  
4 "description": "Please describe the basic information.", 6 "description": "Please describe the basic information.",
5 "main": "Index.ets", 7 "main": "Index.ets",
6 - "author": "",  
7 - "license": "Apache-2.0", 8 + "version": "1.0.0",
8 "dependencies": { 9 "dependencies": {
9 - "wdBean": "file:../wdBean",  
10 "wdKit": "file:../wdKit", 10 "wdKit": "file:../wdKit",
11 - "wdNetwork": "file:../wdNetwork",  
12 - "wdRouter": "file:../wdRouter" 11 + "wdBean": "file:../wdBean",
  12 + "wdRouter": "file:../wdRouter",
  13 + "wdNetwork": "file:../wdNetwork"
13 } 14 }
14 } 15 }
1 { 1 {
  2 + "license": "Apache-2.0",
  3 + "devDependencies": {},
  4 + "author": "",
2 "name": "wddetailplaylive", 5 "name": "wddetailplaylive",
3 - "version": "1.0.0",  
4 "description": "Please describe the basic information.", 6 "description": "Please describe the basic information.",
5 "main": "Index.ets", 7 "main": "Index.ets",
6 - "author": "",  
7 - "license": "Apache-2.0",  
8 - "dependencies": {  
9 - } 8 + "version": "1.0.0",
  9 + "dependencies": {}
10 } 10 }
1 { 1 {
  2 + "license": "Apache-2.0",
  3 + "devDependencies": {},
  4 + "author": "",
2 "name": "wddetailplayshortvideo", 5 "name": "wddetailplayshortvideo",
3 - "version": "1.0.0",  
4 "description": "Please describe the basic information.", 6 "description": "Please describe the basic information.",
5 "main": "Index.ets", 7 "main": "Index.ets",
6 - "author": "",  
7 - "license": "Apache-2.0", 8 + "version": "1.0.0",
8 "dependencies": { 9 "dependencies": {
9 - "wdBean": "file:../wdBean",  
10 "wdPlayer": "file:../wdPlayer", 10 "wdPlayer": "file:../wdPlayer",
11 "wdKit": "file:../wdKit", 11 "wdKit": "file:../wdKit",
  12 + "wdBean": "file:../wdBean",
  13 + "wdRouter": "file:../wdRouter",
12 "wdNetwork": "file:../wdNetwork", 14 "wdNetwork": "file:../wdNetwork",
13 - "wdDetailPlayApi": "file:../wdDetailPlayApi",  
14 - "wdRouter": "file:../wdRouter" 15 + "wdDetailPlayApi": "file:../wdDetailPlayApi"
15 } 16 }
16 } 17 }
1 import { BusinessError } from '@ohos.base' 1 import { BusinessError } from '@ohos.base'
2 import { Logger } from 'wdKit' 2 import { Logger } from 'wdKit'
3 import { ResponseDTO} from 'wdNetwork' 3 import { ResponseDTO} from 'wdNetwork'
4 -import { ContentDetailDTO, ContentDetailRequest } from 'wdDetailPlayApi' 4 +import { ContentDetailRequest } from 'wdDetailPlayApi'
  5 +import { ContentDetailDTO } from 'wdBean'
5 6
6 const TAG = 'PlayViewModel'; 7 const TAG = 'PlayViewModel';
7 8
1 { 1 {
  2 + "license": "Apache-2.0",
  3 + "devDependencies": {},
  4 + "author": "",
2 "name": "wddetailplayvod", 5 "name": "wddetailplayvod",
3 - "version": "1.0.0",  
4 "description": "Please describe the basic information.", 6 "description": "Please describe the basic information.",
5 "main": "Index.ets", 7 "main": "Index.ets",
6 - "author": "",  
7 - "license": "Apache-2.0", 8 + "version": "1.0.0",
8 "dependencies": { 9 "dependencies": {
9 - "wdBean": "file:../wdBean",  
10 "wdPlayer": "file:../wdPlayer", 10 "wdPlayer": "file:../wdPlayer",
11 "wdKit": "file:../wdKit", 11 "wdKit": "file:../wdKit",
12 - "wdDetailPlayApi": "file:../wdDetailPlayApi",  
13 - "wdRouter": "file:../wdRouter" 12 + "wdBean": "file:../wdBean",
  13 + "wdRouter": "file:../wdRouter",
  14 + "wdDetailPlayApi": "file:../wdDetailPlayApi"
14 } 15 }
15 } 16 }
@@ -7,8 +7,8 @@ @@ -7,8 +7,8 @@
7 "main": "Index.ets", 7 "main": "Index.ets",
8 "version": "1.0.0", 8 "version": "1.0.0",
9 "dependencies": { 9 "dependencies": {
10 - "wdKit": "file:../wdKit",  
11 "wdConstant": "file:../wdConstant", 10 "wdConstant": "file:../wdConstant",
  11 + "wdKit": "file:../wdKit",
12 "@ohos/axios": "^2.1.1" 12 "@ohos/axios": "^2.1.1"
13 } 13 }
14 } 14 }
1 { 1 {
  2 + "license": "Apache-2.0",
  3 + "devDependencies": {},
  4 + "author": "",
2 "name": "wdplayer", 5 "name": "wdplayer",
3 - "version": "1.0.0",  
4 "description": "Please describe the basic information.", 6 "description": "Please describe the basic information.",
5 "main": "Index.ets", 7 "main": "Index.ets",
6 - "author": "",  
7 - "license": "Apache-2.0",  
8 - "dependencies": {  
9 - } 8 + "version": "1.0.0",
  9 + "dependencies": {}
10 } 10 }