Browse Source

1.修改Soekct消息类型

master
wangwanlei 10 months ago
parent
commit
42c896dca5

+ 13
- 0
app/src/main/java/com/xhly/manageapp/bean/strategy/PadViolateBean.kt View File

1
+package com.xhly.manageapp.bean.strategy
2
+
3
+class PadViolateBean {
4
+    /**
5
+     * 违规类型:1已ROOT 2安装非商店应用 3更换SIM卡 4USB连接电脑
6
+     */
7
+    var violateType: String? = "0"
8
+
9
+    /**
10
+     * 处理方式(中文分号隔开)
11
+     */
12
+    var handle_method: String? = ""
13
+}

+ 18
- 2
app/src/main/java/com/xhly/manageapp/service/websocket/AppSocket.kt View File

21
 import com.xhly.manageapp.bean.log.LogdOperateBean
21
 import com.xhly.manageapp.bean.log.LogdOperateBean
22
 import com.xhly.manageapp.network.log.LogService
22
 import com.xhly.manageapp.network.log.LogService
23
 import com.xhly.websocket.bean.WebSocketData
23
 import com.xhly.websocket.bean.WebSocketData
24
+import com.xhly.websocket.bean.WebSocketUserBean
24
 import com.xhly.websocket.service.SocketClient
25
 import com.xhly.websocket.service.SocketClient
25
 import com.xhly.websocket.service.WebSocketHelper
26
 import com.xhly.websocket.service.WebSocketHelper
26
 import com.xhly.websocket.utils.SocketPushUtils
27
 import com.xhly.websocket.utils.SocketPushUtils
68
         super.onConnectedSuccess()
69
         super.onConnectedSuccess()
69
         UIEvent(Const.UPDATE_CONNECTED_SUCCESS).post()
70
         UIEvent(Const.UPDATE_CONNECTED_SUCCESS).post()
70
         val webData = WebSocketData()
71
         val webData = WebSocketData()
71
-        webData.code = 1002
72
+        webData.code = 1001
72
         webData.mid = UUID.randomUUID().toString()
73
         webData.mid = UUID.randomUUID().toString()
73
         val currentTimeSeconds = System.currentTimeMillis() / 1000
74
         val currentTimeSeconds = System.currentTimeMillis() / 1000
74
         webData.timeunix = currentTimeSeconds
75
         webData.timeunix = currentTimeSeconds
75
-        webData.fid = 1
76
+        webData.fid = "1"
76
         val jsMD5 =
77
         val jsMD5 =
77
             MD5Utils.getJsMD5(webData.code.toString() + "_" + webData.mid + "_" + webData.timeunix.toString())
78
             MD5Utils.getJsMD5(webData.code.toString() + "_" + webData.mid + "_" + webData.timeunix.toString())
78
         webData.sign = MD5Utils.getJsMD5(jsMD5)
79
         webData.sign = MD5Utils.getJsMD5(jsMD5)
80
+        val socketUserBean = WebSocketUserBean()
81
+        socketUserBean.usertype = 1
82
+        socketUserBean.username = "测试"
83
+        socketUserBean.userid = ManageApplication.getDeviceInfo()
84
+        webData.body = socketUserBean
79
         WebSocketHelper.getInstance().sendSocketString(GsonUtils.parseClassToJson(webData))
85
         WebSocketHelper.getInstance().sendSocketString(GsonUtils.parseClassToJson(webData))
80
     }
86
     }
81
 
87
 
92
                 goMainActivity()
98
                 goMainActivity()
93
             }
99
             }
94
 
100
 
101
+            Const.CODE2003.toString() -> {
102
+                Toast.makeText(context, "解除限制", Toast.LENGTH_LONG).show()
103
+                spUtils.setParam(Const.DISABLEAPP, false)
104
+                goMainActivity()
105
+            }
106
+
107
+            Const.CODE2004.toString() -> {
108
+               //请求接口更新策略
109
+            }
110
+
95
             Const.CODE2005.toString() -> {
111
             Const.CODE2005.toString() -> {
96
                 ManageApplication.rebootDevice()
112
                 ManageApplication.rebootDevice()
97
             }
113
             }

+ 2
- 4
app/src/main/java/com/xhly/manageapp/service/websocket/AppSocketService.kt View File

3
 import android.app.Notification
3
 import android.app.Notification
4
 import android.app.NotificationChannel
4
 import android.app.NotificationChannel
5
 import android.app.NotificationManager
5
 import android.app.NotificationManager
6
-import android.app.Service
7
 import android.content.ComponentName
6
 import android.content.ComponentName
8
 import android.content.Context
7
 import android.content.Context
9
 import android.content.Intent
8
 import android.content.Intent
10
 import android.os.Build
9
 import android.os.Build
11
-import android.os.Environment
12
 import android.widget.Toast
10
 import android.widget.Toast
13
 import com.billbook.lib.downloader.Download
11
 import com.billbook.lib.downloader.Download
14
 import com.billbook.lib.downloader.Downloader
12
 import com.billbook.lib.downloader.Downloader
88
         webData.mid = UUID.randomUUID().toString()
86
         webData.mid = UUID.randomUUID().toString()
89
         val currentTimeSeconds = System.currentTimeMillis() / 1000
87
         val currentTimeSeconds = System.currentTimeMillis() / 1000
90
         webData.timeunix = currentTimeSeconds
88
         webData.timeunix = currentTimeSeconds
91
-        webData.fid = 1
89
+        webData.fid = "1"
92
         val jsMD5 =
90
         val jsMD5 =
93
             MD5Utils.getJsMD5(webData.code.toString() + "_" + webData.mid + "_" + webData.timeunix.toString())
91
             MD5Utils.getJsMD5(webData.code.toString() + "_" + webData.mid + "_" + webData.timeunix.toString())
94
         webData.sign = MD5Utils.getJsMD5(jsMD5)
92
         webData.sign = MD5Utils.getJsMD5(jsMD5)
247
                 val successful = execute.isSuccessful()
245
                 val successful = execute.isSuccessful()
248
                 LogShow("下载结果" + successful)
246
                 LogShow("下载结果" + successful)
249
                 if (successful) {
247
                 if (successful) {
250
-                    withContext(Dispatchers.Main){
248
+                    withContext(Dispatchers.Main) {
251
                         ManageApplication.installPackage(File(name, "test.apk").toString())
249
                         ManageApplication.installPackage(File(name, "test.apk").toString())
252
                     }
250
                     }
253
                 }
251
                 }

+ 6
- 0
corelib/src/main/java/com/xhly/corelib/Const.kt View File

14
     //作为存储白名单应用的key
14
     //作为存储白名单应用的key
15
     const val WHITELISTAPP = "WHITELISTAPP"
15
     const val WHITELISTAPP = "WHITELISTAPP"
16
 
16
 
17
+    //存储是否是第一次打开的key
18
+    const val FIRSTFLAG = "FIRSTFLAG"
19
+
17
     //401退出登录
20
     //401退出登录
18
     const val LOGIN_OUT_401 = "LOGIN_OUT_401"
21
     const val LOGIN_OUT_401 = "LOGIN_OUT_401"
19
 
22
 
52
 
55
 
53
     //标记应用卸载
56
     //标记应用卸载
54
     const val APPUNINSTALL = "APPUNINSTALL"
57
     const val APPUNINSTALL = "APPUNINSTALL"
58
+
59
+    //标记更新策略
60
+    const val UPDATESTRATEGY = "UPDATESTRATEGY"
55
 }
61
 }

+ 2
- 2
websocket/src/main/java/com/xhly/websocket/bean/WebSocketData.kt View File

8
 
8
 
9
     //两次md5加密timeunix
9
     //两次md5加密timeunix
10
     var sign: String? = null
10
     var sign: String? = null
11
-    var fid: Int = 0
12
-    var tids: IntArray = intArrayOf()
11
+    var fid: String? = "0"
12
+    var tids: Array<String?> = arrayOf()
13
     var body: Any? = null
13
     var body: Any? = null
14
 }
14
 }

+ 9
- 0
websocket/src/main/java/com/xhly/websocket/bean/WebSocketUserBean.kt View File

1
+package com.xhly.websocket.bean
2
+
3
+class WebSocketUserBean {
4
+    var userid: String? = ""
5
+    var username: String? = ""
6
+
7
+    //1是管理员,2是学生
8
+    var usertype = 1
9
+}

Loading…
Cancel
Save