1.修复睡眠日报中睡眠规律性数据显示错误
2.更新时区设置
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user