package com.gh.common.util

import android.annotation.SuppressLint
import com.gh.gamecenter.common.entity.WechatConfigEntity
import com.gh.gamecenter.common.json.JsonObjectBuilder
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.retrofit.EmptyResponse
import com.gh.gamecenter.common.tracker.Tracker
import com.gh.gamecenter.common.utils.toRequestBody
import com.gh.gamecenter.entity.QuoteCountEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.lightgame.utils.Utils
import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
import org.json.JSONObject

object NewLogUtils {

    private const val KEY_EVENT = "event"
    private const val KEY_META = "meta"
    private const val KEY_ENTRANCE = "entrance"
    private const val KEY_GAME_ID = "game_id"
    private const val KEY_GAME_NAME = "game_name"
    private const val KEY_TIMESTAMP = "timestamp"
    private const val KEY_LOCATION = "location"
    private const val KEY_LAUNCH_ID = "launch_id"
    private const val KEY_SESSION_ID = "session_id"
    private const val KEY_BBS_ID = "bbs_id"
    private const val KEY_BBS_TYPE = "bbs_type"
    private const val KEY_CONTENT_TYPE = "content_type"
    private const val KEY_CONTENT_ID = "content_id"
    private const val KEY_USER_ID = "ref_user_id"

    private const val LOG_STORE_EVENT = "event"
    private const val LOG_STORE_BBS = "bbs_community"

    private fun log(jsonObject: JSONObject, logStore: String, uploadImmediately: Boolean = false) {
        Utils.log("NewLogUtils", jsonObject.toString(4))
        LoghubUtils.log(jsonObject, logStore, uploadImmediately)
    }

    fun parseAndPutMeta(): JsonObjectBuilder.() -> Unit = {
        val meta = LogUtils.getMetaObject()
        val metaKeys = meta.keys()
        while (metaKeys.hasNext()) {
            val key: String = metaKeys.next().toString()
            val value = meta.getString(key)
            key to value
        }
    }

    @SuppressLint("CheckResult")
    fun logForumContentBrowser(contentId: String, contentType: String, recommendId: String) {
        val requestMap = hashMapOf<String, Any>()
        requestMap[KEY_CONTENT_ID] = contentId
        requestMap[KEY_CONTENT_TYPE] = contentType
        if (recommendId.isNotBlank()) {
            requestMap["recommend_id"] = recommendId
        }

        RetrofitManager.getInstance()
            .api
            .postBrowses(requestMap.toRequestBody())
            .subscribeOn(Schedulers.io())
            .subscribe(EmptyResponse<ResponseBody>())
    }

    // 触发实名认证
    fun logCertificationTrigger(gameId: String, gameName: String) {
        val json = json {
            KEY_EVENT to "verification_trigger"
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    // 触发实名认证的来源 (下载触发或用户手动触发)
    fun logCertificationTriggerType(isForced: Boolean) {
        val json = json {
            KEY_EVENT to "verification_page"
            "trigger" to if (isForced) "实名认证流程" else ""
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    /**
     * 记录实名认证结果
     * @param result 0 失败, 1 成功但未成年 2 成功且成年 3 认证中
     */
    fun logCertificationResult(isForced: Boolean, result: Int) {
        val json = json {
            KEY_EVENT to "verification_finished"
            "trigger" to if (isForced) "实名认证流程" else ""
            "result" to result
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    // 实名弹窗弹出（含前往实名认证选项）
    fun logCertificationHintDialogAppearance() {
        val json = json {
            KEY_EVENT to "verification_pop_a_show"
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    // 实名弹窗（含前往实名认证选项） 选项点击
    fun logCertificationHintDialogOptionsClicked(text: String) {
        val json = json {
            KEY_EVENT to "verification_pop_a_click"
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            "button" to text
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    // 实名弹窗弹出（不含前往实名认证选项）
    fun logCertificationHintDialogTrigger(isForced: Boolean) {
        val json = json {
            KEY_EVENT to "verification_pop_b_show"
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            "trigger" to if (isForced) "实名认证流程" else ""
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    // 游戏详情点击顶部标签
    fun logGameDetailTagClick(gameId: String, gameName: String, tagId: String, tagName: String, isTop: Boolean) {
        val json = json {
            KEY_EVENT to "game_type_tag_click_jump"
            KEY_META to LogUtils.getMetaObject()
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            "type_tag_id" to tagId
            "type_tag_name" to tagName
            "is_top_type_tag" to isTop
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //发布面板
    fun logBbsPostPanelClick(entrance: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to "发布面板"
            KEY_EVENT to "view_post_panel"
            KEY_META to LogUtils.getMetaObject()
            KEY_ENTRANCE to entrance
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //发布面板关闭按钮
    fun logBbsPostPanelCloseClick() {
        val json = json {
            KEY_LOCATION to "发布面板"
            KEY_EVENT to "click_close"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入发帖子页
    fun logArticleEditEnter(entrance: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to "发布帖子页"
            KEY_EVENT to "view_post_article"
            KEY_META to LogUtils.getMetaObject()
            KEY_ENTRANCE to entrance
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击帖子编辑页取消/发布按钮
    fun logArticleEditClick(
        event: String,
        bbsId: String,
        bbsType: String,
        activityTag: String,
        isOriginal: Boolean,
        quote: QuoteCountEntity
    ) {
        val json = json {
            KEY_LOCATION to "发布帖子页"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            "activity_tag" to activityTag
            "posts_is_original" to isOriginal
            "edit_text_num" to quote.textCount
            "edit_img_num" to quote.imageCount
            "edit_video_ref_num" to quote.videoCount
            "edit_answer_ref_num" to quote.answerCount
            "edit_content_ref_num" to quote.articleCount
            "edit_game_ref_num" to quote.gameCount
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击帖子草稿箱图标
    fun logArticleDraftClick() {
        val json = json {
            KEY_LOCATION to "发布帖子页"
            KEY_EVENT to "click_article_draft"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入发问题页
    fun logQuestionEditEnter(entrance: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to "发提问页"
            KEY_EVENT to "view_post_question"
            KEY_META to LogUtils.getMetaObject()
            KEY_ENTRANCE to entrance
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击问题编辑页取消/发布按钮
    fun logQuestionEditClick(
        event: String,
        bbsId: String,
        bbsType: String,
        activityTag: String,
        quote: QuoteCountEntity
    ) {
        val json = json {
            KEY_LOCATION to "发提问页"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            "activity_tag" to activityTag
            "edit_text_num" to quote.textCount
            "edit_img_num" to quote.imageCount
            "edit_video_ref_num" to quote.videoCount
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击问题草稿箱图标
    fun logQuestionDraftClick() {
        val json = json {
            KEY_LOCATION to "发提问页"
            KEY_EVENT to "click_question_draft"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入发视频帖页
    fun logPublishVideoEnter(entrance: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to "发视频帖页"
            KEY_EVENT to "view_post_video"
            KEY_META to LogUtils.getMetaObject()
            KEY_ENTRANCE to entrance
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击视频发布页取消/发布按钮
    fun logPublishVideoClick(
        event: String,
        bbsId: String,
        bbsType: String,
        activityTag: String,
        textCount: Int,
        originalType: String
    ) {
        val json = json {
            KEY_LOCATION to "发视频帖页"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            "activity_tag" to activityTag
            "edit_text_num" to textCount
            "original_type" to originalType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击视频草稿箱图标
    fun logVideoDraftClick() {
        val json = json {
            KEY_LOCATION to "发视频帖页"
            KEY_EVENT to "click_video_draft"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入帖子详情页/点击更多按钮
    fun logArticleDetailClick(event: String) {
        val json = json {
            KEY_LOCATION to "帖子详情页"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击头像/昵称/关注
    fun logArticleDetailClick(event: String, userId: String, contentType: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to "帖子详情页"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_USER_ID to userId
            KEY_CONTENT_TYPE to contentType
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //滑动帖子/问题详情页
    fun logSlideArticleOrQuestionDetail(location: String, event: String, slideToBottom: Boolean) {
        val json = json {
            KEY_LOCATION to location
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            "slide_to_bottom" to slideToBottom
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击帖子详情页论坛
    fun logArticleOrQuestionDetailForumClick(location: String, event: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to location
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入视频详情页/点击更多按钮/点击详情tab/点击评论tab/下拉箭头/上拉箭头
    fun logVideoDetailClick(event: String) {
        val json = json {
            KEY_LOCATION to "视频帖详情页"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击视频详情头像/昵称/关注/赞同/收藏/分享/推荐视频
    fun logVideoDetailClick(
        event: String,
        userId: String,
        contentType: String,
        bbsId: String,
        bbsType: String,
        contentId: String = "",
        videoId: String = "",
        sequence: Int = -1
    ) {
        val json = json {
            KEY_LOCATION to "视频帖详情页"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_USER_ID to userId
            KEY_CONTENT_TYPE to contentType
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            if (contentId.isNotEmpty()) {
                KEY_CONTENT_ID to contentId
            }
            if (videoId.isNotEmpty()) {
                "video_id" to videoId
            }
            if (sequence >= 0) {
                "sequence" to sequence
            }
        }
        log(json, LOG_STORE_BBS)
    }

    //点击游戏
    fun logVideoDetailGameClick(
        event: String,
        gameId: String,
        gameCategory: String,
        bbsId: String,
        contentId: String,
        downloadState: String
    ) {
        val json = json {
            KEY_LOCATION to "视频帖详情页"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_GAME_ID to gameId
            KEY_BBS_ID to bbsId
            KEY_CONTENT_ID to contentId
            "game_category" to gameCategory
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            if (downloadState.isNotEmpty()) {
                "download_state" to downloadState
            }
        }
        log(json, LOG_STORE_BBS)
    }

    //视频详情滑动详情tab
    fun logSlideVideoDetail(slideVideoNum: Int) {
        val json = json {
            KEY_LOCATION to "视频帖详情页"
            KEY_EVENT to "slide_detail_tab_page"
            KEY_META to LogUtils.getMetaObject()
            "slide_video_num" to slideVideoNum
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入提问详情页/点击更多
    fun logQuestionDetailClick(event: String) {
        val json = json {
            KEY_LOCATION to "提问帖详情"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //提问详情页点击头像/昵称/关注
    fun logQuestionDetailClick(event: String, userId: String, contentType: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to "提问帖详情"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_USER_ID to userId
            KEY_CONTENT_TYPE to contentType
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入评论区
    fun logCommentAreaEnter(contentType: String) {
        val json = json {
            KEY_LOCATION to "评论区"
            KEY_EVENT to "view_comment_area"
            KEY_META to LogUtils.getMetaObject()
            KEY_CONTENT_TYPE to contentType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击头像/昵称/评论/回复按钮/赞同按钮
    fun logCommentClick(
        event: String,
        userId: String,
        contentType: String,
        contentId: String,
        bbsId: String,
        bbsType: String
    ) {
        val json = json {
            KEY_LOCATION to "评论区"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_USER_ID to userId
            KEY_CONTENT_TYPE to contentType
            KEY_CONTENT_ID to contentId
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击更多/正序/倒序
    fun logCommentClick(event: String) {
        val json = json {
            KEY_LOCATION to "评论区"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入详情页分享面板
    fun logShareEnter(entrance: String) {
        val json = json {
            KEY_LOCATION to "分享面板"
            KEY_EVENT to "view_detail_share_panel"
            KEY_META to LogUtils.getMetaObject()
            KEY_ENTRANCE to entrance
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击分享方式
    fun logShareTypeClick(shareType: String) {
        val json = json {
            KEY_LOCATION to "分享面板"
            KEY_EVENT to "share_type"
            KEY_META to LogUtils.getMetaObject()
            "share_type" to shareType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }


    //分享面板点击
    fun logSharePanelClick(
        event: String,
        userId: String,
        contentType: String,
        contentId: String,
        bbsId: String,
        bbsType: String
    ) {
        val json = json {
            KEY_LOCATION to "分享面板"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_USER_ID to userId
            KEY_CONTENT_TYPE to contentType
            KEY_CONTENT_ID to contentId
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击分享面板取消按钮
    fun logSharePanelCancelClick() {
        val json = json {
            KEY_LOCATION to "分享面板"
            KEY_EVENT to "click_detail_share_panel_cancel"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入选择论坛面板
    fun logChooseForumPanelEnter(publishContentType: String) {
        val json = json {
            KEY_LOCATION to "选择论坛面板"
            KEY_EVENT to "view_select_forum_panel"
            KEY_META to LogUtils.getMetaObject()
            "publish_content_type" to publishContentType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击搜索框/我的关注tab/热门论坛tab/论坛/关闭按钮
    fun logChooseForumPanelClick(event: String, entrance: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to "选择论坛面板"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            if (entrance.isNotEmpty()) {
                KEY_ENTRANCE to entrance
            }
            if (bbsId.isNotEmpty()) {
                KEY_BBS_ID to bbsId
            }
            if (bbsType.isNotEmpty()) {
                KEY_BBS_TYPE to bbsType
            }
        }
        log(json, LOG_STORE_BBS)
    }

    //选择多媒体页
    fun logChooseMedia(event: String, publishContentType: String, publishMediaType: String) {
        val json = json {
            KEY_LOCATION to "多媒体页"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            "publish_content_type" to publishContentType
            "publish_media_type" to publishMediaType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //记录跳出事件
    fun logActivityPause(
        location: String,
        event: String,
        stayTime: Long,
        bbsId: String,
        bbsType: String,
        contentType: String,
        contentId: String
    ) {
        val json = json {
            KEY_LOCATION to location
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            "stay_time" to stayTime
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            if (contentType.isNotEmpty()) {
                KEY_CONTENT_TYPE to contentType
            }
            if (contentId.isNotEmpty()) {
                KEY_CONTENT_ID to contentId
            }
        }
        log(json, LOG_STORE_BBS)
    }

    //进入置顶内容页
    fun logForumLinkTopClick(bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to "置顶内容页"
            KEY_EVENT to "view_top_content"
            KEY_META to LogUtils.getMetaObject()
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入社区页/点击推荐导航/点击论坛导航/点击活动导航
    fun logCommunityHomeEvent(event: String) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to "社区"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击搜索框
    fun logCommunitySearchClick() {
        val json = json {
            KEY_EVENT to "click_community_search_box"
            KEY_LOCATION to "社区"
            KEY_ENTRANCE to "社区搜索栏"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入推荐信息流/点击最近浏览更多按钮
    fun logRecommendFeedEvent(event: String) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to "推荐信息流"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击推荐页最近浏览论坛、点击论坛页关注的论坛/热门的论坛/综合的论坛
    fun logForumClick(event: String, location: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to location
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //推荐信息流点击头像/昵称/关注
    fun logRecommendFeedUserClick(event: String, userId: String, contentType: String) {
        val json = json {
            KEY_LOCATION to "推荐信息流"
            KEY_EVENT to event
            KEY_META to LogUtils.getMetaObject()
            KEY_USER_ID to userId
            KEY_CONTENT_TYPE to contentType
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //推荐信息流点击徽章
    fun logRecommendFeedBadgeClick(badgeId: String) {
        val json = json {
            KEY_LOCATION to "推荐信息流"
            KEY_EVENT to "click_for_you_badge"
            "badge_id" to badgeId
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //推荐信息流点击内容/评论/赞同
    fun logRecommendFeedContentClick(
        event: String,
        contentType: String,
        contentId: String,
        sequence: Int,
        bbsId: String,
        bbsType: String,
        userId: String,
        commentType: String = ""
    ) {
        val json = json {
            KEY_LOCATION to "推荐信息流"
            KEY_EVENT to event
            KEY_CONTENT_TYPE to contentType
            KEY_CONTENT_ID to contentId
            "sequence" to sequence
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_USER_ID to userId
            if (commentType.isNotEmpty()) {
                "comment_type" to commentType
            }
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //推荐信息流点击论坛
    fun logRecommendFeedForumClick(contentType: String, contentId: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_LOCATION to "推荐信息流"
            KEY_EVENT to "click_for_you_forum"
            KEY_CONTENT_TYPE to contentType
            KEY_CONTENT_ID to contentId
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //滑动信息流内容
    fun logRecommendFeedSlide(slideContentNum: Int) {
        val json = json {
            KEY_LOCATION to "推荐信息流"
            KEY_EVENT to "slide_for_you_feed_content"
            "slide_content_num" to slideContentNum
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击发布按钮
    fun logRecommendFeedPublishClick() {
        val json = json {
            KEY_EVENT to "click_for_you_post"
            KEY_LOCATION to "推荐信息流"
            KEY_ENTRANCE to "推荐页信息流"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入论坛页、点击关注论坛/热门论坛/综合论坛更多按钮、点击工具箱/礼包中心/游戏动态/资讯中心
    fun logForumPageEvent(event: String) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to "论坛页"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入活动页
    fun logForumActivityEnter() {
        val json = json {
            KEY_EVENT to "view_community_activity"
            KEY_LOCATION to "活动页"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击活动分类按钮
    fun logForumActivityCategoryClick(categoryId: String) {
        val json = json {
            KEY_EVENT to "click_community_activity_sort"
            KEY_LOCATION to "活动页"
            "activity_category_id" to categoryId
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击活动
    fun logForumActivityClick(
        categoryId: String,
        activityId: String,
        sequence: Int,
        contentType: String,
        contentId: String
    ) {
        val json = json {
            KEY_EVENT to "click_community_activity"
            KEY_LOCATION to "活动页"
            "activity_category_id" to categoryId
            "activity_id" to activityId
            "sequence" to sequence
            KEY_CONTENT_TYPE to contentType
            KEY_CONTENT_ID to contentId
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入搜索页
    fun logForumSearchEnter(entrance: String) {
        val json = json {
            KEY_EVENT to "view_search"
            KEY_LOCATION to "搜索页"
            KEY_ENTRANCE to entrance
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击搜索按钮
    fun logForumSearchClick(key: String, entrance: String) {
        val json = json {
            KEY_EVENT to "click_search"
            KEY_LOCATION to "搜索页"
            "search_key" to key
            KEY_ENTRANCE to entrance
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击搜索结果
    fun logForumSearchResultClick(
        tabType: String,
        bbsId: String,
        bbsType: String,
        contentId: String,
        contentType: String,
        userId: String,
        searchKey: String,
        sequence: Int
    ) {
        val json = json {
            KEY_EVENT to "click_search_list"
            KEY_LOCATION to "搜索页"
            "tab_type" to tabType
            KEY_CONTENT_TYPE to contentType
            KEY_CONTENT_ID to contentId
            "sequence" to sequence
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_USER_ID to userId
            "search_key" to searchKey
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //搜索页点击关注按钮
    fun logForumSearchFollowClick(followType: String, bbsId: String, bbsType: String, userId: String) {
        val json = json {
            KEY_EVENT to "click_follow"
            KEY_LOCATION to "搜索页"
            "follow_type" to followType
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_USER_ID to userId
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入关注/热门/综合论坛页、点击返回按钮
    fun logForumPageEnterOrReturnClick(event: String, location: String) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to location
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击论坛
    fun logForumListClick(event: String, location: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to location
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入论坛详情页、点击搜索按钮/论坛图标/关注按钮/版规说明/版主成员/攻略专区/置顶内容/全部tab/精华tab/问答tab/视频tab/返回按钮
    fun logForumDetailEnterOrClick(
        event: String,
        bbsId: String = "",
        bbsType: String = "",
        userId: String = "",
        filterTag: String = "",
        entrance: String = ""
    ) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to "论坛详情页"
            if (bbsId.isNotEmpty()) {
                KEY_BBS_ID to bbsId
            }
            if (bbsType.isNotEmpty()) {
                KEY_BBS_TYPE to bbsType
            }
            if (userId.isNotEmpty()) {
                KEY_USER_ID to userId
            }
            if (filterTag.isNotEmpty()) {
                "filter_tag" to filterTag
            }
            if (entrance.isNotEmpty()) {
                KEY_ENTRANCE to entrance
            }
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //论坛详情信息流点击头像/昵称/关注按钮
    fun logForumDetailFeedUserClick(
        event: String,
        userId: String,
        contentType: String,
        tabInfo: String,
        bbsId: String,
        bbsType: String
    ) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to "论坛详情页"
            KEY_USER_ID to userId
            KEY_CONTENT_TYPE to contentType
            "tab_info" to tabInfo
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //论坛详情信息流点击徽章
    fun logForumDetailFeedBadgeClick(badgeId: String, bbsId: String, bbsType: String) {
        val json = json {
            KEY_EVENT to "click_forum_detail_badge"
            KEY_LOCATION to "论坛详情页"
            "badge_id" to badgeId
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //论坛详情信息流点击内容/评论/赞同
    fun logForumDetailFeedContentClick(
        event: String,
        userId: String,
        contentId: String,
        contentType: String,
        sequence: Int,
        bbsId: String,
        bbsType: String,
        tabInfo: String,
        commentType: String = ""
    ) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to "论坛详情页"
            KEY_USER_ID to userId
            KEY_CONTENT_ID to contentId
            KEY_CONTENT_TYPE to contentType
            "sequence" to sequence
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            "tab_info" to tabInfo
            if (commentType.isNotEmpty()) {
                "comment_type" to commentType
            }
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //论坛详情点击发布按钮
    fun logForumDetailPublishClick(entrance: String) {
        val json = json {
            KEY_EVENT to "click_forum_detail_post"
            KEY_LOCATION to "论坛详情页"
            KEY_ENTRANCE to entrance
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //论坛详情滑动信息流内容
    fun logForumDetailFeedSlide(slideContentNum: Int) {
        val json = json {
            KEY_EVENT to "slide_forum_detail_feed_content"
            KEY_LOCATION to "论坛详情页"
            "slide_content_num" to slideContentNum
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入版规说明页
    fun logForumRuleEnter(bbsId: String, bbsType: String) {
        val json = json {
            KEY_EVENT to "view_layout_description"
            KEY_LOCATION to "版规说明"
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入版主成员页
    fun logForumModeratorEnter(bbsId: String, bbsType: String) {
        val json = json {
            KEY_EVENT to "view_forum_member"
            KEY_LOCATION to "版主成员"
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击申请版主按钮/您已是版主按钮/头像/昵称/关注按钮/已关注按钮
    fun logForumModeratorClick(event: String, userId: String = "") {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to "版主成员"
            if (userId.isNotEmpty()) {
                KEY_USER_ID to userId
            }
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //进入申请基本条件页
    fun logApplyModeratorEnter(bbsId: String, bbsType: String) {
        val json = json {
            KEY_EVENT to "view_apply_member"
            KEY_LOCATION to "申请基本条件页"
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to bbsType
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //申请基本条件页点击去完成按钮
    fun logApplyModeratorFinishClick(taskId: String, taskState: String) {
        val json = json {
            KEY_EVENT to "click_finish"
            KEY_LOCATION to "申请基本条件页"
            "task_id" to taskId
            "task_state" to taskState
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //申请基本条件页点击申请版主按钮/QQ群号码
    fun logApplyModeratorFApplyOrQQClick(event: String, userId: String) {
        val json = json {
            KEY_EVENT to event
            KEY_LOCATION to "申请基本条件页"
            KEY_USER_ID to userId
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //出现引导浮窗
    fun logGuidePopShow(guideId: String) {
        val json = json {
            KEY_EVENT to "guide_pop_show"
            "payload" to json {
                "guide_pop_id" to guideId
            }
            KEY_META to LogUtils.getMetaObject()
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //关闭引导浮窗
    fun logGuidePopClose(guideId: String) {
        val json = json {
            KEY_EVENT to "guide_pop_close"
            "payload" to json {
                "guide_pop_id" to guideId
            }
            KEY_META to LogUtils.getMetaObject()
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击引导浮窗链接
    fun logGuidePopLinkClick(guideId: String, linkType: String? = "", linkTitle: String? = "") {
        val json = json {
            KEY_EVENT to "guide_pop_link_click"
            "payload" to json {
                "guide_pop_id" to guideId
                "link_type" to linkType
                "link_title" to linkTitle
            }
            KEY_META to LogUtils.getMetaObject()
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //在搜索结果列表点击游戏内容标签
    fun logSearchTagClick(
        searchType: String,
        key: String,
        gameId: String,
        gameName: String,
        tagId: String,
        tagName: String,
        linkId: String = "",
        linkType: String = "",
        linkTitle: String = ""
    ) {
        val json = json {
            KEY_EVENT to "search_click_tag"
            "search_type" to searchType
            "key" to key
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            "tag_id" to tagId
            "tag" to tagName
            "link_id" to linkId
            "link_type" to linkType
            "link_title" to linkTitle
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //搜索结果为空事件
    fun logSearchEmpty(searchType: String, key: String) {
        val json = json {
            KEY_EVENT to "search_return_empty"
            "search_type" to searchType
            "key" to key
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //进入游戏详情-专区tab页/评论tab页/游戏评论页
    fun logGameDetailTabClick(
        event: String,
        entrance: String,
        gameId: String,
        gameType: String,
        bbsId: String
    ) {
        val json = json {
            KEY_EVENT to event
            KEY_ENTRANCE to entrance
            KEY_GAME_ID to gameId
            "game_type" to gameType
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to "游戏论坛"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //跳出游戏详情-专区tab页/跳出游戏详情-评论tab页/跳出游戏评论详情页
    fun logGameDetailTabOrCommentDetailPause(event: String, stayTime: Long, gameId: String, gameType: String) {
        val json = json {
            KEY_EVENT to event
            "stay_time" to stayTime
            KEY_GAME_ID to gameId
            "game_type" to gameType
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情-评论tab内的点击事件/游戏评论详情页内的点击事件/点击游戏评论编辑页的礼仪测试
    fun logCommentTabOrCommentDetailClick(event: String, gameId: String, gameType: String, userId: String = "") {
        val json = json {
            KEY_EVENT to event
            KEY_GAME_ID to gameId
            "game_type" to gameType
            if (userId.isNotEmpty()) {
                KEY_USER_ID to userId
            }
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //滑动信息流评论
    fun logCommentFeedSlide(slideContentNum: Int) {
        val json = json {
            KEY_EVENT to "slide_game_detail_feed_comment"
            "slide_content_num" to slideContentNum
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    // 论坛页点击轮播图
    @JvmStatic
    fun logClickBBSCarousel(contentType: String, contentId: String, sequence: Int, userId: String) {
        val json = json {
            KEY_EVENT to "click_bbs_carousel"
            KEY_CONTENT_TYPE to contentType
            KEY_CONTENT_ID to contentId
            "sequence" to sequence
            KEY_USER_ID to userId
            KEY_LOCATION to "论坛页"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_BBS)
    }

    //点击提交按钮
    fun logRatingEditClick(
        event: String,
        gameId: String,
        gameType: String,
        isDisplayPhone: Boolean,
        score: Float,
        commentTag: String,
        textNum: Int
    ) {
        val json = json {
            KEY_EVENT to event
            KEY_GAME_ID to gameId
            "game_type" to gameType
            "is_display_phone_model" to isDisplayPhone
            "game_score" to score
            "game_comment_tag" to commentTag
            "game_comment_edit_text_num" to textNum
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //进入游戏评论详情页
    fun logViewGameCommentDetail(gameId: String, gameType: String, bbsId: String) {
        val json = json {
            KEY_EVENT to "view_game_comment_detail"
            KEY_GAME_ID to gameId
            "game_type" to gameType
            KEY_BBS_ID to bbsId
            KEY_BBS_TYPE to "游戏论坛"
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击游戏下载状态按钮
    fun logDownloadBtnClick(gameId: String, gameType: String, downloadStatus: String) {
        val json = json {
            KEY_EVENT to "click_game_comment_detail_game_status"
            KEY_GAME_ID to gameId
            "game_type" to gameType
            "download_state" to downloadStatus
            KEY_META to LogUtils.getMetaObject()
            KEY_LAUNCH_ID to Tracker.launchId
            KEY_SESSION_ID to Tracker.sessionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
        }
        log(json, LOG_STORE_EVENT)
    }

    //进入通用链接合集详情
    fun logAccessToCommonCollectionDetail(
        collectionId: String,
        collectionName: String,
        entrance: String,
        blockId: String = "",
        blockName: String = ""
    ) {
        val json = json {
            KEY_EVENT to "access_to_content_collection"
            "content_collection_id" to collectionId
            "content_collection_name" to collectionName
            KEY_ENTRANCE to entrance
            if (blockId.isNotEmpty()) {
                "block_id" to blockId
            }
            if (blockName.isNotEmpty()) {
                "block_name" to blockName
            }
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //通用链接合集内容点击跳转
    fun logCommonCollectionClick(
        collectionId: String,
        collectionName: String,
        blockId: String = "",
        blockName: String = "",
        entrance: String,
        location: String,
        titleText: String,
        firstLineText: String,
        secondLineText: String,
        linkType: String,
        linkTitle: String,
        sequence: Int,
    ) {
        val json = json {
            KEY_EVENT to "content_collection_click_jump"
            "content_collection_id" to collectionId
            "content_collection_name" to collectionName
            KEY_ENTRANCE to entrance
            KEY_LOCATION to location
            if (blockId.isNotEmpty()) {
                "block_id" to blockId
            }
            if (blockName.isNotEmpty()) {
                "block_name" to blockName
            }
            if (titleText.isNotEmpty()) {
                "title_text" to titleText
            }
            if (firstLineText.isNotEmpty()) {
                "first_line_text" to firstLineText
            }
            if (secondLineText.isNotEmpty()) {
                "second_line_text" to secondLineText
            }
            "link_type" to linkType
            "link_title" to linkTitle
            "sequence" to sequence
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //滑动合集内容，停止滑动时触发上报
    fun logSlideCommonCollection(
        collectionId: String,
        collectionName: String,
        blockId: String = "",
        blockName: String = "",
        entrance: String,
        location: String,
        titleText: String,
        firstLineText: String,
        secondLineText: String,
        slideNum: Int
    ) {
        val json = json {
            KEY_EVENT to "slide_content_collection"
            "content_collection_id" to collectionId
            "content_collection_name" to collectionName
            KEY_ENTRANCE to entrance
            KEY_LOCATION to location
            if (blockId.isNotEmpty()) {
                "block_id" to blockId
            }
            if (blockName.isNotEmpty()) {
                "block_name" to blockName
            }
            if (titleText.isNotEmpty()) {
                "title_text" to titleText
            }
            if (firstLineText.isNotEmpty()) {
                "first_line_text" to firstLineText
            }
            if (secondLineText.isNotEmpty()) {
                "second_line_text" to secondLineText
            }
            "slide_num" to slideNum
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //进入我的游戏单
    fun logEnterMyGameCollection() {
        val json = json {
            KEY_EVENT to "enter_game_collect_self_location"
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //进入创建游戏单
    fun logEnterGameCollectionCreate(entrance: String) {
        val json = json {
            KEY_EVENT to "enter_game_collect_create_location"
            KEY_ENTRANCE to entrance
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //进入游戏单广场
    fun logEnterGameCollectionSquare(
        entrance: String,
        forumName: String = "",
        gameCollectionTitle: String = "",
        gameCollectionId: String = "",
        collectionName: String = "",
        collectionId: String = ""
    ) {
        val json = json {
            KEY_EVENT to "enter_game_collect_square"
            KEY_ENTRANCE to entrance
            "forum_name" to forumName
            "game_collect_title" to gameCollectionTitle
            "game_collect_id" to gameCollectionId
            "game_list_collection_name" to collectionName
            "game_list_collection_id" to collectionId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //进入选择标签
    fun logEnterGameCollectionTag(source: String) {
        val json = json {
            KEY_EVENT to "enter_game_collect_tag_location"
            "source" to source
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //筛选游戏单标签
    fun logFilterGameCollectionTag(tagCategory: String, tagName: String, source: String) {
        val json = json {
            KEY_EVENT to "filter_game_collect_tag"
            "filter_tag_category" to tagCategory
            "filter_tag_name" to tagName
            "source" to source
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击安利墙卡片
    fun logClickGameCollectionAmway(tabName: String) {
        val json = json {
            KEY_EVENT to "click_game_collect_recommend_card"
            "tab_name" to tabName
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //进入安利墙
    fun logEnterGameCollectionAmway() {
        val json = json {
            KEY_EVENT to "enter_game_collect_recommend_card"
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击卡片的游戏icon
    fun logClickGameCollectionGameIcon(title: String, id: String, gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "click_game_collect_recommend_card_icon"
            "game_collect_title" to title
            "game_collect_id" to id
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击卡片的作者信息
    fun logClickGameCollectionAuthor(title: String, id: String) {
        val json = json {
            KEY_EVENT to "click_game_collect_recommend_card_author"
            "game_collect_title" to title
            "game_collect_id" to id
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击进入游戏单
    fun logEnterGameCollectionDetail(title: String, id: String) {
        val json = json {
            KEY_EVENT to "enter_game_collect_detail"
            "game_collect_title" to title
            "game_collect_id" to id
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }


    //游戏单视频相关
    @JvmStatic
    fun logGameCollectionVideoEvent(
        event: String,
        title: String,
        id: String,
        progress: Double,
        playTime: Int,
        playAction: String = "",
        stopAction: String = "",
    ) {
        val json = json {
            KEY_EVENT to event
            "game_collect_title" to title
            "game_collect_id" to id
            "progress" to progress
            "play_time" to playTime
            if (playAction.isNotEmpty()) {
                "play_action" to playAction
            }
            if (stopAction.isNotEmpty()) {
                "stop_action" to stopAction
            }
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    // 自定义栏目点击跳转
    fun logCustomColumnClicked(
        gameId: String?,
        gameName: String?,
        title: String?,
        entrance: String?,
        linkType: String?,
        linkTitle: String?
    ) {
        val json = json {
            KEY_EVENT to "custom_column_jump"
            "title" to title
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            "link_type" to linkType
            "link_title" to linkTitle
            KEY_ENTRANCE to entrance
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //选择图片上传方式
    @JvmStatic
    fun logShowGameCollectionCoverTypeDialog() {
        val json = json {
            KEY_EVENT to "dialog_game_collect_chose_picture"
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //选择图片上传方式点击
    @JvmStatic
    fun logClickGameCollectionChooseCoverDialog(action: String) {
        val json = json {
            KEY_EVENT to "click_dialog_game_collect_chose_picture"
            "action" to action
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //默认封面点击事件
    @JvmStatic
    fun logClickGameCollectionDefaultCoverDialog(action: String) {
        val json = json {
            KEY_EVENT to "click_dialog_game_collect_chose_default_picture"
            "action" to action
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击专题列表右上角按钮
    @JvmStatic
    fun logColumnListClickButton(
        buttonType: String,
        columnName: String,
        columnId: String,
        linkType: String,
        linkTitle: String,
        location: String,
        blockName: String
    ) {
        val json = json {
            KEY_EVENT to "column_list_click_button"
            "button_type" to buttonType
            "column_name" to columnName
            "column_id" to columnId
            if (linkType.isNotEmpty()) {
                "link_type" to linkType
            }
            if (linkTitle.isNotEmpty()) {
                "link_title" to linkTitle
            }
            KEY_LOCATION to location
            if (blockName.isNotEmpty()) {
                "block_name" to blockName
            }
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击游戏专题图片
    @JvmStatic
    fun logColumnPictureClick(
        displayType: String,
        columnName: String,
        columnId: String,
        linkId: String,
        linkType: String,
        linkText: String,
        location: String,
        blockName: String
    ) {
        val json = json {
            KEY_EVENT to "column_picture_click"
            "display_type" to displayType
            "column_name" to columnName
            "column_id" to columnId
            "link_id" to linkId
            if (linkType.isNotEmpty()) {
                "link_type" to linkType
            }
            if (linkText.isNotEmpty()) {
                "link_text" to linkText
            }
            KEY_LOCATION to location
            if (blockName.isNotEmpty()) {
                "block_name" to blockName
            }
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击专题合集右上角
    @JvmStatic
    fun logColumnCategoryHomeButtonClick(
        buttonType: String,
        categoryName: String,
        categoryId: String,
        location: String,
        blockName: String
    ) {
        val json = json {
            KEY_EVENT to "column_category_home_button_click"
            "button_type" to buttonType
            "category_name" to categoryName
            "category_id" to categoryId
            KEY_LOCATION to location
            if (blockName.isNotEmpty()) {
                "block_name" to blockName
            }
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击专题合集首页内容
    fun logColumnCategoryHomeContentClick(
        columnName: String,
        columnId: String,
        categoryName: String,
        categoryId: String,
        location: String,
        blockName: String = ""
    ) {
        val json = json {
            KEY_EVENT to "column_category_home_content_click"
            "column_name" to columnName
            "column_id" to columnId
            "category_name" to categoryName
            "category_id" to categoryId
            KEY_LOCATION to location
            if (blockName.isNotEmpty()) {
                "block_name" to blockName
            }
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击专题合集详情内容
    fun logColumnCategoryDetailContentClick(
        columnName: String,
        columnId: String,
        categoryName: String,
        categoryId: String,
    ) {
        val json = json {
            KEY_EVENT to "column_category_detail_content_click"
            "column_name" to columnName
            "column_id" to columnId
            "category_name" to categoryName
            "category_id" to categoryId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击通用内容合集右上角
    @JvmStatic
    fun logCommonCategoryHomeButtonClick(
        buttonType: String,
        categoryName: String,
        categoryId: String,
        location: String,
        blockName: String = ""
    ) {
        val json = json {
            KEY_EVENT to "common_category_home_button_click"
            "button_type" to buttonType
            "category_name" to categoryName
            "category_id" to categoryId
            KEY_LOCATION to location
            if (blockName.isNotEmpty()) {
                "block_name" to blockName
            }
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击通用内容合集首页内容
    @JvmStatic
    fun logCommonCategoryHomeContentClick(
        title: String,
        linkType: String,
        linkId: String,
        linkText: String,
        categoryName: String,
        categoryId: String,
        location: String,
        blockName: String = ""
    ) {
        val json = json {
            KEY_EVENT to "common_category_home_content_click"
            "title" to title
            "link_type" to linkType
            "link_text" to linkText
            "link_id" to linkId
            "category_name" to categoryName
            "category_id" to categoryId
            KEY_LOCATION to location
            if (blockName.isNotEmpty()) {
                "block_name" to blockName
            }
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击通用内容合集详情内容
    @JvmStatic
    fun logCommonCategoryDetailContentClick(
        title: String,
        linkType: String,
        linkId: String,
        linkText: String,
        categoryName: String,
        categoryId: String,
    ) {
        val json = json {
            KEY_EVENT to "common_category_detail_content_click"
            "title" to title
            "link_type" to linkType
            "link_text" to linkText
            "link_id" to linkId
            "category_name" to categoryName
            "category_id" to categoryId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击首页安利墙的全部
    @JvmStatic
    fun logHomeShareWallButtonClick(entrance: String) {
        val json = json {
            KEY_EVENT to "home_share_wall_button_click"
            KEY_ENTRANCE to entrance
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击首页安利墙的卡片
    @JvmStatic
    fun logHomeShareWallCardClick(gameName: String, gameId: String, entrance: String) {
        val json = json {
            KEY_EVENT to "home_share_wall_card_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_ENTRANCE to entrance
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击安利墙广场的卡片
    @JvmStatic
    fun logShareWallSquareCardClick(gameName: String, gameId: String, entrance: String) {
        val json = json {
            KEY_EVENT to "share_wall_square_card_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_ENTRANCE to entrance
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击底部导航栏
    @JvmStatic
    fun logBottomNavigationClick(navigationName: String, linkType: String, linkText: String, linkId: String = "", sequence: Int) {
        val json = json {
            KEY_EVENT to "bottom_navigation_click"
            "navigation_name" to navigationName
            if (linkType.isNotEmpty()) {
                "link_type" to linkType
            }
            if (linkText.isNotEmpty()) {
                "link_text" to linkText
            }
            "link_id" to linkId
            "sequence" to sequence
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情点击tab
    @JvmStatic
    fun logGameDetailTabClick(gameName: String, gameId: String, tabName: String) {
        val json = json {
            KEY_EVENT to "game_detail_tab_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            "tab_name" to tabName
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情点击大事件
    @JvmStatic
    fun logGameDetailMajorEventClick(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_major_event_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情浏览大事件
    @JvmStatic
    fun logGameDetailMajorEventView(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_major_event_view"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情浏览更新内容
    @JvmStatic
    fun logGameDetailUpdatedView(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_updated_view"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情浏览历史版本
    @JvmStatic
    fun logGameDetailHistoryVersionView(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_history_version_view"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情点击更新内容
    @JvmStatic
    fun logGameDetailUpdatedClick(gameName: String, gameId: String, entrance: String) {
        val json = json {
            KEY_EVENT to "game_detail_updated_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_ENTRANCE to entrance
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情浏览开服表
    @JvmStatic
    fun logGameDetailOpenListView(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_open_list_view"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情点击开服表
    @JvmStatic
    fun logGameDetailOpenListClick(gameName: String, gameId: String, entrance: String) {
        val json = json {
            KEY_EVENT to "game_detail_open_list_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_ENTRANCE to entrance
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情浏览开服日历
    @JvmStatic
    fun logGameDetailOpenCalendarView(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_open_calendar_view"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情点击开服日历
    @JvmStatic
    fun logGameDetailOpenCalendarClick(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_open_calendar_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情浏览游戏礼包
    @JvmStatic
    fun logGameDetailGiftView(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_gift_view"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情点击游戏礼包
    @JvmStatic
    fun logGameDetailGiftClick(gameName: String, gameId: String, entrance: String) {
        val json = json {
            KEY_EVENT to "game_detail_gift_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_ENTRANCE to entrance
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情浏览玩家评论
    @JvmStatic
    fun logGameDetailCommentView(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_comment_view"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情点击玩家评论
    @JvmStatic
    fun logGameDetailCommentClick(gameName: String, gameId: String, entrance: String) {
        val json = json {
            KEY_EVENT to "game_detail_comment_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_ENTRANCE to entrance
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情浏览大家都在玩
    @JvmStatic
    fun logGameDetailPopularView(gameName: String, gameId: String) {
        val json = json {
            KEY_EVENT to "game_detail_popular_view"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //游戏详情点击大家都在玩
    @JvmStatic
    fun logGameDetailPopularClick(gameName: String, gameId: String, linkType: String, linkText: String) {
        val json = json {
            KEY_EVENT to "game_detail_popular_click"
            KEY_GAME_NAME to gameName
            KEY_GAME_ID to gameId
            "link_id" to gameId
            "link_type" to linkType
            "link_text" to linkText
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //我的光环点击事件
    @JvmStatic
    fun logHaloSelfClick(profile: String, entrance: String, linkType: String, linkId: String, linkText: String) {
        val json = json {
            KEY_EVENT to "halo_self_click"
            "profile" to profile
            KEY_ENTRANCE to entrance
            "link_type" to linkType
            "link_id" to linkId
            "link_text" to linkText
            KEY_TIMESTAMP to System.currentTimeMillis() / 1000
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击消息通知
    @JvmStatic
    fun logMessageInformClick(
        contentId: String,
        newsId: String,
        gameId: String,
        gameCollectionId: String,
        messageType: String
    ) {
        val json = json {
            KEY_EVENT to "message_inform_click"
            KEY_CONTENT_ID to contentId
            "news_id" to newsId
            KEY_GAME_ID to gameId
            "game_collect_id" to gameCollectionId
            "message_type" to messageType
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击消息中心-头部图标/赞同/系统图标
    @JvmStatic
    fun logMessageInformTopIconClick(
        isInform: Boolean,
        displayType: String,
    ) {
        val json = json {
            KEY_EVENT to "message_inform_top_icon_click"
            "is_inform" to isInform
            "display_type" to displayType
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击消息提醒铃铛
    @JvmStatic
    fun logMessageInformBellClick(
        isInform: Boolean,
        entrance: String,
    ) {
        val json = json {
            KEY_EVENT to "message_inform_bell_click"
            "is_inform" to isInform
            KEY_ENTRANCE to entrance
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    //点击消息通知信息用户头像/昵称
    @JvmStatic
    fun logMessageInformUserClick(event: String) {
        val json = json {
            KEY_EVENT to event
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    // 游戏单活动成功创建游戏单事件
    @JvmStatic
    fun logCreateGameCollectionSuccess(
        gameIdList: List<String>,
        gameCollectionTitle: String,
        gameCollectionId: String,
        activityName: String
    ) {
        val json = json {
            KEY_EVENT to "activity_game_list_create_success"
            "game_id_array" to gameIdList
            "game_collect_title" to gameCollectionTitle
            "game_collect_id" to gameCollectionId
            "activity_name" to activityName
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    /**
     * 埋点序号：117
     * 事件ID：message_inform_push
     * 事件名称：消息推送事件
     * 触发时机：系统触发消息推送
     * @param gameId 游戏ID
     * @param gameName 游戏名称
     * @param sessionMessageType 会话类型
     * @param messageType 消息类型
     */
    @JvmStatic
    fun logMessageInformPush(
        gameId: String,
        gameName: String,
        sessionMessageType: String,
        messageType: String
    ) {
        val json = json {
            KEY_EVENT to "message_inform_push"
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            "session_message_type" to sessionMessageType
            "message_type" to messageType
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    /**
     * 埋点序号：118
     * 事件ID：launch_server_subscribe_add
     * 事件名称：加入开服订阅事件
     * 触发时机：点击开服表加入订阅
     * @param gameId 游戏ID
     * @param gameName 游戏名称
     */
    @JvmStatic
    fun logLaunchServerSubscribeAdd(
        gameId: String,
        gameName: String
    ) {
        val json = json {
            KEY_EVENT to "launch_server_subscribe_add"
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    /**
     * 埋点序号：119
     * 事件ID：launch_server_subscribe_cancel
     * 事件名称：取消开服订阅事件
     * 触发时机：点击开服表取消订阅
     * @param gameId 游戏ID
     * @param gameName 游戏名称
     */
    @JvmStatic
    fun logLaunchServerSubscribeCancel(
        gameId: String,
        gameName: String
    ) {
        val json = json {
            KEY_EVENT to "launch_server_subscribe_cancel"
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    /**
     * 埋点序号：120
     * 事件ID：launch_server_subscribe_click
     * 事件名称：点击开服订阅事件
     * 触发时机：点击开服管理的开服记录
     * @param gameId 游戏ID
     * @param gameName 游戏名称
     * @param launchServerTime 以秒为单位的时间戳,若为日期则是当天0点的时间戳
     */
    @JvmStatic
    fun logLaunchServerSubscribeClick(
        gameId: String,
        gameName: String,
        launchServerTime: Int
    ) {
        val json = json {
            KEY_EVENT to "launch_server_subscribe_click"
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            "launch_server_time" to launchServerTime
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    /**
     * 埋点序号：121
     * 事件ID：launch_server_reminder_add
     * 事件名称：添加开服提醒事件
     * 触发时机：点击开服表的添加提醒
     * @param gameId 游戏ID
     * @param gameName 游戏名称
     * @param reminderTime 设置提醒时间: 已知服是上传以秒为单位的时间戳，未知服则是当天0点的时间戳
     * @param reminderType 提醒类型: 已知服/未知服
     * @param launchServerTime 设置开服时间: 已知服是上传以秒为单位的时间戳，未知服则是当天0点的时间戳
     * @param serverName 服务器名字
     * @param isWechat 是否微信提醒
     * @param isApp 是否APP提醒
     */
    @JvmStatic
    fun logLaunchServerReminderAdd(
        gameId: String,
        gameName: String,
        reminderTime: Int,
        reminderType: String,
        launchServerTime: Int,
        serverName: String,
        isWechat: Boolean,
        isApp: Boolean
    ) {
        val json = json {
            KEY_EVENT to "launch_server_reminder_add"
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            "reminder_time" to reminderTime
            "reminder_type" to reminderType
            "launch_server_time" to launchServerTime
            "server_name" to serverName
            "is_wechat" to isWechat
            "is_app" to isApp
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    /**
     * 埋点序号：122
     * 事件ID：launch_server_reminder_cancel
     * 事件名称：取消开服提醒事件
     * 触发时机：点击开服表的取消提醒
     * @param gameId 游戏ID
     * @param gameName 游戏名称
     * @param reminderTime 设置提醒时间: 已知服是上传以秒为单位的时间戳，未知服则是当天0点的时间戳
     * @param reminderType 提醒类型: 已知服/未知服
     * @param launchServerTime 设置开服时间: 已知服是上传以秒为单位的时间戳，未知服则是当天0点的时间戳
     * @param serverName 服务器名字
     * @param isWechat 是否微信提醒
     * @param isApp 是否APP提醒
     */
    @JvmStatic
    fun logLaunchServerReminderCancel(
        gameId: String,
        gameName: String,
        reminderTime: Int,
        reminderType: String,
        launchServerTime: Int,
        serverName: String,
        isWechat: Boolean,
        isApp: Boolean
    ) {
        val json = json {
            KEY_EVENT to "launch_server_reminder_cancel"
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            "reminder_time" to reminderTime
            "reminder_type" to reminderType
            "launch_server_time" to launchServerTime
            "server_name" to serverName
            "is_wechat" to isWechat
            "is_app" to isApp
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }

    /**
     * 埋点序号：123
     * 事件ID：launch_server_reminder_click
     * 事件名称：点击开服提醒事件
     * 触发时机：点击开服管理的提醒记录
     * @param gameId 游戏ID
     * @param gameName 游戏名称
     * @param reminderTime 设置提醒时间: 已知服是上传以秒为单位的时间戳，未知服则是当天0点的时间戳
     * @param status 记录状态: todo 待提醒 coming 即将开服 opened 已开服 has_new 有新服 expired 已过期
     */
    @JvmStatic
    fun logLaunchServerReminderClick(
        gameId: String,
        gameName: String,
        reminderTime: Int,
        status: String,
    ) {
        val json = json {
            KEY_EVENT to "launch_server_reminder_click"
            KEY_GAME_ID to gameId
            KEY_GAME_NAME to gameName
            "reminder_time" to reminderTime
            "status" to status
            parseAndPutMeta().invoke(this)
        }
        log(json, LOG_STORE_EVENT)
    }
}