Commit 6760ab4d by 严久程

取mac地址

parent 905ef045
......@@ -72,6 +72,7 @@ internal class BaiduActionDataBean private constructor(builder: Builder) {
internal var androidId: String? = ""
internal var convertParam: String? = ""
internal var uid : String? = ""
internal var mac : String? = ""
internal var channel : String? = ""
fun pkname(pkname: String = ""): Builder {
......@@ -143,6 +144,10 @@ internal class BaiduActionDataBean private constructor(builder: Builder) {
this.uid = uid
return this
}
fun mac(mac : String? = "") : Builder {
this.mac = mac
return this
}
fun channel(channel : String? = "") : Builder {
this.channel = channel
......
......@@ -48,16 +48,22 @@ class ActionCountUtils {
count(eventName, *sign1, urlStr = "", apiStr = "")
}
fun countUid(eventName: String,uid: String, vararg sign1: String) {
count(eventName, *sign1, urlStr = "", apiStr = "",uid = uid)
fun countUid(eventName: String, uid: String, vararg sign1: String) {
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 position = ""
var userId = uid
if (TextUtils.isEmpty(uid)){
userId = ModularServiceManager.getPlatformUserService()?.getUser()?.userId?: ""
if (TextUtils.isEmpty(uid)) {
userId = ModularServiceManager.getPlatformUserService()?.getUser()?.userId ?: ""
}
if (eventName.contains("|")) {
val splitList = eventName.split("|")
......@@ -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))
}
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 {
......@@ -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
if (YDLConstants.FROM_YDL != appFrom){
if (YDLConstants.FROM_YDL != appFrom) {
return
}
val userId= ModularServiceManager.getPlatformUserService()?.getUser()?.userId?: ""
baiduCount(userId,partId,position,"","",convertType)
val userId = ModularServiceManager.getPlatformUserService()?.getUser()?.userId ?: ""
baiduCount(userId, partId, position, "", "", convertType)
}
fun baiduCount(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")
fun baiduCount(
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 {
val actionDataParams = ActionDataBean.Builder()
......@@ -185,6 +213,16 @@ class ActionCountUtils {
baiduActionDataParams.network(DeviceTool.getNetworkState(RxTool.getContext()))
baiduActionDataParams.convertParam("")
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())
val gson = Gson().toJson(baiduActionDataParams)
Log.e("Action", "---------$gson")
......@@ -206,13 +244,13 @@ class ActionCountUtils {
fun request(actionDataBean: ActionDataBean) {
try {
ApiRequestUtil.actionDataCount(actionDataBean)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
LogUtil.i(TAG, it.data)
}) {
LogUtil.i(TAG, it.toString())
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
LogUtil.i(TAG, it.data)
}) {
LogUtil.i(TAG, it.toString())
}
} catch (e: Exception) {
e.printStackTrace()
}
......@@ -289,7 +327,8 @@ class ActionCountUtils {
*/
private fun isWifi(): Boolean {
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
if (info != null && info.type == ConnectivityManager.TYPE_WIFI) {
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