Browse Source

1.根据运行状态设置正式地址和测试地址

20241218TB223FC(测试jar包)
wangwanlei 7 months ago
parent
commit
8ff8a8bee7

+ 2
- 0
app/src/main/java/com/xhly/manageapp/ManageApplication.kt View File

@@ -8,6 +8,7 @@ import android.content.Context
8 8
 import android.content.pm.PackageManager
9 9
 import android.os.Build
10 10
 import androidx.core.content.ContextCompat
11
+import androidx.multidex.BuildConfig
11 12
 import androidx.multidex.MultiDex
12 13
 import androidx.multidex.MultiDexApplication
13 14
 import com.hjq.toast.Toaster
@@ -702,6 +703,7 @@ class ManageApplication : MultiDexApplication() {
702 703
         super.onCreate()
703 704
         val processName = SystemUtil.getProcessName(this, android.os.Process.myPid())
704 705
         if (processName != null && processName.equals(packageName)) {
706
+            Const.setBaseUrl(com.xhkjedu.manageapp.BuildConfig.IS_DEBUG)
705 707
             CrashReport.initCrashReport(applicationContext, "37c72ff74c", false);
706 708
             instance = this
707 709
             val spUtils = SharedPreferencesUtils.getInstance(this)

+ 32
- 8
corelib/src/main/java/com/xhly/corelib/Const.kt View File

@@ -7,6 +7,38 @@ object Const {
7 7
     //TODO 发布时修改测试模式
8 8
     const val isDebug = true
9 9
 
10
+    //接口地址 正式地址mcapi.xhkjedu.com测试地址mcapitest.xhkjedu.com
11
+    var  BASEURL="mcapi.xhkjedu.com"
12
+
13
+    //socket接口地址 正式地址mcws.xhkjedu.com测试地址mcwstest.xhkjedu.com
14
+    var  WSBASEURL="mcws.xhkjedu.com"
15
+
16
+    var  URL1: String = "https://$BASEURL/"
17
+
18
+    //接口地址
19
+    var  WSURL: String = "wss://$WSBASEURL/ws"
20
+
21
+    public fun setBaseUrl(isDebug:Boolean=false){
22
+        //接口地址 正式地址mcapi.xhkjedu.com测试地址
23
+       BASEURL=if (isDebug){
24
+           "mcapitest.xhkjedu.com"
25
+       }else{
26
+           "mcapi.xhkjedu.com"
27
+       }
28
+
29
+        //socket接口地址 正式地址mcws.xhkjedu.com测试地址
30
+        WSBASEURL=if (isDebug){
31
+            "mcwstest.xhkjedu.com"
32
+        }else{
33
+            "mcws.xhkjedu.com"
34
+        }
35
+
36
+       URL1 = "https://$BASEURL/"
37
+
38
+        //接口地址
39
+        WSURL= "wss://$WSBASEURL/ws"
40
+    }
41
+
10 42
     //记录点击返回的次数,超过UPDATESTRATEGYNUM次请求策略
11 43
     var backNum = 0
12 44
 
@@ -72,14 +104,6 @@ object Const {
72 104
     //存储SIM卡号码
73 105
     const val SIMPHONENUM= "SIMPHONENUM"
74 106
 
75
-    //接口地址 正式地址mc.xhkjedu.com测试地址mcapitest.xhkjedu.com
76
-    const val BASEURL="mc.xhkjedu.com"
77
-    const val URL1: String = "https://$BASEURL/"
78
-
79
-    //socket接口地址 正式地址mcws.xhkjedu.com测试地址mcwstest.xhkjedu.com
80
-    const val WSBASEURL="mcws.xhkjedu.com"
81
-    //接口地址
82
-    const val WSURL: String = "wss://$WSBASEURL/ws"
83 107
 
84 108
     //标记平板禁用(来源于socket)
85 109
     const val DISABLEPAD = "DISABLEPAD"

Loading…
Cancel
Save