Commit 89b9c71f authored by yinjiacheng's avatar yinjiacheng

update 订单详情页埋点

parent ecf0e7e3
......@@ -70,16 +70,16 @@ class OrderDetailActivity : BaseMvvmActivity<BorderActivityOrderDetailBinding, O
}
override fun onDoBack() {
vm.commitWidgetBuriedPoint("return_key")
// vm.commitWidgetBuriedPoint("return_key")
XPageManager.pop(null)
}
override fun onContractPickupPoint() {
vm.commitWidgetBuriedPoint("call_up")
vm.commitClickWidgetBuriedPoint("call_up")
}
override fun onGotoMarketingDetail() {
vm.commitWidgetBuriedPoint("activity_icon")
// vm.commitWidgetBuriedPoint("activity_icon")
}
override fun onApplyRefundSuccess() {
......@@ -88,6 +88,10 @@ class OrderDetailActivity : BaseMvvmActivity<BorderActivityOrderDetailBinding, O
}
override fun onContractSeller() {
vm.commitWidgetBuriedPoint("contact_seller")
vm.commitClickWidgetBuriedPoint("contact_seller")
}
override fun onApplyRefund() {
vm.commitClickWidgetBuriedPoint("apply_refund")
}
}
......@@ -71,6 +71,8 @@ class OrderCommodityInfoView @JvmOverloads constructor(context: Context, attrs:
}
}, null, R.color.color_FD7823).show()
// 回调申请退款
callback?.onApplyRefund()
})
// 监听申请退款接口请求结果
vm.applyRefundResult.observe(context as LifecycleOwner, {
......@@ -132,5 +134,10 @@ class OrderCommodityInfoView @JvmOverloads constructor(context: Context, attrs:
* 联系卖家
*/
fun onContractSeller()
/**
* 申请退款
*/
fun onApplyRefund()
}
}
package com.yidian.shenghuoquan.buserorder.viewmodel
import android.text.TextUtils
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.yidian.bcommon.mvvm.BaseViewModel
......@@ -7,6 +8,8 @@ import com.yidian.bcommon.utils.CPointUtils
import com.yidian.shenghuoquan.buserorder.dto.OrderDetailDto
import com.yidian.shenghuoquan.buserorder.http.OrderRemoteDataSource
import com.yidian.shenghuoquan.buserorder.http.callback.IGetOrderDetailCallback
import com.yidian.shenghuoquan.buserorder.manager.OrderStatus
import com.yidian.shenghuoquan.buserorder.manager.OrderStatusManager
import org.json.JSONObject
import timber.log.Timber
......@@ -28,8 +31,16 @@ class OrderDetailViewModel : BaseViewModel() {
override fun getOrderDetailSuccess(result: OrderDetailDto?) {
if (_orderDetailData.value == null) {
_orderDetailData.value = result
// 订单详情页面曝光埋点只上报一次
commitPageBuriedPoint()
if (result == null) return
// 订单详情按钮曝光埋点只上报一次
if (!TextUtils.isEmpty(result.placeList.phone)) {
commitViewWidgetBuriedPoint("call_up")
}
commitViewWidgetBuriedPoint("contact_seller")
if (OrderStatusManager.getOrderStatus(result.orderStatus) == OrderStatus.ORDER_STATUS_PAID) {
commitViewWidgetBuriedPoint("apply_refund")
}
return
}
_orderDetailData.value = result
}
......@@ -122,4 +133,52 @@ class OrderDetailViewModel : BaseViewModel() {
CPointUtils.performCommitLog(jsonObject)
Timber.tag("BUserOrderBuriedPoint").d("commit order detail widget log: $jsonObject")
}
/**
* 按钮点击埋点
*/
fun commitClickWidgetBuriedPoint(widgetName: String) {
// 埋点数据包装
val jsonObject = JSONObject()
jsonObject.put("eventName", "CLICK_WIDGET")
val contextJsonObject = JSONObject()
contextJsonObject.put("page", "ORDER_DETAIL_PAGE")
jsonObject.put("contextMap", contextJsonObject)
val entitiesJsonObject = JSONObject()
val widgetInfoJsonObject = JSONObject()
widgetInfoJsonObject.put("widget_type", "BUTTON")
widgetInfoJsonObject.put("widget_name", widgetName)
entitiesJsonObject.put("widget_info", widgetInfoJsonObject)
jsonObject.put("entitiesMap", entitiesJsonObject)
val propertiesJsonObject = JSONObject()
propertiesJsonObject.put("event_id", "SHQ_R_1625468015092")
jsonObject.put("propertiesMap", propertiesJsonObject)
jsonObject.put("logType", 1)
CPointUtils.performCommitLog(jsonObject)
Timber.tag("BUserOrderBuriedPoint").d("commit order detail widget log: $jsonObject")
}
/**
* 按钮曝光埋点
*/
fun commitViewWidgetBuriedPoint(widgetName: String) {
// 埋点数据包装
val jsonObject = JSONObject()
jsonObject.put("eventName", "VIEW_WIDGET")
val contextJsonObject = JSONObject()
contextJsonObject.put("page", "ORDER_DETAIL_PAGE")
jsonObject.put("contextMap", contextJsonObject)
val entitiesJsonObject = JSONObject()
val widgetInfoJsonObject = JSONObject()
widgetInfoJsonObject.put("widget_type", "BUTTON")
widgetInfoJsonObject.put("widget_name", widgetName)
entitiesJsonObject.put("widget_info", widgetInfoJsonObject)
jsonObject.put("entitiesMap", entitiesJsonObject)
val propertiesJsonObject = JSONObject()
propertiesJsonObject.put("event_id", "SHQ_R_1625560990174")
jsonObject.put("propertiesMap", propertiesJsonObject)
jsonObject.put("logType", 1)
CPointUtils.performCommitLog(jsonObject)
Timber.tag("BUserOrderBuriedPoint").d("commit order detail widget log: $jsonObject")
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment