feat: cv专栏记录

This commit is contained in:
guozhigq
2024-09-28 18:22:42 +08:00
parent fbf327cb9a
commit 7d5ce08bfc
2 changed files with 42 additions and 2 deletions

View File

@ -1,9 +1,9 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
import 'package:html/parser.dart'; import 'package:html/parser.dart';
import 'package:pilipala/models/read/opus.dart'; import 'package:pilipala/models/read/opus.dart';
import 'package:pilipala/models/read/read.dart'; import 'package:pilipala/models/read/read.dart';
import 'init.dart'; import 'package:pilipala/utils/wbi_sign.dart';
import 'index.dart';
class ReadHttp { class ReadHttp {
static List<String> extractScriptContents(String htmlContent) { static List<String> extractScriptContents(String htmlContent) {
@ -78,4 +78,39 @@ class ReadHttp {
'data': ReadDataModel.fromJson(jsonData), 'data': ReadDataModel.fromJson(jsonData),
}; };
} }
//
static Future getViewInfo({required String id}) async {
Map params = await WbiSign().makSign({
'id': id,
'mobi_app': 'pc',
'from': 'web',
'gaia_source': 'main_web',
'web_location': 333.976,
});
var res = await Request().get(
Api.getViewInfo,
data: {
'id': id,
'mobi_app': 'pc',
'from': 'web',
'gaia_source': 'main_web',
'web_location': 333.976,
'w_rid': params['w_rid'],
'wts': params['wts'],
},
);
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'],
};
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
}
}
} }

View File

@ -23,6 +23,7 @@ class ReadPageController extends GetxController {
id = Get.parameters['id']!; id = Get.parameters['id']!;
articleType = Get.parameters['articleType']!; articleType = Get.parameters['articleType']!;
scrollController.addListener(_scrollListener); scrollController.addListener(_scrollListener);
fetchViewInfo();
} }
Future fetchCvData() async { Future fetchCvData() async {
@ -80,6 +81,10 @@ class ReadPageController extends GetxController {
); );
} }
void fetchViewInfo() {
ReadHttp.getViewInfo(id: id);
}
@override @override
void onClose() { void onClose() {
scrollController.removeListener(_scrollListener); scrollController.removeListener(_scrollListener);