Commit 6760ab4d by 严久程

取mac地址

parent 905ef045
...@@ -72,6 +72,7 @@ internal class BaiduActionDataBean private constructor(builder: Builder) { ...@@ -72,6 +72,7 @@ internal class BaiduActionDataBean private constructor(builder: Builder) {
internal var androidId: String? = "" internal var androidId: String? = ""
internal var convertParam: String? = "" internal var convertParam: String? = ""
internal var uid : String? = "" internal var uid : String? = ""
internal var mac : String? = ""
internal var channel : String? = "" internal var channel : String? = ""
fun pkname(pkname: String = ""): Builder { fun pkname(pkname: String = ""): Builder {
...@@ -143,6 +144,10 @@ internal class BaiduActionDataBean private constructor(builder: Builder) { ...@@ -143,6 +144,10 @@ internal class BaiduActionDataBean private constructor(builder: Builder) {
this.uid = uid this.uid = uid
return this return this
} }
fun mac(mac : String? = "") : Builder {
this.mac = mac
return this
}
fun channel(channel : String? = "") : Builder { fun channel(channel : String? = "") : Builder {
this.channel = channel this.channel = channel
......
...@@ -48,16 +48,22 @@ class ActionCountUtils { ...@@ -48,16 +48,22 @@ class ActionCountUtils {
count(eventName, *sign1, urlStr = "", apiStr = "") count(eventName, *sign1, urlStr = "", apiStr = "")
} }
fun countUid(eventName: String,uid: String, vararg sign1: String) { fun countUid(eventName: String, uid: String, vararg sign1: String) {
count(eventName, *sign1, urlStr = "", apiStr = "",uid = uid) count(eventName, *sign1, urlStr = "", apiStr = "", uid = uid)
} }
fun count(eventName: String, vararg sign1: String, urlStr: String = "", apiStr: String = "",uid: String = "") { fun count(
eventName: String,
vararg sign1: String,
urlStr: String = "",
apiStr: String = "",
uid: String = ""
) {
var partId = "" var partId = ""
var position = "" var position = ""
var userId = uid var userId = uid
if (TextUtils.isEmpty(uid)){ if (TextUtils.isEmpty(uid)) {
userId = ModularServiceManager.getPlatformUserService()?.getUser()?.userId?: "" userId = ModularServiceManager.getPlatformUserService()?.getUser()?.userId ?: ""
} }
if (eventName.contains("|")) { if (eventName.contains("|")) {
val splitList = eventName.split("|") val splitList = eventName.split("|")
...@@ -73,11 +79,25 @@ class ActionCountUtils { ...@@ -73,11 +79,25 @@ class ActionCountUtils {
/** /**
* 行为数据埋点调用的方法 * 行为数据埋点调用的方法
*/ */
fun count(uid: String?, partId: String, position: String, url: String, api: String, sign1: String) { fun count(
uid: String?,
partId: String,
position: String,
url: String,
api: String,
sign1: String
) {
count(uid, partId, position, url, api, signs = *arrayOf(sign1)) count(uid, partId, position, url, api, signs = *arrayOf(sign1))
} }
fun count(uid: String?, partId: String, position: String, url: String, api: String, vararg signs: String) { fun count(
uid: String?,
partId: String,
position: String,
url: String,
api: String,
vararg signs: String
) {
try { try {
...@@ -140,17 +160,25 @@ class ActionCountUtils { ...@@ -140,17 +160,25 @@ class ActionCountUtils {
/** /**
* 百度检测数据埋点调用的方法 * 百度检测数据埋点调用的方法
*/ */
fun baiduCount( partId: String, position: String, convertType: Int) { fun baiduCount(partId: String, position: String, convertType: Int) {
val appFrom = BaseApp.instance.getGlobalConfig().appFrom val appFrom = BaseApp.instance.getGlobalConfig().appFrom
if (YDLConstants.FROM_YDL != appFrom){ if (YDLConstants.FROM_YDL != appFrom) {
return return
} }
val userId= ModularServiceManager.getPlatformUserService()?.getUser()?.userId?: "" val userId = ModularServiceManager.getPlatformUserService()?.getUser()?.userId ?: ""
baiduCount(userId,partId,position,"","",convertType) baiduCount(userId, partId, position, "", "", convertType)
} }
fun baiduCount(uid: String?, partId: String, position: String, url: String, api: String, convertType: Int) { fun baiduCount(
var appId = "ydl-app-android-"+ (if (BaseApp.instance.getGlobalConfig().appFrom== YDLConstants.FROM_XLZX)"xlzx" else "user") uid: String?,
partId: String,
position: String,
url: String,
api: String,
convertType: Int
) {
var appId =
"ydl-app-android-" + (if (BaseApp.instance.getGlobalConfig().appFrom == YDLConstants.FROM_XLZX) "xlzx" else "user")
try { try {
val actionDataParams = ActionDataBean.Builder() val actionDataParams = ActionDataBean.Builder()
...@@ -185,6 +213,16 @@ class ActionCountUtils { ...@@ -185,6 +213,16 @@ class ActionCountUtils {
baiduActionDataParams.network(DeviceTool.getNetworkState(RxTool.getContext())) baiduActionDataParams.network(DeviceTool.getNetworkState(RxTool.getContext()))
baiduActionDataParams.convertParam("") baiduActionDataParams.convertParam("")
baiduActionDataParams.uid(uid) baiduActionDataParams.uid(uid)
try {
var mac = DeviceTool.getMac(BaseApp.getApp())
if (!TextUtils.isEmpty(mac)) {
mac = mac.replace(":", "")
}
com.ydl.ydlcommon.utils.LogUtil.d("MAC=${mac}")
baiduActionDataParams.mac(mac)
} catch (e: Exception) {
}
baiduActionDataParams.channel(YdlCommonOut.getChannelName()) baiduActionDataParams.channel(YdlCommonOut.getChannelName())
val gson = Gson().toJson(baiduActionDataParams) val gson = Gson().toJson(baiduActionDataParams)
Log.e("Action", "---------$gson") Log.e("Action", "---------$gson")
...@@ -289,7 +327,8 @@ class ActionCountUtils { ...@@ -289,7 +327,8 @@ class ActionCountUtils {
*/ */
private fun isWifi(): Boolean { private fun isWifi(): Boolean {
try { try {
var connectivityManager: ConnectivityManager = RxTool.getContext().getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager var connectivityManager: ConnectivityManager =
RxTool.getContext().getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
var info: NetworkInfo = connectivityManager.activeNetworkInfo var info: NetworkInfo = connectivityManager.activeNetworkInfo
if (info != null && info.type == ConnectivityManager.TYPE_WIFI) { if (info != null && info.type == ConnectivityManager.TYPE_WIFI) {
return true return true
......
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