1.修复睡眠日报中睡眠规律性数据显示错误

2.更新时区设置
This commit is contained in:
wyf
2026-01-07 15:19:16 +08:00
parent 36f19a71eb
commit 575f91e8dd
42 changed files with 4236 additions and 1653 deletions

View File

@@ -55,6 +55,7 @@ class PeopleInfoController extends GetControllerEx<PeopleInfoModel> {
final CityModelController cityController = Get.find<CityModelController>();
RxList diseaseList = [].obs;
RxString timeZone = "".obs; //选择时区
@override
Future<void> onInit() async {
@@ -247,4 +248,35 @@ class PeopleInfoController extends GetControllerEx<PeopleInfoModel> {
}
return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
}
getTimeZoneByLocalTime() async {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.localTimeZone;
// 获取当前本地时间并格式化为字符串
DateTime now = DateTime.now();
String time = DateFormat("yyyy-MM-dd HH:mm:ss").format(now);
// 构建查询URL对时间参数进行URL编码
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?time=${Uri.encodeComponent(time)}";
String serverTimeUtc = "";
// 发起请求
await requestWithLog(
logTitle: "查询本地时区",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print("本地时间: $time");
print("接口返回: $res");
serverTimeUtc = res.data;
},
onFailure: (res) {
print("查询时区失败");
},
);
return serverTimeUtc;
}
}