Skip to content

Commit fdf901b

Browse files
author
archurtan
committed
修复link sdk请求接口缺少agent和lan参数导致的设备面板数据不正确的问题
Change-Id: If9565bafb3ee4beb922fdc2ff844d49d60c9802b
1 parent 0b6d1ed commit fdf901b

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/service/BaseService.kt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.tencent.iot.explorer.link.core.auth.response.BaseResponse
88
import com.tencent.iot.explorer.link.core.auth.util.JsonManager
99
import com.tencent.iot.explorer.link.core.auth.util.SignatureUtil
1010
import com.tencent.iot.explorer.link.core.log.L
11+
import com.tencent.iot.explorer.link.core.utils.Utils
1112
import java.util.*
1213
import kotlin.collections.HashMap
1314

@@ -20,34 +21,37 @@ open class BaseService {
2021
var OEM_APP_API = "https://iot.cloud.tencent.com/api/exploreropen/appapi" // 需要替换为自建后台服务地址
2122
var OEM_TOKEN_API = "https://iot.cloud.tencent.com/api/exploreropen/tokenapi" // 可安全在设备端调用。
2223
var APP_COS_AUTH = "https://iot.cloud.tencent.com/api/studioapp/AppCosAuth"
24+
var PLATFORM = "android"
2325
}
2426

2527
/**
2628
* 未登录接口公共参数
2729
*/
2830
fun commonParams(action: String): HashMap<String, Any> {
29-
val param = HashMap<String, Any>()
30-
param["RequestId"] = UUID.randomUUID().toString()
31+
val param = baseParams()
3132
param["Action"] = action
32-
param["Platform"] = "android"
33-
param["AppKey"] = IoTAuth.APP_KEY
34-
param["Timestamp"] = System.currentTimeMillis() / 1000
35-
param["Nonce"] = Random().nextInt(10)
3633
return param
3734
}
3835

3936
/**
4037
* 登录后接口公共参数
4138
*/
4239
fun tokenParams(action: String): HashMap<String, Any> {
40+
val param = baseParams()
41+
param["Action"] = action
42+
param["AccessToken"] = IoTAuth.user.Token
43+
return param
44+
}
45+
46+
private fun baseParams(): HashMap<String, Any> {
4347
val param = HashMap<String, Any>()
4448
param["RequestId"] = UUID.randomUUID().toString()
45-
param["Action"] = action
46-
param["Platform"] = "android"
49+
param["lang"] = Utils.getLang()
50+
param["Platform"] = PLATFORM
51+
param["Agent"] = PLATFORM
4752
param["AppKey"] = IoTAuth.APP_KEY
4853
param["Timestamp"] = System.currentTimeMillis() / 1000
4954
param["Nonce"] = Random().nextInt(10)
50-
param["AccessToken"] = IoTAuth.user.Token
5155
return param
5256
}
5357

0 commit comments

Comments
 (0)