更改分享和解绑消息弹窗
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user