Browse Source

切換診所獲取新ip和端口

chenzubin 3 months ago
parent
commit
bb0efe38ba
3 changed files with 26 additions and 5 deletions
  1. 16 0
      lib/bean/clinic_list.dart
  2. 3 0
      lib/select_clinic.dart
  3. 7 5
      lib/utils/Constants.dart

+ 16 - 0
lib/bean/clinic_list.dart

@@ -38,6 +38,8 @@ class Data {
38
   String? clinicCode;
38
   String? clinicCode;
39
   String? clinicName;
39
   String? clinicName;
40
   String? clinicIp;
40
   String? clinicIp;
41
+  String? serverPost;
42
+  String? webSocketPost;
41
   String? serverUser;
43
   String? serverUser;
42
   String? serverPassword;
44
   String? serverPassword;
43
   String? realmName;
45
   String? realmName;
@@ -53,6 +55,8 @@ class Data {
53
   String? versionRefer;
55
   String? versionRefer;
54
   String? versionRepair;
56
   String? versionRepair;
55
   String? repairCode;
57
   String? repairCode;
58
+  Null? pageNum;
59
+  Null? pageSize;
56
   String? vcode;
60
   String? vcode;
57
 
61
 
58
   Data(
62
   Data(
@@ -66,6 +70,8 @@ class Data {
66
         this.clinicCode,
70
         this.clinicCode,
67
         this.clinicName,
71
         this.clinicName,
68
         this.clinicIp,
72
         this.clinicIp,
73
+        this.serverPost,
74
+        this.webSocketPost,
69
         this.serverUser,
75
         this.serverUser,
70
         this.serverPassword,
76
         this.serverPassword,
71
         this.realmName,
77
         this.realmName,
@@ -81,6 +87,8 @@ class Data {
81
         this.versionRefer,
87
         this.versionRefer,
82
         this.versionRepair,
88
         this.versionRepair,
83
         this.repairCode,
89
         this.repairCode,
90
+        this.pageNum,
91
+        this.pageSize,
84
         this.vcode});
92
         this.vcode});
85
 
93
 
86
   Data.fromJson(Map<String, dynamic> json) {
94
   Data.fromJson(Map<String, dynamic> json) {
@@ -94,6 +102,8 @@ class Data {
94
     clinicCode = json['clinicCode'];
102
     clinicCode = json['clinicCode'];
95
     clinicName = json['clinicName'];
103
     clinicName = json['clinicName'];
96
     clinicIp = json['clinicIp'];
104
     clinicIp = json['clinicIp'];
105
+    serverPost = json['serverPost'];
106
+    webSocketPost = json['webSocketPost'];
97
     serverUser = json['serverUser'];
107
     serverUser = json['serverUser'];
98
     serverPassword = json['serverPassword'];
108
     serverPassword = json['serverPassword'];
99
     realmName = json['realmName'];
109
     realmName = json['realmName'];
@@ -109,6 +119,8 @@ class Data {
109
     versionRefer = json['versionRefer'];
119
     versionRefer = json['versionRefer'];
110
     versionRepair = json['versionRepair'];
120
     versionRepair = json['versionRepair'];
111
     repairCode = json['repairCode'];
121
     repairCode = json['repairCode'];
122
+    pageNum = json['pageNum'];
123
+    pageSize = json['pageSize'];
112
     vcode = json['vcode'];
124
     vcode = json['vcode'];
113
   }
125
   }
114
 
126
 
@@ -124,6 +136,8 @@ class Data {
124
     data['clinicCode'] = this.clinicCode;
136
     data['clinicCode'] = this.clinicCode;
125
     data['clinicName'] = this.clinicName;
137
     data['clinicName'] = this.clinicName;
126
     data['clinicIp'] = this.clinicIp;
138
     data['clinicIp'] = this.clinicIp;
139
+    data['serverPost'] = this.serverPost;
140
+    data['webSocketPost'] = this.webSocketPost;
127
     data['serverUser'] = this.serverUser;
141
     data['serverUser'] = this.serverUser;
128
     data['serverPassword'] = this.serverPassword;
142
     data['serverPassword'] = this.serverPassword;
129
     data['realmName'] = this.realmName;
143
     data['realmName'] = this.realmName;
@@ -139,6 +153,8 @@ class Data {
139
     data['versionRefer'] = this.versionRefer;
153
     data['versionRefer'] = this.versionRefer;
140
     data['versionRepair'] = this.versionRepair;
154
     data['versionRepair'] = this.versionRepair;
141
     data['repairCode'] = this.repairCode;
155
     data['repairCode'] = this.repairCode;
156
+    data['pageNum'] = this.pageNum;
157
+    data['pageSize'] = this.pageSize;
142
     data['vcode'] = this.vcode;
158
     data['vcode'] = this.vcode;
143
     return data;
159
     return data;
144
   }
160
   }

+ 3 - 0
lib/select_clinic.dart

@@ -122,6 +122,9 @@ class SelectClinic extends StatelessWidget {
122
                         subtitle: Line(),
122
                         subtitle: Line(),
123
                         onTap: () async {
123
                         onTap: () async {
124
                           Global.clinic = data!.data![index].clinicName!;
124
                           Global.clinic = data!.data![index].clinicName!;
125
+                          Global.RootUrl = data!.data![index].clinicIp!;
126
+                          Global.Port = data!.data![index].serverPost!;
127
+                          Global.ChatPort = data!.data![index].webSocketPost!;
125
                           if(mFrom == "fromHome") {
128
                           if(mFrom == "fromHome") {
126
                             synchronizeData(context);
129
                             synchronizeData(context);
127
                           } else if (!(await Utils.readData("token")).isEmpty) {
130
                           } else if (!(await Utils.readData("token")).isEmpty) {

+ 7 - 5
lib/utils/Constants.dart

@@ -10,10 +10,13 @@ class Global{
10
   static const String ServerUrl = 'http://152.136.59.80/apps/ajf-dakaxunjian/pdaPatrol/';
10
   static const String ServerUrl = 'http://152.136.59.80/apps/ajf-dakaxunjian/pdaPatrol/';
11
   static const BackgroundColor = Color.fromARGB(0xff, 0xef, 0xef, 0xef);
11
   static const BackgroundColor = Color.fromARGB(0xff, 0xef, 0xef, 0xef);
12
   static const StatusBarColor = Colors.blueAccent;
12
   static const StatusBarColor = Colors.blueAccent;
13
-  static const String BaseUrl = 'http://39.105.121.97:8080/api/app/';
14
-  // static const String BaseUrl = 'http://192.168.3.142:8080/api/app/';
15
-  // static const String BaseUrl = 'http://192.168.3.21:8080/api/app/';
16
-  static const String ImageUrl = 'http://39.105.121.97:8080/api';
13
+  static String RootUrl = '39.105.121.97';
14
+  // static const String RootUrl = '192.168.3.142';
15
+  static String Port = '8080';
16
+  static String BaseUrl = 'http://' + RootUrl + ':' + Port + '/api/app/';
17
+  static String ImageUrl = 'http://' + RootUrl + ':' + Port + '/api';
18
+  static String ChatPort = '8002';
19
+  static String SocketUrl = 'ws://' + RootUrl + ':' + ChatPort + '/ws';
17
   static const int responseSuccessCode = 200;
20
   static const int responseSuccessCode = 200;
18
   static String token = "";
21
   static String token = "";
19
   static String clinic = "";
22
   static String clinic = "";
@@ -26,5 +29,4 @@ class Global{
26
   static DoctorListEntity doctor = new DoctorListEntity();
29
   static DoctorListEntity doctor = new DoctorListEntity();
27
   static int selectDoctor = -1;
30
   static int selectDoctor = -1;
28
   static LoginEntity user = new LoginEntity();
31
   static LoginEntity user = new LoginEntity();
29
-  static const String SocketUrl = 'ws://39.105.121.97:8002/ws';
30
 }
32
 }