From b01eb4ec0468ad08f5ae7a92c5e2e7be3096330a Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 22 十一月 2022 15:33:37 +0800 Subject: [PATCH] 完成子账号功能 --- AndroidOpenDemo/.idea/workspace.xml | 71 ++++++++++++----------------------- AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java | 1 AndroidOpenDemo/app/src/main/java/com/lechange/demo/ui/EnvGuideActivity.java | 2 AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpClient.java | 2 AndroidOpenDemo/app/src/main/java/com/hdl/HdlToLc.java | 5 +- AndroidOpenDemo/app/src/main/java/com/common/openapi/DeviceInfoOpenApiManager.java | 2 6 files changed, 31 insertions(+), 52 deletions(-) diff --git a/AndroidOpenDemo/.idea/workspace.xml b/AndroidOpenDemo/.idea/workspace.xml index 6fac68e..98cdf1f 100644 --- a/AndroidOpenDemo/.idea/workspace.xml +++ b/AndroidOpenDemo/.idea/workspace.xml @@ -6,7 +6,7 @@ </shared> </component> <component name="AndroidLogFilters"> - <option name="TOOL_WINDOW_CUSTOM_FILTER" value="reqest: " /> + <option name="TOOL_WINDOW_CUSTOM_FILTER" value="HttpSend" /> <option name="TOOL_WINDOW_LOG_LEVEL" value="verbose" /> <option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Show only selected application" /> </component> @@ -16,14 +16,11 @@ <component name="ChangeListManager"> <list default="true" id="7bacc5cf-316f-4ad4-b191-7f5297eb7bcf" name="Default Changelist" comment=""> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/LCDeviceEngine.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/LCDeviceEngine.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/CONST.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/CONST.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/DeviceAddOpenApiManager.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/DeviceAddOpenApiManager.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpClient.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/app/src/main/java/com/common/openapi/DeviceInfoOpenApiManager.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/common/openapi/DeviceInfoOpenApiManager.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/com/hdl/HdlToLc.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/hdl/HdlToLc.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/com/lechange/demo/ui/EnvGuideActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/lechange/demo/ui/EnvGuideActivity.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_device_detail_main.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_device_detail_main.xml" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> @@ -355,51 +352,51 @@ <screen x="0" y="0" width="1280" height="800" /> </state> <state x="453" y="91" key="#com.intellij.ide.util.MemberChooser/0.0.1280.800@0.0.1280.800" timestamp="1669099481115" /> - <state width="462" height="480" key="DebuggerActiveHint" timestamp="1669100189203"> - <screen x="0" y="23" width="1280" height="777" /> + <state width="503" height="480" key="DebuggerActiveHint" timestamp="1669101875842"> + <screen x="0" y="0" width="1280" height="800" /> </state> - <state width="462" height="480" key="DebuggerActiveHint/0.0.1280.800@0.0.1280.800" timestamp="1669096140301" /> + <state width="503" height="480" key="DebuggerActiveHint/0.0.1280.800@0.0.1280.800" timestamp="1669101875842" /> <state width="462" height="480" key="DebuggerActiveHint/0.23.1280.777@0.23.1280.777" timestamp="1669100189203" /> - <state width="1236" height="288" key="GridCell.Tab.0.bottom" timestamp="1669100498343"> + <state width="1236" height="287" key="GridCell.Tab.0.bottom" timestamp="1669101968820"> <screen x="0" y="0" width="1280" height="800" /> </state> - <state width="1236" height="288" key="GridCell.Tab.0.bottom/0.0.1280.800@0.0.1280.800" timestamp="1669100498343" /> + <state width="1236" height="287" key="GridCell.Tab.0.bottom/0.0.1280.800@0.0.1280.800" timestamp="1669101968820" /> <state width="1236" height="206" key="GridCell.Tab.0.bottom/0.23.1280.777@0.23.1280.777" timestamp="1669007123738" /> - <state width="1236" height="288" key="GridCell.Tab.0.center" timestamp="1669100498342"> + <state width="1236" height="287" key="GridCell.Tab.0.center" timestamp="1669101968818"> <screen x="0" y="0" width="1280" height="800" /> </state> - <state width="1236" height="288" key="GridCell.Tab.0.center/0.0.1280.800@0.0.1280.800" timestamp="1669100498342" /> + <state width="1236" height="287" key="GridCell.Tab.0.center/0.0.1280.800@0.0.1280.800" timestamp="1669101968818" /> <state width="1236" height="206" key="GridCell.Tab.0.center/0.23.1280.777@0.23.1280.777" timestamp="1669007123735" /> - <state width="1236" height="288" key="GridCell.Tab.0.left" timestamp="1669100498341"> + <state width="1236" height="287" key="GridCell.Tab.0.left" timestamp="1669101968816"> <screen x="0" y="0" width="1280" height="800" /> </state> - <state width="1236" height="288" key="GridCell.Tab.0.left/0.0.1280.800@0.0.1280.800" timestamp="1669100498341" /> + <state width="1236" height="287" key="GridCell.Tab.0.left/0.0.1280.800@0.0.1280.800" timestamp="1669101968816" /> <state width="1236" height="206" key="GridCell.Tab.0.left/0.23.1280.777@0.23.1280.777" timestamp="1669007123734" /> - <state width="1236" height="288" key="GridCell.Tab.0.right" timestamp="1669100498342"> + <state width="1236" height="287" key="GridCell.Tab.0.right" timestamp="1669101968819"> <screen x="0" y="0" width="1280" height="800" /> </state> - <state width="1236" height="288" key="GridCell.Tab.0.right/0.0.1280.800@0.0.1280.800" timestamp="1669100498342" /> + <state width="1236" height="287" key="GridCell.Tab.0.right/0.0.1280.800@0.0.1280.800" timestamp="1669101968819" /> <state width="1236" height="206" key="GridCell.Tab.0.right/0.23.1280.777@0.23.1280.777" timestamp="1669007123736" /> - <state width="1236" height="288" key="GridCell.Tab.1.bottom" timestamp="1669100498345"> + <state width="1236" height="287" key="GridCell.Tab.1.bottom" timestamp="1669101968826"> <screen x="0" y="0" width="1280" height="800" /> </state> - <state width="1236" height="288" key="GridCell.Tab.1.bottom/0.0.1280.800@0.0.1280.800" timestamp="1669100498345" /> - <state width="1236" height="288" key="GridCell.Tab.1.center" timestamp="1669100498344"> + <state width="1236" height="287" key="GridCell.Tab.1.bottom/0.0.1280.800@0.0.1280.800" timestamp="1669101968826" /> + <state width="1236" height="287" key="GridCell.Tab.1.center" timestamp="1669101968824"> <screen x="0" y="0" width="1280" height="800" /> </state> - <state width="1236" height="288" key="GridCell.Tab.1.center/0.0.1280.800@0.0.1280.800" timestamp="1669100498344" /> - <state width="1236" height="288" key="GridCell.Tab.1.left" timestamp="1669100498344"> + <state width="1236" height="287" key="GridCell.Tab.1.center/0.0.1280.800@0.0.1280.800" timestamp="1669101968824" /> + <state width="1236" height="287" key="GridCell.Tab.1.left" timestamp="1669101968822"> <screen x="0" y="0" width="1280" height="800" /> </state> - <state width="1236" height="288" key="GridCell.Tab.1.left/0.0.1280.800@0.0.1280.800" timestamp="1669100498344" /> - <state width="1236" height="288" key="GridCell.Tab.1.right" timestamp="1669100498345"> + <state width="1236" height="287" key="GridCell.Tab.1.left/0.0.1280.800@0.0.1280.800" timestamp="1669101968822" /> + <state width="1236" height="287" key="GridCell.Tab.1.right" timestamp="1669101968825"> <screen x="0" y="0" width="1280" height="800" /> </state> - <state width="1236" height="288" key="GridCell.Tab.1.right/0.0.1280.800@0.0.1280.800" timestamp="1669100498345" /> - <state x="332" y="155" width="769" height="518" key="find.popup" timestamp="1669100335613"> + <state width="1236" height="287" key="GridCell.Tab.1.right/0.0.1280.800@0.0.1280.800" timestamp="1669101968825" /> + <state x="332" y="44" width="769" height="629" key="find.popup" timestamp="1669101340329"> <screen x="0" y="0" width="1280" height="800" /> </state> - <state x="332" y="155" width="769" height="518" key="find.popup/0.0.1280.800@0.0.1280.800" timestamp="1669100335613" /> + <state x="332" y="44" width="769" height="629" key="find.popup/0.0.1280.800@0.0.1280.800" timestamp="1669101340329" /> </component> <component name="XDebuggerManager"> <breakpoint-manager> @@ -435,34 +432,14 @@ <option name="timeStamp" value="40" /> </line-breakpoint> <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> - <url>file://$PROJECT_DIR$/app/src/main/java/com/lechange/demo/ui/DeviceLocalRecordListFragment.java</url> - <line>295</line> - <option name="timeStamp" value="47" /> - </line-breakpoint> - <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> - <url>file://$PROJECT_DIR$/app/src/main/java/com/lechange/demo/ui/DeviceLocalRecordListFragment.java</url> - <line>301</line> - <option name="timeStamp" value="48" /> - </line-breakpoint> - <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> <url>file://$PROJECT_DIR$/app/src/main/java/com/common/openapi/DeviceInfoOpenApiManager.java</url> <line>77</line> <option name="timeStamp" value="61" /> </line-breakpoint> <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> <url>file://$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java</url> - <line>186</line> + <line>187</line> <option name="timeStamp" value="84" /> - </line-breakpoint> - <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> - <url>file://$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java</url> - <line>102</line> - <option name="timeStamp" value="86" /> - </line-breakpoint> - <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> - <url>file://$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java</url> - <line>100</line> - <option name="timeStamp" value="87" /> </line-breakpoint> </breakpoints> </breakpoint-manager> diff --git a/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpClient.java b/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpClient.java index 15dc700..b79ac2a 100644 --- a/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpClient.java +++ b/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpClient.java @@ -53,7 +53,7 @@ conn.setUseCaches(false); conn.setInstanceFollowRedirects(true); conn.setRequestProperty("Content-Type", contentType); - conn.setRequestProperty("Authorization","Bearer "+ LCDeviceEngine.newInstance().subAccessToken); + conn.setRequestProperty("Authorization","Bearer "+ LCDeviceEngine.newInstance().accessToken); conn.connect(); outputStream = conn.getOutputStream(); outputStream.write(paramStr.getBytes()); diff --git a/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java b/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java index 444c507..e0bc9ad 100644 --- a/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java +++ b/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java @@ -98,6 +98,7 @@ try { LogUtil.debugLog(TAG, "reqest: " + url + " data:" + json); String openApi = HttpClient.post(url, json, "application/json", "OpenApi",timeOut); + LogUtil.debugLog(TAG, "杩斿洖缁撴灉: \r\n" + openApi); jsonObject = new JsonParser().parse(openApi).getAsJsonObject(); } catch (IOException e) { BusinessException b = new BusinessException(e); diff --git a/AndroidOpenDemo/app/src/main/java/com/common/openapi/DeviceInfoOpenApiManager.java b/AndroidOpenDemo/app/src/main/java/com/common/openapi/DeviceInfoOpenApiManager.java index 0dc7d6d..3ceda8d 100644 --- a/AndroidOpenDemo/app/src/main/java/com/common/openapi/DeviceInfoOpenApiManager.java +++ b/AndroidOpenDemo/app/src/main/java/com/common/openapi/DeviceInfoOpenApiManager.java @@ -240,7 +240,7 @@ paramsMap.put("channelId", cloudRecordsData.data.channelId); paramsMap.put("beginTime", cloudRecordsData.data.beginTime); paramsMap.put("endTime", cloudRecordsData.data.endTime); - paramsMap.put("nextRecordId", cloudRecordsData.data.nextRecordId); +// paramsMap.put("nextRecordId", cloudRecordsData.data.nextRecordId); paramsMap.put("count", cloudRecordsData.data.count); JsonObject json = HttpSend.execute(paramsMap, MethodConst.METHOD_GET_CLOUND_RECORDS,TIME_OUT); CloudRecordsData.Response response = new CloudRecordsData.Response(); diff --git a/AndroidOpenDemo/app/src/main/java/com/hdl/HdlToLc.java b/AndroidOpenDemo/app/src/main/java/com/hdl/HdlToLc.java index 08fea68..1331223 100644 --- a/AndroidOpenDemo/app/src/main/java/com/hdl/HdlToLc.java +++ b/AndroidOpenDemo/app/src/main/java/com/hdl/HdlToLc.java @@ -54,11 +54,12 @@ Toast.makeText(mActivity, e.getMessage(), Toast.LENGTH_SHORT).show(); } } - public static void openActivity(String homeId,String token) { + public static void openActivity(String homeId,String token,String subAccessToken) { try { // getSubAccountToken("827a98c98da7469b8bc19bb6a3c7651906"); LCDeviceEngine.newInstance().setHomeId(homeId); - LCDeviceEngine.newInstance().setSubAccessToken(token); + LCDeviceEngine.newInstance().accessToken=(token); + LCDeviceEngine.newInstance().setSubAccessToken(subAccessToken); mActivity.startActivity(new Intent(mActivity, com.lechange.demo.ui.DeviceListActivity.class)); } catch (Throwable e) { Toast.makeText(mActivity, e.getMessage(), Toast.LENGTH_SHORT).show(); diff --git a/AndroidOpenDemo/app/src/main/java/com/lechange/demo/ui/EnvGuideActivity.java b/AndroidOpenDemo/app/src/main/java/com/lechange/demo/ui/EnvGuideActivity.java index c1be683..e045fb7 100644 --- a/AndroidOpenDemo/app/src/main/java/com/lechange/demo/ui/EnvGuideActivity.java +++ b/AndroidOpenDemo/app/src/main/java/com/lechange/demo/ui/EnvGuideActivity.java @@ -67,7 +67,7 @@ HdlToLc.initData(this,"HDL-HOME-APP-TEST","WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss",false); } - HdlToLc.openActivity("1547099040465408002","eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI2ODI2MjA3ZTgwY2M0ZGVmODcwMDQyNDBhZDYwN2EyOSIsImNvbXBhbnlJZCI6IjIwMiIsInJvbGUiOiIiLCJoZWFkZXJQcmVmaXgiOiJCZWFyZXIgIiwidXNlckFjY291bnQiOiJ3eHIiLCJ0ZW5hbnRJZCI6IjIwIiwidXNlclR5cGUiOiJVU0VSX0IiLCJ0b2tlblR5cGUiOiJhY2Nlc3NfdG9rZW4iLCJ1c2VyTmFtZSI6Ind4ciIsIm9wZW5BcHBsaWNhdGlvbklkIjoiMCIsInVzZXJJZCI6IjEzOTIwMzU1NjgyMDQ0MjMxNjkiLCJleHAiOjE2NjkxMDQ4NzAsIm5iZiI6MTY2OTA5NzY3MH0.J9BCjbGjWA4yn57_EPxvaXJsPfDSTwG4jsFtiejRrjk6OxA74XO3eWbvu75dfl1P1AmcdbXvhgeX3FBCgRthNQVActSopUNWefBsV0k4wv4RCXhR6lM63HFVgfgCMy01nmFOxqR7bTO1yM6ffQ102NKOLUFNuaNVbA2pnEanuvg"); + HdlToLc.openActivity("1547099040465408002","eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiIzMTI5ZjNlMDAwY2Q0YzhiOTgyYjUyNTk5MTE2MTJlMCIsImNvbXBhbnlJZCI6IjIwMiIsInJvbGUiOiIiLCJoZWFkZXJQcmVmaXgiOiJCZWFyZXIgIiwidXNlckFjY291bnQiOiJ3eHIiLCJ0ZW5hbnRJZCI6IjIwIiwidXNlclR5cGUiOiJVU0VSX0IiLCJ0b2tlblR5cGUiOiJhY2Nlc3NfdG9rZW4iLCJ1c2VyTmFtZSI6Ind4ciIsIm9wZW5BcHBsaWNhdGlvbklkIjoiMCIsInVzZXJJZCI6IjEzOTIwMzU1NjgyMDQ0MjMxNjkiLCJleHAiOjE2NjkxMDkxMjcsIm5iZiI6MTY2OTEwMTkyN30.TIyMqggqbaYoBEApeHTq3AidoKWZt5HpO2eUkhn_58VslSTxc-NhHwclTHjLpdVaMklJk1HMLQLwPOiJGhbUksOewO2dStzW1xYOpb_6zDs6Rw6v0h5cKmAYOf1f1S6RLqF2EHigf9fyy090ClWYcJo-9c_CFBXir4Y1lzDmLZQ","St_00003ee84eda32b14126af958052f20a"); } -- Gitblit v1.8.0