Commit 2673e0b7 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 72bf2c61
......@@ -13,6 +13,7 @@ import com.bytedance.sdk.openadsdk.TTAdConstant
import com.bytedance.sdk.openadsdk.TTAdSdk
import com.fendasz.moku.planet.exception.MokuException
import com.fendasz.moku.planet.helper.MokuHelper
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.utils.LogUtil
import com.qq.e.comm.managers.GDTADManager
......@@ -23,16 +24,16 @@ import kotlinx.android.synthetic.main.activity_layout_xiaoman.*
*/
object XmManager {
private var placeMateId = ""
private var materialId = ""
private const val ACCESSKEY = "hzq-az_rvkvdy"
private const val SECRETKEY = "22FvHjUzvQ516214"
private var placeMateId = ""
private var materialId = ""
fun initXm(application: Application) {
// //打开日志,上线之前记得关闭
try {
// //打开日志,上线之前记得关闭
AdSdk.setDebug(true);
//打开日志,上线之前记得关闭
AdSdk.setDebug(BuildConfig.DEBUG)
//初始化 需要在Applicaiton 中
AdSdk.init(application, ACCESSKEY, SECRETKEY)
} catch (e: Exception) {//这里应该是小满的异常
......@@ -42,8 +43,7 @@ object XmManager {
fun loadMater(placeid: String) {
if (TextUtils.isEmpty(placeMateId)) {
val tm: MaterialTm by lazy { MaterialTm() }
tm!!.loadMaterialData(UserManager.getInstance().userID, placeid, object : MaterialTm.Callback {
MaterialTm().loadMaterialData(UserManager.getInstance().userID, placeid, object : MaterialTm.Callback {
//对应PlaceID会有对应的素材
override fun onSuccess(imgUrl: String, placeMateId2: String, materialId2: String) {
placeMateId = placeMateId2
......@@ -59,7 +59,6 @@ object XmManager {
} else {
AdSdk.exposure(UserManager.getInstance().userID, placeid, placeMateId, materialId);
LogUtil.d("******exposure*********${UserManager.getInstance().userID}******$placeMateId********$materialId****************$placeid**")
}
}
......@@ -69,8 +68,10 @@ object XmManager {
* @param view
*/
fun exprotClick(placeid: String) {
AdSdk.click(UserManager.getInstance().userID, placeid, materialId, materialId);
LogUtil.d( "******exprotClick*******${UserManager.getInstance().userID}*******$placeMateId********$materialId******$placeid")
if (!TextUtils.isEmpty(placeMateId)) {
AdSdk.click(UserManager.getInstance().userID, placeid, materialId, materialId)
LogUtil.d("******exprotClick*******${UserManager.getInstance().userID}*******$placeMateId********$materialId******$placeid")
}
}
}
\ No newline at end of file
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