更改分享和解绑消息弹窗

This commit is contained in:
czz
2025-08-26 17:56:36 +08:00
parent 5ac6c891b3
commit daf782bf9f
10 changed files with 407 additions and 90 deletions

View File

@@ -46,20 +46,28 @@ class MhMessageController extends GetControllerEx<MhMessageModel> {
RxList bodyMessageList = [].obs;
RxList systemMessageList = [].obs;
Future<ApiResponse> getMessageList(String messageType) async {
int bodyPage = 1;
int systemPage = 1;
Future<void> loadMore(String type) async {
if (type == "app_vsm") {
bodyPage++;
await getMessageList("app_vsm", page: bodyPage, append: true);
} else {
systemPage++;
await getMessageList("app_system", page: systemPage, append: true);
}
}
Future<ApiResponse> getMessageList(String messageType,
{int page = 1, int limit = 20, bool append = false}) async {
try {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr);
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.message_list;
// String messageType = "app_system";
// if (model.type == 1) {
// messageType = "app_vsm";
// } else {
// messageType = "app_system";
// }
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${messageType}";
"${serviceAddress}${serviceName}${serviceApi}?type=${messageType}&page=$page&limit=$limit";
String? language = "";
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
@@ -78,22 +86,23 @@ class MhMessageController extends GetControllerEx<MhMessageModel> {
ApiResponse res =
ApiResponse.fromJson(responseData, (object) => object);
MyUtils.formatResponse(res, "请求成功".tr, "请求失败".tr);
if (res.code == HttpStatusCodes.ok) {
// updateAll();
// messageList.value = res.data;
if (res.code == HttpStatusCodes.ok) {
if (messageType == "app_vsm") {
if (append) {
bodyMessageList.addAll(res.data ?? []);
} else {
bodyMessageList.assignAll(res.data ?? []);
}
} else if (messageType == "app_system") {
if (append) {
systemMessageList.addAll(res.data ?? []);
} else {
systemMessageList.assignAll(res.data ?? []);
}
}
updateAll();
return res;
}
} else {
return ApiResponse(code: -1, msg: "失败".tr);
}
return apiResponse;
} catch (e) {