fix: forward dynamics reply

This commit is contained in:
guozhigq
2024-12-08 20:48:11 +08:00
parent 5e62cccd16
commit d91d4ab62e
4 changed files with 36 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/html.dart';
import 'package:pilipala/http/dynamics.dart';
import 'package:pilipala/http/reply.dart';
import 'package:pilipala/models/common/reply_sort_type.dart';
import 'package:pilipala/models/video/reply/item.dart';
@ -12,6 +12,7 @@ class DynamicDetailController extends GetxController {
DynamicDetailController(this.oid, this.type);
int? oid;
int? type;
int? opusId;
dynamic item;
int? floor;
String nextOffset = "";
@ -56,6 +57,12 @@ class DynamicDetailController extends GetxController {
if (reqType == 'init') {
nextOffset = '';
noMore.value = '';
if (opusId != null && oid == 0) {
var res = await DynamicsHttp.opusDetail(opusId: opusId!);
if (res['status']) {
oid = int.parse(res['data']['item']['basic']['comment_id_str']);
}
}
}
var res = await ReplyHttp.replyList(
oid: oid!,
@ -110,15 +117,12 @@ class DynamicDetailController extends GetxController {
sortTypeTitle.value = _sortType.titles;
sortTypeLabel.value = _sortType.labels;
replyList.clear();
noMore.value = '';
isLoadingMore = false;
isEnd = false;
queryReplyList(reqType: 'init');
}
// 根据jumpUrl获取动态html
reqHtmlByOpusId(int id) async {
var res = await HtmlHttp.reqHtml(id, 'opus');
oid = res['commentId'];
}
// 上拉加载
Future onLoad() async {
queryReplyList(reqType: 'onLoad');

View File

@ -89,9 +89,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
_dynamicDetailController = Get.put(
DynamicDetailController(oid, replyType),
tag: opusId.toString());
_dynamicDetailController.opusId = opusId;
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
await _dynamicDetailController.reqHtmlByOpusId(opusId!);
setState(() {});
}
} else {
oid = moduleDynamic.major!.draw!.id!;