opt handle res

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-29 17:17:35 +08:00
parent b643cb1bd0
commit 924d51d41b
198 changed files with 3715 additions and 2001 deletions

View File

@@ -37,7 +37,7 @@ class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
cursorTime = data.total?.cursor?.time ?? -1;
List<LikeMeItems> latest = data.latest?.items ?? [];
List<LikeMeItems> total = data.total?.items ?? [];
if (!isRefresh && loadingState.value is Success) {
if (!isRefresh && loadingState.value.isSuccess) {
Pair<List<LikeMeItems>, List<LikeMeItems>> pair = loadingState.value.data;
latest.insertAll(0, pair.first);
total.insertAll(0, pair.second);
@@ -62,7 +62,7 @@ class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
var res = await MsgHttp.delMsgfeed(0, id);
if (res['status']) {
Pair<List<LikeMeItems>, List<LikeMeItems>> pair =
(loadingState.value as Success).response;
loadingState.value.data;
if (isLatest) {
pair.first.removeAt(index);
} else {
@@ -81,8 +81,7 @@ class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
int noticeState = isNotice ? 1 : 0;
var res = await MsgHttp.msgSetNotice(id: id, noticeState: noticeState);
if (res['status']) {
Pair<List<LikeMeItems>, List<LikeMeItems>> pair =
(loadingState.value as Success).response;
Pair<List<LikeMeItems>, List<LikeMeItems>> pair = loadingState.value.data;
if (isLatest) {
pair.first[index].noticeState = noticeState;
} else {

View File

@@ -1,5 +1,3 @@
import 'dart:convert';
import 'package:PiliPlus/common/skeleton/msg_feed_sys_msg_.dart';
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
@@ -69,15 +67,6 @@ class _SysMsgPageState extends State<SysMsgPage> {
_sysMsgController.onLoadMore();
}
final item = response[index];
String? content = item.content;
if (content != null) {
try {
dynamic jsonContent = json.decode(content);
if (jsonContent != null && jsonContent['web'] != null) {
content = jsonContent['web'];
}
} catch (_) {}
}
return ListTile(
onLongPress: () => showConfirmDialog(
context: context,
@@ -93,7 +82,7 @@ class _SysMsgPageState extends State<SysMsgPage> {
children: [
const SizedBox(height: 4),
Text.rich(
_buildContent(theme, content ?? ''),
_buildContent(theme, item.content ?? ''),
style: TextStyle(
fontSize: 14,
color: theme.colorScheme.onSurface