Files
tuiche/lib/controller/mh/address_list_controller.dart
2025-06-03 09:34:31 +08:00

65 lines
1.7 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:ef/ef.dart';
import 'package:json_annotation/json_annotation.dart';
part 'address_list_controller.g.dart';
@JsonSerializable()
class AddressListModel {
List addressList = [];
Map address = {}; //之前控制的设备
int? type = 1; //1添加2编辑
AddressListModel();
static AddressListModel fromJson(Map<String, dynamic> json) =>
_$AddressListModelFromJson(json);
Map<String, dynamic> toJson() => _$AddressListModelToJson(this);
}
class AddressListController extends GetControllerEx<AddressListModel> {
AddressListController() {
attr = GetModel(AddressListModel()).obs;
}
// getAddressList() async {
// await ApiService.request.get("/api/address/info/list").then((d) {
// model.addressList = d.data["data"] ?? [];
// updateAll();
// }).catchError((e) {
// print("$e");
// });
// }
// //更新默认
// Future<void> updateDefault(address) async {
// var id = address['id'];
// var uid = address['userId'];
// try {
// await ef.client
// .from("app_user_address")
// .update({
// 'ischecked': 0,
// })
// .eq("user_id", address['userId'])
// .eq("ischecked", 1);
// await ef.client.from("app_user_address").update({
// 'ischecked': 1,
// }).eq("id", address['id']);
// } catch (e) {
// print('Error fetching repairs: $e');
// }
// }
// // 删除地址
// Future<void> deleteAddress(String id) async {
// try {
// await ef.client.from("app_user_address").delete().eq("id", id);
// print("Address with ID $id has been successfully deleted.");
// } catch (e) {
// print("Error deleting address with ID $id: $e");
// }
// }
}