feat: msg: set notice

Closes #821

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-06 00:11:11 +08:00
parent 2d1697064d
commit a8fa4d72f3
5 changed files with 131 additions and 11 deletions

View File

@@ -67,4 +67,23 @@ class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
}
} catch (_) {}
}
Future<void> onSetNotice(
int? id, int index, bool isNotice, bool isLatest) async {
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;
if (isLatest) {
pair.first[index].noticeState = noticeState;
} else {
pair.second[index].noticeState = noticeState;
}
loadingState.refresh();
SmartDialog.showToast('操作成功');
} else {
SmartDialog.showToast(res['msg']);
}
}
}