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

+ 3 - 0
lib/select_clinic.dart

@@ -122,6 +122,9 @@ class SelectClinic extends StatelessWidget {
122 122
                         subtitle: Line(),
123 123
                         onTap: () async {
124 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 128
                           if(mFrom == "fromHome") {
126 129
                             synchronizeData(context);
127 130
                           } else if (!(await Utils.readData("token")).isEmpty) {

+ 7 - 5
lib/utils/Constants.dart

@@ -10,10 +10,13 @@ class Global{
10 10
   static const String ServerUrl = 'http://152.136.59.80/apps/ajf-dakaxunjian/pdaPatrol/';
11 11
   static const BackgroundColor = Color.fromARGB(0xff, 0xef, 0xef, 0xef);
12 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 20
   static const int responseSuccessCode = 200;
18 21
   static String token = "";
19 22
   static String clinic = "";
@@ -26,5 +29,4 @@ class Global{
26 29
   static DoctorListEntity doctor = new DoctorListEntity();
27 30
   static int selectDoctor = -1;
28 31
   static LoginEntity user = new LoginEntity();
29
-  static const String SocketUrl = 'ws://39.105.121.97:8002/ws';
30 32
 }