Browse Source

1.添加游戏介绍页面信息上报阿里云日志

王鹏鹏 2 years ago
parent
commit
8ba8a8f6d5

+ 21 - 0
game/src/main/java/com/yingyangfly/game/introduction/GameIntroductionActivity.kt

@@ -96,6 +96,7 @@ class GameIntroductionActivity :
         initLiveData()
         getGameDetailByCode()
         binding.tvScientificPrincipleInfo.setMovementMethod(ScrollingMovementMethod.getInstance())
+        reportLog("首次进入游戏介绍页面,gameCode: $gameCode playClass:$playClass")
     }
 
     override fun onNewIntent(intent: Intent?) {
@@ -111,6 +112,7 @@ class GameIntroductionActivity :
             mVodPlayer?.resume()
         }
         binding.btnStartGame.setBackgroundResource(R.mipmap.icon_game_continue)
+        reportLog("从游戏页面返回游戏介绍页面,gameCode: $gameCode playClass:$playClass")
     }
 
     /**
@@ -155,6 +157,7 @@ class GameIntroductionActivity :
         viewModel.getGameDetailByCode(id, playClass, fail = {
             val str = "获取游戏信息失败$it"
             str.toast()
+            reportLog(str)
         }, success = {
             if (it != null) {
                 gameBean = it
@@ -227,7 +230,9 @@ class GameIntroductionActivity :
                                     }
                                 }
                                 exitGameDialog.show(supportFragmentManager, "exitGameDialog")
+                                reportLog("进入过游戏页面点击返回按钮,gameCode: $gameCode playClass:$playClass")
                             } else {
+                                reportLog("没有进入过游戏页面,点击返回按钮,gameCode: $gameCode playClass:$playClass")
                                 finish()
                             }
                         }
@@ -255,6 +260,7 @@ class GameIntroductionActivity :
                                     .withString("gameName", gameBean!!.gameName)
                                     .withTransition(R.anim.leftin, R.anim.leftout)
                                     .navigation(mContext)
+                                reportLog("进入游戏页面,游戏名称:" + gameBean!!.gameName + "游戏code: " + gameCode + " playClass:" + playClass)
                             }
                         }
                     }
@@ -384,4 +390,19 @@ class GameIntroductionActivity :
         val cn = am.getRunningTasks(1)[0].topActivity
         return cn!!.className == activity.javaClass.name
     }
+
+    /**
+     * 阿里云日志上报
+     */
+    private fun reportLog(msg: String) {
+        runOnUiThread {
+            val log = com.aliyun.sls.android.producer.Log()
+            log.putContent(
+                "游戏介绍页面日志", msg
+            )
+            log.putContent("患者id", User.getUserId())
+            log.putContent("患者姓名", User.getName())
+            sendLog(log)
+        }
+    }
 }

+ 2 - 2
workbenches/src/main/java/com/yingyang/workbenches/freetraining/FreeTrainActivity.kt

@@ -101,7 +101,7 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
         }, success = {
             jumeGame(bean, position)
         })
-        reportLog("游戏已通关重玩,选择重玩,游戏信息: " + GsonUtil.GsonString(bean))
+        reportLog("游戏已通关重玩,选择重玩,游戏名称: " + bean.gameName + " 游戏code: " + bean.gameCode)
     }
 
     /**
@@ -115,7 +115,7 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
             .withString("videoUrl", bean.gameVideoUrl).withString("id", bean.id)
             .withString("desn", bean.desn).withTransition(R.anim.leftin, R.anim.leftout)
             .navigation(mContext)
-        reportLog("跳转游戏介绍页面,游戏信息: " + GsonUtil.GsonString(bean))
+        reportLog("跳转游戏介绍页面,游戏名称: " + bean.gameName + " ,游戏code:" + bean.gameCode)
     }
 
     @SuppressLint("ClickableViewAccessibility")