diff --git a/.gradle/5.6.4/executionHistory/executionHistory.bin b/.gradle/5.6.4/executionHistory/executionHistory.bin index 3fdc8da..0ed50dd 100644 Binary files a/.gradle/5.6.4/executionHistory/executionHistory.bin and b/.gradle/5.6.4/executionHistory/executionHistory.bin differ diff --git a/.gradle/5.6.4/executionHistory/executionHistory.lock b/.gradle/5.6.4/executionHistory/executionHistory.lock index b4e5333..26f8f8d 100644 Binary files a/.gradle/5.6.4/executionHistory/executionHistory.lock and b/.gradle/5.6.4/executionHistory/executionHistory.lock differ diff --git a/.gradle/5.6.4/fileContent/fileContent.lock b/.gradle/5.6.4/fileContent/fileContent.lock index 3be010a..88ca68c 100644 Binary files a/.gradle/5.6.4/fileContent/fileContent.lock and b/.gradle/5.6.4/fileContent/fileContent.lock differ diff --git a/.gradle/5.6.4/fileHashes/fileHashes.bin b/.gradle/5.6.4/fileHashes/fileHashes.bin index d24afcb..074dec8 100644 Binary files a/.gradle/5.6.4/fileHashes/fileHashes.bin and b/.gradle/5.6.4/fileHashes/fileHashes.bin differ diff --git a/.gradle/5.6.4/fileHashes/fileHashes.lock b/.gradle/5.6.4/fileHashes/fileHashes.lock index 7e05775..227ef72 100644 Binary files a/.gradle/5.6.4/fileHashes/fileHashes.lock and b/.gradle/5.6.4/fileHashes/fileHashes.lock differ diff --git a/.gradle/5.6.4/fileHashes/resourceHashesCache.bin b/.gradle/5.6.4/fileHashes/resourceHashesCache.bin index 7cbf554..3c05a87 100644 Binary files a/.gradle/5.6.4/fileHashes/resourceHashesCache.bin and b/.gradle/5.6.4/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/5.6.4/javaCompile/classAnalysis.bin b/.gradle/5.6.4/javaCompile/classAnalysis.bin index 387ece3..8c6c18a 100644 Binary files a/.gradle/5.6.4/javaCompile/classAnalysis.bin and b/.gradle/5.6.4/javaCompile/classAnalysis.bin differ diff --git a/.gradle/5.6.4/javaCompile/jarAnalysis.bin b/.gradle/5.6.4/javaCompile/jarAnalysis.bin index d8b46ec..be235c4 100644 Binary files a/.gradle/5.6.4/javaCompile/jarAnalysis.bin and b/.gradle/5.6.4/javaCompile/jarAnalysis.bin differ diff --git a/.gradle/5.6.4/javaCompile/javaCompile.lock b/.gradle/5.6.4/javaCompile/javaCompile.lock index 501c4c7..39175ec 100644 Binary files a/.gradle/5.6.4/javaCompile/javaCompile.lock and b/.gradle/5.6.4/javaCompile/javaCompile.lock differ diff --git a/.gradle/5.6.4/javaCompile/taskHistory.bin b/.gradle/5.6.4/javaCompile/taskHistory.bin index 9f3bd47..b7dc5c5 100644 Binary files a/.gradle/5.6.4/javaCompile/taskHistory.bin and b/.gradle/5.6.4/javaCompile/taskHistory.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 4d75e78..79e8651 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties index 050b5c4..a8c2cb1 100644 --- a/.gradle/buildOutputCleanup/cache.properties +++ b/.gradle/buildOutputCleanup/cache.properties @@ -1,2 +1,2 @@ -#Mon Mar 04 15:33:52 GMT+08:00 2024 +#Tue Jun 25 17:25:11 GMT+08:00 2024 gradle.version=5.6.4 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index ab051f4..6fe697e 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/app/build.gradle b/app/build.gradle index 8c678fe..18cb69c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ android { applicationId "net.sysolution.taxiapp" minSdkVersion 21 targetSdkVersion 29 - versionCode 256 - versionName "3.3.3-beta26.4.1.5-release" + versionCode 257 + versionName "3.3.3-beta26.4.1.4-release" //alphaxx - 预览版本,不会对外发布,由测试人员测试,会有很多bug //Betaxx - 公开测试版本,会发给其他工作人员,会有较多版本 diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt index 483da4b..2dc8bd0 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt +++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt @@ -256,11 +256,13 @@ object ProcessingCommands { // val endRuntime = Configurations.config(TaxiApp.instance()).endRunTime() val todaySumRunTime = Configurations.config(TaxiApp.instance()).todaySumRunTime() "getTodayRuntime-->当天taxiApp运行时间:$todaySumRunTime".logd() - +// val sumTimeList = DaoUtil.getRunTimeDao().queryBuilder().where( +// RunTimeDataDao.Properties.IsUpload.eq(0)).list() sanleResponse.type = type sanleResponse.id = baseResponse.id sanleResponse.task_id = baseResponse.task_id sanleResponse.runtime = todaySumRunTime +// sanleResponse.runtime = sumTimeList.size.toLong() val response = gson.toJson(sanleResponse) send(response) } diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt b/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt index 083081d..45a1a6d 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt +++ b/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt @@ -69,32 +69,36 @@ object EasyHttpTool { if (!sumTimeList.isNullOrEmpty()){ for (runTimeData in sumTimeList) { - val runtimeJson = RuntimeJson(runTimeData.cardId,runTimeData.sumRuntime,runTimeData.startRuntime) - val runtimeJsonStr = Gson().toJson(runtimeJson) - "提交运行时长sendRunTimeToServer:$runtimeJsonStr".logd() - val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull() - val body = RequestBody.create(parse, runtimeJsonStr) - EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postRunningTimeLog") - .readTimeOut(80*1000) - .writeTimeOut(80*1000) - .connectTimeout(80*1000) - .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}") - .headers("Accept-Encoding", "gzip") - .requestBody(body) - .retryCount(1)//本次请求重试次数 - .retryDelay(1000)//本次请求重试延迟时间1000ms - .execute(object :SimpleCallBack(){ - override fun onError(e: ApiException?) { - "上传运行时长失败:${e?.message}".loge() - } - override fun onSuccess(t: String?) { - "上传运行时长成功:${t}".loge() - runTimeData.isUpload = 1 - DaoUtil.getRunTimeDao().update(runTimeData) - "将提交的runTimeData标记成已上传".logd() - } - }) + sendRunLogToServer(runTimeData) + +// val runtimeJson = RuntimeJson(runTimeData.cardId,runTimeData.sumRuntime,runTimeData.startRuntime) +// val runtimeJsonStr = Gson().toJson(runtimeJson) +// "提交运行时长sendRunTimeToServer:$runtimeJsonStr".logd() +// val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull() +// val body = RequestBody.create(parse, runtimeJsonStr) + +// EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postRunningTimeLog") +// .readTimeOut(80*1000) +// .writeTimeOut(80*1000) +// .connectTimeout(80*1000) +// .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}") +// .headers("Accept-Encoding", "gzip") +// .requestBody(body) +// .retryCount(1)//本次请求重试次数 +// .retryDelay(1000)//本次请求重试延迟时间1000ms +// .execute(object :SimpleCallBack(){ +// override fun onError(e: ApiException?) { +// "上传运行时长失败:${e?.message}".loge() +// } +// +// override fun onSuccess(t: String?) { +// "上传运行时长成功:${t}".loge() +// runTimeData.isUpload = 1 +// DaoUtil.getRunTimeDao().update(runTimeData) +// "将提交的runTimeData标记成已上传".logd() +// } +// }) } // val lists:List = sumTimeList.map { @@ -108,6 +112,42 @@ object EasyHttpTool { } + /** + * 上传1条运行日志 + */ + fun sendRunLogToServer(runTimeData:RunTimeData){ +// val logJson = ProcessingCommands.gson.toJson(dbPlayerLogs) + val runtimeJson = RuntimeJson(runTimeData.cardId,runTimeData.sumRuntime,runTimeData.startRuntime) + val runtimeJsonStr = Gson().toJson(runtimeJson) + "提交运行时长sendRunTimeToServer:$runtimeJsonStr".logd() + val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull() + val body = RequestBody.create(parse, runtimeJsonStr) + val url = Configurations.config(TaxiApp.instance()).logServiceUrl() + "postRunningTimeLog" + + try { + val request = Request.Builder() + .url(url) + .addHeader("Authorization","Bearer ${Configurations.config(TaxiApp.instance()).appToken()}") + .addHeader("Accept-Encoding","gzip") + .post(body) + .build() + val response = OkHttpTool.getInstance().client.newCall(request).execute() + "response code:${response?.code}".logd() + "response body:${response?.body?.string().toString()}".logd() + if (response.isSuccessful){ + "上传运行时长成功".loge() + runTimeData.isUpload = 1 + DaoUtil.getRunTimeDao().update(runTimeData) + "将提交的runTimeData标记成已上传".logd() + } else { + "上传运行时长失败".loge() + } + } catch (e: Exception) { + "上传运行时长失败:${e?.message}".loge() + } + + } + /** * 提交日志摘要 @@ -229,4 +269,5 @@ object EasyHttpTool { // }) } + } \ No newline at end of file diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt index a29b0bd..7591dc3 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt +++ b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt @@ -236,14 +236,16 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen DaoUtil.getRunTimeDao().insert(runTimeData) } - //提交未上传的运行时长数据 - EasyHttpTool.sendRunTimeToServer() + //重新初始化startRunTime为当前启动时间,sumRuntime为0 configurations.startRunTimeSave(currentTime) configurations.sumRunTimeSave(0) //开启定时器,让sumRunTime累加 startSaveSumTimer() + + //提交未上传的运行时长数据 + EasyHttpTool.sendRunTimeToServer() //跳出循环 break } else { diff --git a/local.properties b/local.properties index a7e99fe..42be3be 100644 --- a/local.properties +++ b/local.properties @@ -4,5 +4,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Tue May 21 14:20:34 GMT+08:00 2024 +#Tue Jun 25 17:11:45 GMT+08:00 2024 sdk.dir=D\:\\Android\\sdk diff --git a/release/output.json b/release/output.json index 9dfc415..c8a8905 100644 --- a/release/output.json +++ b/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":256,"versionName":"3.3.3-beta26.4.1.5-release","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.1.5-release{256}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.1.5-release{256}.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":257,"versionName":"3.3.3-beta26.4.1.4-release","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.1.4-release{257}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.1.4-release{257}.apk","properties":{}}] \ No newline at end of file