Commit 161702eb authored by mengcuiguang's avatar mengcuiguang

添加风控逻辑

parent 34eeebf9
...@@ -14,8 +14,8 @@ android { ...@@ -14,8 +14,8 @@ android {
applicationId "com.mints.goodmoney" applicationId "com.mints.goodmoney"
minSdkVersion rootProject.ext.androidMinSdkVersion minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 25 versionCode 26
versionName "1.2.4" versionName "1.2.5"
flavorDimensions "default" flavorDimensions "default"
// dex突破65535的限制 // dex突破65535的限制
...@@ -199,7 +199,8 @@ dependencies { ...@@ -199,7 +199,8 @@ dependencies {
implementation 'com.github.SheHuan:NiceImageView:1.0.5' implementation 'com.github.SheHuan:NiceImageView:1.0.5'
// 跑马灯 // 跑马灯
implementation 'com.sunfusheng:marqueeview:1.2.0' implementation 'com.sunfusheng:marqueeview:1.2.0'
// 检测运行设备是否模拟器
implementation 'com.snail:antifake:1.4'
// 工具类 // 工具类
// gson // gson
......
...@@ -21,6 +21,8 @@ import com.mints.goodmoney.utils.ToastUtil; ...@@ -21,6 +21,8 @@ import com.mints.goodmoney.utils.ToastUtil;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Random; import java.util.Random;
/** /**
...@@ -57,6 +59,9 @@ public class VideoAdingManager { ...@@ -57,6 +59,9 @@ public class VideoAdingManager {
private ArrayList<WeightBean> weightList; private ArrayList<WeightBean> weightList;
private ArrayList<String> currentRandomAdList;//当前随机出的广告渠道
private ArrayList<String> adList;//广告渠道
// 是否是高额视频任务 // 是否是高额视频任务
private boolean isHighWeight = false; private boolean isHighWeight = false;
private boolean isTTVideoAd = false; private boolean isTTVideoAd = false;
...@@ -157,38 +162,35 @@ public class VideoAdingManager { ...@@ -157,38 +162,35 @@ public class VideoAdingManager {
this.activity = activityWeakReference.get(); this.activity = activityWeakReference.get();
isVideoAdDownload = false; isVideoAdDownload = false;
if (AppConfig.flVideoFlag) { // 权重自有逻辑
// 先展示枫岚视频 loadAdVideo(getVideoAdType(), bean);
firstLoadFlVideo(bean);
} else {
// 权重自有逻辑
loadAdVideo(getVideoAdType(), bean);
}
} }
/** /**
* 根据载体优先加载枫岚 * 根据广告优先级获取下一个
* * <p>
* @param bean _ * 穿山甲>优量汇>穿山甲全屏>快手>珊瑚>闪电盒子>枫岚(兜底)
*/ */
private void firstLoadFlVideo(VideoAdingBean bean) { private String getNextFailAdType() {
String adType; // 高额任务时 会为空
switch (bean.getCarrierType()) { if (adList == null || currentRandomAdList == null) {
case Constant.CARRIER_VERSUS_VIDEO: return getHighWeight();
case Constant.CARRIER_HOMEWATER: }
case Constant.CARRIER_WALK:
case Constant.CARRIER_WALK_BUBBLE: String nextAdType = Constant.FL_VEDIO_AD;
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD: try {
case Constant.CARRIER_OFFLINE_DOUBLE: List<String> tempList = listrem(adList, currentRandomAdList);
case Constant.CARRIER_EATMEAL_SUBSIDY: for (String code : tempList) {
adType = Constant.FL_VEDIO_AD; nextAdType = getAdtype(code);
// ToastUtil.showLong(activity, "载体优先类型:" + Constant.FL_VEDIO_AD); currentRandomAdList.add(code);
break; LogUtil.d(TAG, "失败返回adType:" + nextAdType);
default:
adType = getVideoAdType();
break; break;
}
} catch (Exception e) {
LogUtil.d(TAG, "失败返回Error");
e.printStackTrace();
} }
loadAdVideo(adType, bean); return nextAdType;
} }
/** /**
...@@ -201,29 +203,7 @@ public class VideoAdingManager { ...@@ -201,29 +203,7 @@ public class VideoAdingManager {
this.activity = activityWeakReference.get(); this.activity = activityWeakReference.get();
isVideoAdDownload = false; isVideoAdDownload = false;
loadAdVideo(getNextAdType(), bean); loadAdVideo(getNextFailAdType(), bean);
}
/**
* 根据广告优先级获取下一个
* 穿山甲->优量汇->穿山甲全屏->快手->珊瑚->闪电盒子->RTA->枫岚(兜底)
*/
private String getNextAdType() {
String nextAdType;
if (AppConfig.csjVideoAdCount > 0) {
nextAdType = Constant.CSJ_VEDIO_AD;
} else if (AppConfig.ylhAdCount > 0) {
nextAdType = Constant.YLH_VEDIO_AD;
} else if (AppConfig.csjFullVideoAdCount > 0) {
nextAdType = Constant.CSJ_FULL_AD;
} else if (AppConfig.ksVideoAdCount > 0) {
nextAdType = Constant.KS_VEDIO_AD;
} else if (AppConfig.shVideoAdCount > 0) {
nextAdType = Constant.SH_VEDIO_AD;
} else {
nextAdType = Constant.FL_VEDIO_AD;
}
return nextAdType;
} }
/** /**
...@@ -239,6 +219,10 @@ public class VideoAdingManager { ...@@ -239,6 +219,10 @@ public class VideoAdingManager {
} }
isHighWeight = false; isHighWeight = false;
if (currentRandomAdList != null) {
currentRandomAdList.add(getCode(adType));
}
LogUtil.d(TAG, "权重结果返回的广告类型:" + adType); LogUtil.d(TAG, "权重结果返回的广告类型:" + adType);
return adType; return adType;
} }
...@@ -267,50 +251,67 @@ public class VideoAdingManager { ...@@ -267,50 +251,67 @@ public class VideoAdingManager {
* @return _ * @return _
*/ */
private String getRandomWeight() { private String getRandomWeight() {
if (currentRandomAdList == null) {
currentRandomAdList = new ArrayList<>();
}
currentRandomAdList.clear();
if (adList == null) {
adList = new ArrayList<>();
}
adList.clear();
if (weightList != null) { if (weightList != null) {
weightList.clear(); weightList.clear();
} }
int weight = 0; int weight = 0;
// 穿山甲>优量汇>穿山甲全屏>快手>珊瑚>闪电盒子>枫岚(兜底)
// 若没有视频完成数,不加入权重计算范围内 // 若没有视频完成数,不加入权重计算范围内
if (AppConfig.csjVideoAdCount > 0) { if (AppConfig.csjVideoAdCount > 0) {
weightList.add(new WeightBean(csjVideoWeight, Constant.CSJ_VEDIO_AD)); weightList.add(new WeightBean(csjVideoWeight, Constant.CSJ_VEDIO_AD));
weight = weight + csjVideoWeight; weight = weight + csjVideoWeight;
LogUtil.d(TAG, "权重值:csjVideoWeight:" + csjVideoWeight); LogUtil.d(TAG, "权重值:csjVideoWeight:" + csjVideoWeight);
adList.add("a");
} }
if (AppConfig.ylhAdCount > 0) { if (AppConfig.ylhAdCount > 0) {
weightList.add(new WeightBean(ylhWeight, Constant.YLH_VEDIO_AD)); weightList.add(new WeightBean(ylhWeight, Constant.YLH_VEDIO_AD));
weight = weight + ylhWeight; weight = weight + ylhWeight;
LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight); LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight);
adList.add("b");
} }
if (AppConfig.csjFullVideoAdCount > 0) { if (AppConfig.csjFullVideoAdCount > 0) {
weightList.add(new WeightBean(csjFullVideoWeight, Constant.CSJ_FULL_AD)); weightList.add(new WeightBean(csjFullVideoWeight, Constant.CSJ_FULL_AD));
weight = weight + csjFullVideoWeight; weight = weight + csjFullVideoWeight;
LogUtil.d(TAG, "权重值:csjFullVideoWeight:" + csjFullVideoWeight); LogUtil.d(TAG, "权重值:csjFullVideoWeight:" + csjFullVideoWeight);
adList.add("c");
} }
if (AppConfig.ksVideoAdCount > 0) { if (AppConfig.wnVideoAdCount > 0) {
weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD)); weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD));
weight = weight + ksVideoWeight; weight = weight + wnWeight;
LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight); LogUtil.d(TAG, "权重值:sdhzWeight:" + wnWeight);
adList.add("d");
} }
if (AppConfig.shVideoAdCount > 0) { if (AppConfig.shVideoAdCount > 0) {
weightList.add(new WeightBean(shVideoWeight, Constant.SH_VEDIO_AD)); weightList.add(new WeightBean(shVideoWeight, Constant.SH_VEDIO_AD));
weight = weight + shVideoWeight; weight = weight + shVideoWeight;
LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight); LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight);
adList.add("e");
} }
if (AppConfig.wnVideoAdCount > 0) { if (AppConfig.ksVideoAdCount > 0) {
weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD)); weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD));
weight = weight + wnWeight; weight = weight + ksVideoWeight;
LogUtil.d(TAG, "权重值:sdhzWeight:" + wnWeight); LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight);
} adList.add("f");
if (AppConfig.rtaVideoAdCount > 0) {
weightList.add(new WeightBean(rtaVideoWeight, Constant.RTA_VEDIO_AD));
weight = weight + rtaVideoWeight;
LogUtil.d(TAG, "权重值:rtaWeight:" + rtaVideoWeight);
} }
if (AppConfig.flVideoAdCount > 0) { if (AppConfig.flVideoAdCount > 0) {
weightList.add(new WeightBean(flVideoWeight, Constant.FL_VEDIO_AD)); weightList.add(new WeightBean(flVideoWeight, Constant.FL_VEDIO_AD));
weight = weight + flVideoWeight; weight = weight + flVideoWeight;
LogUtil.d(TAG, "权重值:flVideoWeight:" + flVideoWeight); LogUtil.d(TAG, "权重值:flVideoWeight:" + flVideoWeight);
adList.add("g");
}
if (AppConfig.rtaVideoAdCount > 0) {
weightList.add(new WeightBean(rtaVideoWeight, Constant.RTA_VEDIO_AD));
weight = weight + rtaVideoWeight;
LogUtil.d(TAG, "权重值:rtaWeight:" + rtaVideoWeight);
} }
// 权重随机 // 权重随机
...@@ -354,7 +355,6 @@ public class VideoAdingManager { ...@@ -354,7 +355,6 @@ public class VideoAdingManager {
int flVideoAdCount = AppConfig.flVideoAdCount; int flVideoAdCount = AppConfig.flVideoAdCount;
int tzVideoAdCount = AppConfig.shVideoAdCount; int tzVideoAdCount = AppConfig.shVideoAdCount;
int ksVideoAdCount = AppConfig.ksVideoAdCount; int ksVideoAdCount = AppConfig.ksVideoAdCount;
int rtaVideoAdCount = AppConfig.rtaVideoAdCount;
int csjFullVideoAdCount = AppConfig.csjFullVideoAdCount; int csjFullVideoAdCount = AppConfig.csjFullVideoAdCount;
if (ylhAdCount <= 0 && if (ylhAdCount <= 0 &&
...@@ -363,8 +363,7 @@ public class VideoAdingManager { ...@@ -363,8 +363,7 @@ public class VideoAdingManager {
flVideoAdCount <= 0 && flVideoAdCount <= 0 &&
tzVideoAdCount <= 0 && tzVideoAdCount <= 0 &&
csjFullVideoAdCount <= 0 && csjFullVideoAdCount <= 0 &&
ksVideoAdCount <= 0 && ksVideoAdCount <= 0 ) {
rtaVideoAdCount <= 0) {
// showToast("今日视频已看完,请明天再来吧"); // showToast("今日视频已看完,请明天再来吧");
return true; return true;
} }
...@@ -422,9 +421,30 @@ public class VideoAdingManager { ...@@ -422,9 +421,30 @@ public class VideoAdingManager {
mReceiverBroadcastReceiver = null; mReceiverBroadcastReceiver = null;
} }
currentRandomAdList = null;
adList = null;
activity = null; activity = null;
} }
/**
* 从listA里删除listB里有的数据
*
* @param adList
* @param currentRandomAdList
* @return
*/
public List<String> listrem(List<String> adList, List<String> currentRandomAdList) {
HashSet hs1 = new HashSet(adList);
HashSet hs2 = new HashSet(currentRandomAdList);
// LogUtil.d(TAG, "权重List:" + JsonUtil.toJson(adList));
// LogUtil.d(TAG, "过滤List:" + JsonUtil.toJson(currentRandomAdList));
hs1.removeAll(hs2);
List<String> listC = new ArrayList<String>();
listC.addAll(hs1);
return listC;
}
public void setVideoAdingListener(VideoAdingListener videoAdingListener) { public void setVideoAdingListener(VideoAdingListener videoAdingListener) {
this.videoAdingListener = videoAdingListener; this.videoAdingListener = videoAdingListener;
} }
...@@ -753,5 +773,53 @@ public class VideoAdingManager { ...@@ -753,5 +773,53 @@ public class VideoAdingManager {
} }
} }
} }
private String getCode(String adtype) {
String code = "g";
switch (adtype) {
case Constant.CSJ_VEDIO_AD:
code = "a";
break;
case Constant.YLH_VEDIO_AD:
code = "b";
break;
case Constant.CSJ_FULL_AD:
code = "c";
break;
case Constant.SDHZ_VEDIO_AD:
code = "d";
break;
case Constant.SH_VEDIO_AD:
code = "e";
break;
case Constant.KS_VEDIO_AD:
code = "f";
break;
}
return code;
}
private String getAdtype(String code) {
String adtype = Constant.FL_VEDIO_AD;
switch (code) {
case "a":
adtype = Constant.CSJ_VEDIO_AD;
break;
case "b":
adtype = Constant.YLH_VEDIO_AD;
break;
case "c":
adtype = Constant.CSJ_FULL_AD;
break;
case "d":
adtype = Constant.SDHZ_VEDIO_AD;
break;
case "e":
adtype = Constant.SH_VEDIO_AD;
break;
case "f":
adtype = Constant.KS_VEDIO_AD;
break;
}
return adtype;
}
} }
\ No newline at end of file
...@@ -131,4 +131,8 @@ public class AppConfig { ...@@ -131,4 +131,8 @@ public class AppConfig {
*/ */
public static boolean isSuperTask = false; public static boolean isSuperTask = false;
/**
* 激励视频是否休眠 false-不休眠 提示:加载失败,请稍后重试。
*/
public static boolean isVideoSleep = false;
} }
...@@ -1017,6 +1017,39 @@ class DeviceInfo private constructor() { ...@@ -1017,6 +1017,39 @@ class DeviceInfo private constructor() {
return 0 return 0
} }
/**
* 获取后台运行APP
*/
fun getRunningApp(): String {
try {
val appList: MutableList<MutableMap<String, String>> = ArrayList()
val localPackageManager = mContext?.packageManager
localPackageManager?.let {
val localList = localPackageManager.getInstalledPackages(0)
for (i in 0 until localList.size) {
val pinfo = localList.get(i) as PackageInfo
if (pinfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM > 0) {
//系统程序 忽略
continue
}
if (ApplicationInfo.FLAG_UPDATED_SYSTEM_APP and pinfo.applicationInfo.flags == 0
&& ApplicationInfo.FLAG_STOPPED and pinfo.applicationInfo.flags == 0) {
val appMap: MutableMap<String, String> = HashMap()
appMap["appName"] = pinfo.applicationInfo.loadLabel(mContext!!.packageManager) as String
appMap["appPkg"] = pinfo.packageName
appList.add(appMap)
}
}
return JsonUtil.toJson(appList)
}
}catch (e:Exception){
}
return ""
}
companion object { companion object {
private var _inst: DeviceInfo? = null private var _inst: DeviceInfo? = null
val instance: DeviceInfo val instance: DeviceInfo
......
package com.mints.goodmoney.manager
import com.mints.goodmoney.MintsApplication
import com.snail.antifake.jni.EmulatorDetectUtil
/**
* 描述:模拟器校验
* 作者:孟崔广
*/
object SimulatorManager {
/**
* 是否是模拟器 0-不是模拟器
*/
fun isEmulator(): Int {
try {
return if (EmulatorDetectUtil.isEmulator(MintsApplication.getContext())) 1 else 0
} catch (e: Exception) {
e.printStackTrace()
}
return 0
}
}
\ No newline at end of file
...@@ -131,4 +131,16 @@ public class TrackManager { ...@@ -131,4 +131,16 @@ public class TrackManager {
trackPresenter.reportErrornterface(url, request); trackPresenter.reportErrornterface(url, request);
} }
} }
public void getAdWeight() {
if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) {
trackPresenter.getAdWeight();
}
}
public void riskinfo() {
if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) {
trackPresenter.riskinfo();
}
}
} }
package com.mints.goodmoney.manager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.mvp.model.UserTaskMsgBean
import com.mints.goodmoney.ui.fragment.MainFragment
import com.mints.goodmoney.utils.ForegroundOrBackground
import com.mints.goodmoney.utils.LogUtil
/**
* 描述:用户广告视频数和权重
* 作者:孟崔广
*/
object UserWeight {
private val TAG = UserWeight::class.java.simpleName
private val videoAdingManager by lazy { VideoAdingManager.getInstance(ForegroundOrBackground.getApp_activity()) }
fun initAdWeight(data: UserTaskMsgBean) {
AppConfig.isVideoSleep=data.vedioRules.isVedioSleep
videoAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate,
data.vedioRules.rtA_VEDIO.rate
)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"rtaWeight:${data.vedioRules.rtA_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate}"
)
// 广告视频数
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
AppConfig.rtaVideoAdCount = data.vedioRules.rtA_VEDIO.surplus
AppConfig.csjFullVideoAdCount = data.vedioRules.csjfulL_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount} " +
"rtaCount:${AppConfig.rtaVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount}"
)
}
}
\ No newline at end of file
...@@ -13,6 +13,8 @@ public class VedioRulesBean implements Serializable { ...@@ -13,6 +13,8 @@ public class VedioRulesBean implements Serializable {
private KSVedioBean KS_VEDIO; private KSVedioBean KS_VEDIO;
private RTAVedioBean RTA_VEDIO; private RTAVedioBean RTA_VEDIO;
private boolean flVideoFlag; private boolean flVideoFlag;
private boolean vedioSleep;
public class CsjVedioBean implements Serializable { public class CsjVedioBean implements Serializable {
private int surplus;//剩余可看视频数 private int surplus;//剩余可看视频数
...@@ -158,4 +160,8 @@ public class VedioRulesBean implements Serializable { ...@@ -158,4 +160,8 @@ public class VedioRulesBean implements Serializable {
public boolean isFlVideoFlag() { public boolean isFlVideoFlag() {
return flVideoFlag; return flVideoFlag;
} }
public boolean isVedioSleep() {
return vedioSleep;
}
} }
...@@ -199,53 +199,4 @@ public class AwardPresenter extends BasePresenter<AwardView> { ...@@ -199,53 +199,4 @@ public class AwardPresenter extends BasePresenter<AwardView> {
}); });
} }
public void riskinfo() {
DeviceInfo deviceInfo = DeviceInfo.Companion.getInstance();
RxjavaUtil.executeRxTask(new CommonRxTask<String>("") {
@Override
public void doInIOThread() {
setT(deviceInfo.getAppInfoMap());
}
@Override
public void doInUIThread() {
HashMap<String, Object> vo = new HashMap<>();
vo.put("androidid", deviceInfo.getAndroidId(null));
vo.put("os", "android");
vo.put("model", deviceInfo.getBrand() + " " + deviceInfo.getMobileModel());
vo.put("uuid", new DeviceUuidFactory().getDeviceUuid());
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("applist", getT());
vo.put("eventid", Constant.RISK_EVENT_ID_TASK);
vo.put("ischarge", deviceInfo.isCharging());
vo.put("isusbdebug", deviceInfo.getGetUsbStatus());
vo.put("iswifi", deviceInfo.getGetWifiConnected());
vo.put("isroot", deviceInfo.isRoot());
vo.put("isvpn", deviceInfo.isVPN());
vo.put("memory", deviceInfo.getTotalMemory() + "+" + deviceInfo.getTotalStorage());
vo.put("operator", deviceInfo.getOperator());
vo.put("idfa", "");
vo.put("imei", deviceInfo.getIMEI());
vo.put("oaid", MintsApplication.OAID);
AppHttpManager.getInstance(loanApplication)
.call(loanService.riskinfo(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
}
});
}
});
}
} }
...@@ -8,6 +8,7 @@ import com.mints.goodmoney.common.Constant; ...@@ -8,6 +8,7 @@ import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.common.DeviceInfo; import com.mints.goodmoney.common.DeviceInfo;
import com.mints.goodmoney.manager.AppHttpManager; import com.mints.goodmoney.manager.AppHttpManager;
import com.mints.goodmoney.manager.ShumeiManager; import com.mints.goodmoney.manager.ShumeiManager;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.UserManager; import com.mints.goodmoney.manager.UserManager;
import com.mints.goodmoney.mvp.model.BaseResponse; import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.model.DrawcashBean; import com.mints.goodmoney.mvp.model.DrawcashBean;
...@@ -152,7 +153,7 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> { ...@@ -152,7 +153,7 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
vo.put("oaid", MintsApplication.OAID); vo.put("oaid", MintsApplication.OAID);
} }
riskinfo(deviceInfo, getT()); TrackManager.getInstance().riskinfo();
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo), .call(loanService.saveTerminalInfo(vo),
...@@ -314,46 +315,4 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> { ...@@ -314,46 +315,4 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
}); });
} }
/**
* 风控信息
*/
private void riskinfo(DeviceInfo deviceInfo, String appPkgList) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("androidid", deviceInfo.getAndroidId(null));
vo.put("os", "android");
vo.put("model", deviceInfo.getBrand() + " " + deviceInfo.getMobileModel());
vo.put("uuid", new DeviceUuidFactory().getDeviceUuid());
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("applist", appPkgList);
vo.put("eventid", Constant.RISK_EVENT_ID_DRAWCASH);
vo.put("ischarge", deviceInfo.isCharging());
vo.put("isusbdebug", deviceInfo.getGetUsbStatus());
vo.put("iswifi", deviceInfo.getGetWifiConnected());
vo.put("isroot", deviceInfo.isRoot());
vo.put("isvpn", deviceInfo.isVPN());
vo.put("memory", deviceInfo.getTotalMemory() + "+" + deviceInfo.getTotalStorage());
vo.put("operator", deviceInfo.getOperator());
vo.put("idfa", "");
vo.put("imei", deviceInfo.getIMEI());
vo.put("oaid", MintsApplication.OAID);
AppHttpManager.getInstance(loanApplication)
.call(loanService.riskinfo(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
}
});
}
} }
...@@ -4,10 +4,7 @@ import android.text.TextUtils ...@@ -4,10 +4,7 @@ import android.text.TextUtils
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.AppHttpManager import com.mints.goodmoney.manager.*
import com.mints.goodmoney.manager.JpushManager
import com.mints.goodmoney.manager.ShumeiManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.BaseResponse import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.UserBean import com.mints.goodmoney.mvp.model.UserBean
import com.mints.goodmoney.mvp.views.LoginView import com.mints.goodmoney.mvp.views.LoginView
...@@ -251,7 +248,7 @@ class LoginPresenter : BasePresenter<LoginView>() { ...@@ -251,7 +248,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId() vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
vo["appPkgList"] = t.toString() vo["appPkgList"] = t.toString()
riskinfo(deviceInfo, t.toString()) TrackManager.getInstance().riskinfo()
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo), .call(loanService.saveTerminalInfo(vo),
...@@ -281,42 +278,4 @@ class LoginPresenter : BasePresenter<LoginView>() { ...@@ -281,42 +278,4 @@ class LoginPresenter : BasePresenter<LoginView>() {
} }
/**
* 风控信息
*/
fun riskinfo(deviceInfo: DeviceInfo, appPkgList: String) {
val vo = HashMap<String, Any>()
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
vo["applist"] = appPkgList
vo["eventid"] = Constant.RISK_EVENT_ID_LOGIN
vo["ischarge"] = deviceInfo.isCharging
vo["isusbdebug"] = deviceInfo.getUsbStatus
vo["iswifi"] = deviceInfo.getWifiConnected
vo["isroot"] = deviceInfo.isRoot
vo["isvpn"] = deviceInfo.isVPN
vo["memory"] = deviceInfo.totalMemory + "+" + deviceInfo.totalStorage
vo["operator"] = deviceInfo.operator
vo["idfa"] = ""
vo["imei"] = deviceInfo.iMEI
vo["oaid"] = MintsApplication.OAID
AppHttpManager.getInstance(loanApplication)
.call(loanService.riskinfo(vo),
object : BaseSubscriber<BaseResponse<Object>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<Object>) {
}
})
}
} }
\ No newline at end of file
package com.mints.goodmoney.mvp.presenters; package com.mints.goodmoney.mvp.presenters;
import android.app.Activity; import android.app.Activity;
import android.text.TextUtils;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.mints.goodmoney.MintsApplication; import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig; import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant; import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.common.DeviceInfo;
import com.mints.goodmoney.manager.AppHttpManager; import com.mints.goodmoney.manager.AppHttpManager;
import com.mints.goodmoney.manager.SimulatorManager;
import com.mints.goodmoney.manager.UserWeight;
import com.mints.goodmoney.mvp.model.BaseResponse; import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.model.CommonParamBean; import com.mints.goodmoney.mvp.model.CommonParamBean;
import com.mints.goodmoney.mvp.model.UserTaskMsgBean;
import com.mints.goodmoney.utils.AccessibilityUtils;
import com.mints.goodmoney.utils.DeviceUuidFactory;
import com.mints.goodmoney.utils.rxutil.CommonRxTask;
import com.mints.goodmoney.utils.rxutil.RxjavaUtil;
import com.mints.library.net.neterror.BaseSubscriber; import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable; import com.mints.library.net.neterror.Throwable;
...@@ -66,6 +75,9 @@ public class TrackPresenter extends BaseTrackPresenter { ...@@ -66,6 +75,9 @@ public class TrackPresenter extends BaseTrackPresenter {
@Override @Override
public void onNext(BaseResponse<Object> baseResponse) { public void onNext(BaseResponse<Object> baseResponse) {
if (TextUtils.equals(Constant.EVENT_TYPE_ONE, eventType)) {
getAdWeight();
}
} }
}); });
} }
...@@ -302,4 +314,90 @@ public class TrackPresenter extends BaseTrackPresenter { ...@@ -302,4 +314,90 @@ public class TrackPresenter extends BaseTrackPresenter {
} }
}); });
} }
/**
* 获取权重
*/
public void getAdWeight() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.vedioPlans(),
new BaseSubscriber<BaseResponse<UserTaskMsgBean>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<UserTaskMsgBean> baseResponse) {
UserWeight.INSTANCE.initAdWeight(baseResponse.getData());
}
});
}
public void riskinfo() {
DeviceInfo deviceInfo = DeviceInfo.Companion.getInstance();
HashMap<String, Object> vo = new HashMap<>();
RxjavaUtil.executeRxTask(new CommonRxTask<String>("") {
@Override
public void doInIOThread() {
setT(deviceInfo.getAppInfoMap());
}
@Override
public void doInUIThread() {
vo.put("androidid", deviceInfo.getAndroidId(null));
vo.put("os", "android");
vo.put("model", deviceInfo.getBrand() + " " + deviceInfo.getMobileModel());
vo.put("uuid", new DeviceUuidFactory().getDeviceUuid());
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("applist", getT());
vo.put("eventid", Constant.RISK_EVENT_ID_TASK);
vo.put("ischarge", deviceInfo.isCharging());
vo.put("isusbdebug", deviceInfo.getGetUsbStatus());
vo.put("iswifi", deviceInfo.getGetWifiConnected());
vo.put("isroot", deviceInfo.isRoot());
vo.put("isvpn", deviceInfo.isVPN());
vo.put("memory", deviceInfo.getTotalMemory() + "+" + deviceInfo.getTotalStorage());
vo.put("operator", deviceInfo.getOperator());
vo.put("idfa", "");
vo.put("imei", deviceInfo.getIMEI());
vo.put("oaid", MintsApplication.OAID);
vo.put("isSimulator", SimulatorManager.INSTANCE.isEmulator());
vo.put("isAccessibility", AccessibilityUtils.isAccessibilityEnabled());
RxjavaUtil.executeRxTask(new CommonRxTask<String>("") {
@Override
public void doInIOThread() {
setT(deviceInfo.getRunningApp());
}
@Override
public void doInUIThread() {
vo.put("appRunningPkgList", getT());
AppHttpManager.getInstance(loanApplication)
.call(loanService.riskinfo(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
}
});
}
});
}
});
}
} }
...@@ -582,7 +582,6 @@ public interface LoanService { ...@@ -582,7 +582,6 @@ public interface LoanService {
Observable<BaseResponse<JsonObject>> reportErrornterface(@Body Map<String, Object> vo); Observable<BaseResponse<JsonObject>> reportErrornterface(@Body Map<String, Object> vo);
/** /**
* <<<<<<< Updated upstream
* 获取大转盘信息 * 获取大转盘信息
* *
* @return * @return
...@@ -622,6 +621,14 @@ public interface LoanService { ...@@ -622,6 +621,14 @@ public interface LoanService {
@POST("api/myRotationChart") @POST("api/myRotationChart")
Observable<BaseResponse<RotationChartBean>> myRotationChart(); Observable<BaseResponse<RotationChartBean>> myRotationChart();
/**
* 获取权重信息
*
* @return
*/
@POST("api/vedioPlans")
Observable<BaseResponse<UserTaskMsgBean>> vedioPlans();
/** /**
* 默认http工厂 * 默认http工厂
*/ */
......
...@@ -502,7 +502,10 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -502,7 +502,10 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVideo() { private fun awardVideo() {
if (videoAdingManager.videoFinishFlag) { if (AppConfig.isVideoSleep) {
showToast("加载失败,请稍后重试。")
return
} else if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
...@@ -529,7 +532,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -529,7 +532,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
override fun videoAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++ loadVideoFailCount++
if (loadVideoFailCount >= 2) { if (loadVideoFailCount >= 3) {
hideLoading() hideLoading()
showToast("加载失败,请稍后重试!") showToast("加载失败,请稍后重试!")
} else { } else {
...@@ -608,7 +611,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -608,7 +611,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
// 上传风控信息 // 上传风控信息
if (riskFlag) { if (riskFlag) {
awardPresenter.riskinfo() TrackManager.getInstance().riskinfo()
} }
} }
......
...@@ -25,6 +25,7 @@ import com.mints.goodmoney.call.business.VideoDBHelper ...@@ -25,6 +25,7 @@ import com.mints.goodmoney.call.business.VideoDBHelper
import com.mints.goodmoney.call.detail.DetailApplyActivity import com.mints.goodmoney.call.detail.DetailApplyActivity
import com.mints.goodmoney.call.permission.PermissionActivity import com.mints.goodmoney.call.permission.PermissionActivity
import com.mints.goodmoney.call.permission.PermissionManager import com.mints.goodmoney.call.permission.PermissionManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.UserManager import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.DrawVideoBean import com.mints.goodmoney.mvp.model.DrawVideoBean
...@@ -321,7 +322,10 @@ class DrawNativeVideoActivity : BaseActivity(), ...@@ -321,7 +322,10 @@ class DrawNativeVideoActivity : BaseActivity(),
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVideo() { private fun awardVideo() {
if (videoAdingManager.videoFinishFlag) { if (AppConfig.isVideoSleep) {
showToast("加载失败,请稍后重试。")
return
} else if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
...@@ -345,7 +349,7 @@ class DrawNativeVideoActivity : BaseActivity(), ...@@ -345,7 +349,7 @@ class DrawNativeVideoActivity : BaseActivity(),
override fun videoAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++ loadVideoFailCount++
if (loadVideoFailCount >= 2) { if (loadVideoFailCount >= 3) {
hideLoading() hideLoading()
showToast("加载失败,请稍后重试!") showToast("加载失败,请稍后重试!")
} else { } else {
......
...@@ -14,6 +14,7 @@ import com.mints.goodmoney.call.business.VideoDBHelper ...@@ -14,6 +14,7 @@ import com.mints.goodmoney.call.business.VideoDBHelper
import com.mints.goodmoney.call.detail.DetailApplyActivity import com.mints.goodmoney.call.detail.DetailApplyActivity
import com.mints.goodmoney.call.permission.PermissionActivity import com.mints.goodmoney.call.permission.PermissionActivity
import com.mints.goodmoney.call.permission.PermissionManager import com.mints.goodmoney.call.permission.PermissionManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.UserManager import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.KylBean import com.mints.goodmoney.mvp.model.KylBean
...@@ -163,7 +164,10 @@ class KylVideoActivity : BaseActivity(), View.OnClickListener, KylVideoView { ...@@ -163,7 +164,10 @@ class KylVideoActivity : BaseActivity(), View.OnClickListener, KylVideoView {
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVideo() { private fun awardVideo() {
if (videoAdingManager.videoFinishFlag) { if (AppConfig.isVideoSleep) {
showToast("加载失败,请稍后重试。")
return
} else if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
...@@ -187,7 +191,7 @@ class KylVideoActivity : BaseActivity(), View.OnClickListener, KylVideoView { ...@@ -187,7 +191,7 @@ class KylVideoActivity : BaseActivity(), View.OnClickListener, KylVideoView {
override fun videoAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++ loadVideoFailCount++
if (loadVideoFailCount >= 2) { if (loadVideoFailCount >= 3) {
hideLoading() hideLoading()
showToast("加载失败,请稍后重试!") showToast("加载失败,请稍后重试!")
} else { } else {
......
...@@ -8,6 +8,7 @@ import com.mints.goodmoney.R ...@@ -8,6 +8,7 @@ import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.VideoAdingManager import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.manager.TtCsjAdManager import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.MorningClockBean import com.mints.goodmoney.mvp.model.MorningClockBean
import com.mints.goodmoney.mvp.model.VideoAdingBean import com.mints.goodmoney.mvp.model.VideoAdingBean
...@@ -107,7 +108,10 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV ...@@ -107,7 +108,10 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVideo() { private fun awardVideo() {
if (videoAdingManager.videoFinishFlag) { if (AppConfig.isVideoSleep) {
showToast("加载失败,请稍后重试。")
return
} else if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
...@@ -131,7 +135,7 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV ...@@ -131,7 +135,7 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV
override fun videoAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++ loadVideoFailCount++
if (loadVideoFailCount >= 2) { if (loadVideoFailCount >= 3) {
hideLoading() hideLoading()
showToast("加载失败,请稍后重试!") showToast("加载失败,请稍后重试!")
} else { } else {
......
...@@ -34,6 +34,9 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base ...@@ -34,6 +34,9 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
if (android.os.Build.VERSION.SDK_INT != Build.VERSION_CODES.O) { if (android.os.Build.VERSION.SDK_INT != Build.VERSION_CODES.O) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} }
......
...@@ -234,7 +234,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -234,7 +234,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 新人福利 放到个人中心展示 防止首页红包转动异常 // 新人福利 放到个人中心展示 防止首页红包转动异常
// 设置视频权重 // 设置视频权重
initAdWeight(data) UserWeight.initAdWeight(data)
initExpress(data.flowAdRules) initExpress(data.flowAdRules)
// 调用金币视频信息接口 // 调用金币视频信息接口
...@@ -571,48 +571,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -571,48 +571,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}) })
} }
/**
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
videoAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate,
data.vedioRules.rtA_VEDIO.rate
)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"rtaWeight:${data.vedioRules.rtA_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate}"
)
// 广告视频数
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.csjFullVideoAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
AppConfig.rtaVideoAdCount = data.vedioRules.rtA_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount} " +
"ratCount:${AppConfig.rtaVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount}"
)
}
private fun initExpress(flowAdRules: FlowAdRulesBean) { private fun initExpress(flowAdRules: FlowAdRulesBean) {
PreLoadExpressManager.init(flowAdRules.csj, flowAdRules.ylh, flowAdRules.ks) PreLoadExpressManager.init(flowAdRules.csj, flowAdRules.ylh, flowAdRules.ks)
} }
......
...@@ -329,8 +329,8 @@ class MyFragment : BaseFragment(), ...@@ -329,8 +329,8 @@ class MyFragment : BaseFragment(),
AppConfig.wzReadCoin = data.shareNews.readCoin AppConfig.wzReadCoin = data.shareNews.readCoin
} }
// 更新权重 // 设置视频权重
initAdWeight(data) UserWeight.initAdWeight(data)
initExpress(data.flowAdRules) initExpress(data.flowAdRules)
AppConfig.app_black_name = data.userRiskApps.userRiskAppName AppConfig.app_black_name = data.userRiskApps.userRiskAppName
AppConfig.app_black_pkg = data.userRiskApps.userRiskAppPkg AppConfig.app_black_pkg = data.userRiskApps.userRiskAppPkg
...@@ -1120,7 +1120,10 @@ class MyFragment : BaseFragment(), ...@@ -1120,7 +1120,10 @@ class MyFragment : BaseFragment(),
* 获取激励视频 * 获取激励视频
*/ */
private fun awardVideo(coin: Int, carrierType: String) { private fun awardVideo(coin: Int, carrierType: String) {
if (videoAdingManager.videoFinishFlag) { if (AppConfig.isVideoSleep) {
showToast("加载失败,请稍后重试。")
return
} else if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧") showToast("今日视频已看完,请明天再来吧")
return return
} }
...@@ -1147,7 +1150,7 @@ class MyFragment : BaseFragment(), ...@@ -1147,7 +1150,7 @@ class MyFragment : BaseFragment(),
override fun videoAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++ loadVideoFailCount++
if (loadVideoFailCount >= 2) { if (loadVideoFailCount >= 3) {
hideLoading() hideLoading()
showToast("加载失败,请稍后重试!") showToast("加载失败,请稍后重试!")
} else { } else {
...@@ -1273,48 +1276,6 @@ class MyFragment : BaseFragment(), ...@@ -1273,48 +1276,6 @@ class MyFragment : BaseFragment(),
mainMyAdapter?.setOnItemChildClickListener(this) mainMyAdapter?.setOnItemChildClickListener(this)
} }
/**
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
videoAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate,
data.vedioRules.rtA_VEDIO.rate
)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"rtaWeight:${data.vedioRules.rtA_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate}"
)
// 广告视频数
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
AppConfig.rtaVideoAdCount = data.vedioRules.rtA_VEDIO.surplus
AppConfig.csjFullVideoAdCount = data.vedioRules.csjfulL_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount} " +
"rtaCount:${AppConfig.rtaVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount}"
)
}
private fun initExpress(flowAdRules: FlowAdRulesBean) { private fun initExpress(flowAdRules: FlowAdRulesBean) {
PreLoadExpressManager.init(flowAdRules.csj, flowAdRules.ylh, flowAdRules.ks) PreLoadExpressManager.init(flowAdRules.csj, flowAdRules.ylh, flowAdRules.ks)
} }
......
...@@ -18,6 +18,7 @@ import com.mints.goodmoney.R ...@@ -18,6 +18,7 @@ import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.MokuManager import com.mints.goodmoney.manager.MokuManager
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.manager.UserManager import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.ClickTurnBean import com.mints.goodmoney.mvp.model.ClickTurnBean
import com.mints.goodmoney.mvp.model.TurnBean import com.mints.goodmoney.mvp.model.TurnBean
...@@ -129,6 +130,8 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -129,6 +130,8 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
} }
override fun getTurnTableSuc(data: TurnBean) { override fun getTurnTableSuc(data: TurnBean) {
TrackManager.getInstance().getAdWeight()
if (AppConfig.fragmentClickFlag != Constant.FRAGMENT_CLICK_THREE || if (AppConfig.fragmentClickFlag != Constant.FRAGMENT_CLICK_THREE ||
activity == null || requireActivity().isFinishing) { activity == null || requireActivity().isFinishing) {
return return
......
...@@ -108,7 +108,7 @@ class DrawcashVideoDialog(activity: Activity) : ...@@ -108,7 +108,7 @@ class DrawcashVideoDialog(activity: Activity) :
override fun videoAdingListenerFail(adType: String) { override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++ loadVideoFailCount++
if (loadVideoFailCount >= 2) { if (loadVideoFailCount >= 3) {
ToastUtil.show(activity, "加载超时,请休息一下") ToastUtil.show(activity, "加载超时,请休息一下")
} else { } else {
loadVideo(videoAdingManager, bean, false) loadVideo(videoAdingManager, bean, false)
......
package com.mints.goodmoney.utils;
import android.content.Context;
import android.view.accessibility.AccessibilityManager;
import com.mints.goodmoney.MintsApplication;
/**
* 无障碍服务
*/
public class AccessibilityUtils {
/**
* 判断用户是否开启无障碍服务
*
* @return 0-未开启无障碍功能
* @throws RuntimeException
*/
public static int isAccessibilityEnabled() {
try {
// 检查AccessibilityService是否开启
AccessibilityManager am = (AccessibilityManager) MintsApplication.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
boolean isAccessibilityEnabled_flag = am.isEnabled();
return isAccessibilityEnabled_flag ? 1 : 0;
} catch (Exception e) {
e.printStackTrace();
}
return 0;
// boolean isExploreByTouchEnabled_flag = false;
//
// // 检查无障碍服务是否以语音播报的方式开启
// isExploreByTouchEnabled_flag = isScreenReaderActive(context);
//
// return (isAccessibilityEnabled_flag && isExploreByTouchEnabled_flag);
}
}
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