Bläddra i källkod

1.添加畅玩蓝豚页面信息上报阿里云日志

王鹏鹏 2 år sedan
förälder
incheckning
c66881361f

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

@@ -20,9 +20,11 @@ import com.yingyangfly.baselib.ext.getScaleAnimation
 import com.yingyangfly.baselib.ext.toast
 import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
 import com.yingyangfly.baselib.router.RouterUrlCommon
+import com.yingyangfly.baselib.utils.GsonUtil
 import com.yingyangfly.baselib.utils.JumpUtil
 import com.yingyangfly.baselib.utils.LiveEventBusUtil
 import com.yingyangfly.baselib.utils.RxBusCodes
+import com.yingyangfly.baselib.utils.User
 
 /**
  * 畅玩蓝豚
@@ -51,7 +53,11 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
 
     override fun initViews() {
         freeTypeList.clear()
-        freeTypeList.add(TrainTypeBean(dictLabel = "全部训练", dictValue = "", dictType = "game_type"))
+        freeTypeList.add(
+            TrainTypeBean(
+                dictLabel = "全部训练", dictValue = "", dictType = "game_type"
+            )
+        )
         binding {
             freeTrainSwipe.setEnableLoadMore(true)
             freeTrainSwipe.setEnableRefresh(true)
@@ -74,17 +80,11 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
             freeTrainListAdapter.setType(type)
             freeTrainListAdapter.onGameClickListener = { bean, position ->
                 if (TextUtils.equals("0", bean.status)) {
-                    TipsDialog.TipDialogBuilder()
-                        .title("恭喜您")
-                        .content("当前游戏已通关,是否重新开始?")
-                        .leftBtnText("取消")
-                        .rightBtnText("确定")
-                        .leftClick({
-                        }, true)
-                        .rightClick({
+                    TipsDialog.TipDialogBuilder().title("恭喜您")
+                        .content("当前游戏已通关,是否重新开始?").leftBtnText("取消")
+                        .rightBtnText("确定").leftClick({}, true).rightClick({
                             gameReplay(bean, position)
-                        }, true)
-                        .show(supportFragmentManager)
+                        }, true).show(supportFragmentManager)
                 } else {
                     jumeGame(bean, position)
                 }
@@ -101,6 +101,7 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
         }, success = {
             jumeGame(bean, position)
         })
+        reportLog("游戏已通关重玩,选择重玩,游戏信息: " + GsonUtil.GsonString(bean))
     }
 
     /**
@@ -110,20 +111,17 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
         gameId = bean.id
         gameIndex = position
         ARouter.getInstance().build(RouterUrlCommon.gameIntroduction)
-            .withString("gameCode", bean.gameCode)
-            .withString("playClass", bean.playClass)
-            .withString("videoUrl", bean.gameVideoUrl)
-            .withString("id", bean.id)
-            .withString("desn", bean.desn)
-            .withTransition(R.anim.leftin, R.anim.leftout)
+            .withString("gameCode", bean.gameCode).withString("playClass", bean.playClass)
+            .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))
     }
 
     @SuppressLint("ClickableViewAccessibility")
     override fun initListener() {
         binding {
             layoutHead.setOnTouchListener(this@FreeTrainActivity)
-
             freeTrainSwipe.setOnRefreshListener {
                 freeTrainListAdapter.showEmptyView = false
                 freeTrainListAdapter.clearData()
@@ -151,6 +149,7 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
         } else {
             getGameDetail()
         }
+        reportLog("进入畅玩蓝豚页面")
     }
 
     /**
@@ -175,7 +174,11 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
      */
     private fun getSelectByDictType() {
         freeTypeList.clear()
-        freeTypeList.add(TrainTypeBean(dictLabel = "全部训练", dictValue = "", dictType = "game_type"))
+        freeTypeList.add(
+            TrainTypeBean(
+                dictLabel = "全部训练", dictValue = "", dictType = "game_type"
+            )
+        )
         viewModel.getSelectByDictType(fail = {
             it.toast()
         }, success = {
@@ -242,12 +245,14 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
                     v.startAnimation(getScaleAnimation())
                 }
             }
+
             MotionEvent.ACTION_UP -> {
                 v.startAnimation(getEndAnimation())
                 if (v.id == R.id.layoutHead) {
                     JumpUtil.jumpActivity(RouterUrlCommon.home, mContext)
                 }
             }
+
             MotionEvent.ACTION_CANCEL -> {
                 if (v.id == R.id.layoutHead) {
                     v.startAnimation(getEndAnimation())
@@ -256,4 +261,19 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
         }
         return true
     }
+
+    /**
+     * 阿里云日志上报
+     */
+    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)
+        }
+    }
 }