更新优化
This commit is contained in:
@@ -5,14 +5,18 @@ import static cn.shangyu.gdxzExpert.utils.Constant.uniapp_mp_appid;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.app.Application.ActivityLifecycleCallbacks;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Process;
|
||||
import android.os.StrictMode;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.multidex.MultiDex;
|
||||
@@ -51,18 +55,25 @@ import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InvalidClassException;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cn.shangyu.gdxzExpert.activity.PayActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.PayCourseActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.PublicConsultationActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.UniappPayCourseActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.UniappPayPointActivity;
|
||||
import cn.shangyu.gdxzExpert.polyvplayer.CourseDetailPolyvPlayerActivity;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import io.dcloud.feature.sdk.Interface.IUniMP;
|
||||
import io.dcloud.feature.sdk.DCSDKInitConfig;
|
||||
import io.dcloud.feature.sdk.DCUniMPSDK;
|
||||
@@ -94,6 +105,9 @@ import cn.shangyu.gdxzExpert.netease.mixpush.DemoMixPushMessageHandler;
|
||||
import cn.shangyu.gdxzExpert.netease.mixpush.DemoPushContentProvider;
|
||||
import cn.shangyu.gdxzExpert.netease.session.SessionHelper;
|
||||
import cn.shangyu.gdxzExpert.polyvplayer.util.PolyvStorageUtils;
|
||||
import cn.shangyu.gdxzExpert.report.CommUtil;
|
||||
import cn.shangyu.gdxzExpert.report.ReportService;
|
||||
import cn.shangyu.gdxzExpert.report.reportBean;
|
||||
import cn.shangyu.gdxzExpert.umeng.PushHelper;
|
||||
import cn.shangyu.gdxzExpert.utils.Constant;
|
||||
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
||||
@@ -295,6 +309,43 @@ public class BaseApplication extends Application {
|
||||
// CrashHandler.getInstance().init(getApplicationContext());
|
||||
// }
|
||||
|
||||
// 注册Activity生命周期回调,用于跟踪当前resumed的Activity
|
||||
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed(Activity activity) {
|
||||
// 当Activity resumed时,更新当前Activity
|
||||
AppManager.setCurrentResumedActivity(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(Activity activity) {
|
||||
// 当Activity paused时,如果这是当前resumed的Activity,则清空
|
||||
// 这样下一个Activity的onResumed会更新为新的Activity
|
||||
AppManager.clearCurrentResumedActivity(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
// 当Activity销毁时,如果这是当前resumed的Activity,则清空
|
||||
AppManager.clearCurrentResumedActivity(activity);
|
||||
}
|
||||
});
|
||||
|
||||
boolean isFirstRun=this.getSharedPreferences("share",MODE_PRIVATE).getBoolean("isFirstRun", true);
|
||||
if(!isFirstRun)//隐私权限
|
||||
@@ -325,11 +376,18 @@ public class BaseApplication extends Application {
|
||||
DCUniMPSDK.getInstance().setOnUniMPEventCallBack(new IOnUniMPEventCallBack() {
|
||||
@Override
|
||||
public void onUniMPEventReceive(String appid, String event, Object data, DCUniMPJSCallback callback) {
|
||||
LogUtil.i("onUniMPEventReceive appid="+appid);
|
||||
LogUtil.i("onUniMPEventReceive event="+event);
|
||||
LogUtil.i("onUniMPEventReceive data="+data);
|
||||
|
||||
Log.d("onUniMPEventReceive","appid="+appid);
|
||||
Log.d("onUniMPEventReceive","event="+event);
|
||||
Log.d("onUniMPEventReceive","data="+data);
|
||||
|
||||
if(appid == null){
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// 将参数声明为final,以便在内部类中使用
|
||||
final String finalEvent = event;
|
||||
final DCUniMPJSCallback finalCallback = callback;
|
||||
|
||||
// 解析 data
|
||||
String msgValue = null;
|
||||
@@ -343,79 +401,48 @@ public class BaseApplication extends Application {
|
||||
JSONObject jsonObject = new JSONObject(data.toString());
|
||||
msgValue = jsonObject.getString("msg");
|
||||
}
|
||||
final String finalMsgValue = msgValue;
|
||||
|
||||
// payPonitPage 特殊处理:不再依赖 currentActivity,直接在 handleUniMPEvent 中用 Application 启动页面
|
||||
if ("payPonitPage".equals(finalEvent)) {
|
||||
handleUniMPEvent(null, finalEvent, finalMsgValue, finalCallback);
|
||||
return;
|
||||
}
|
||||
|
||||
Activity currentActivity = null;
|
||||
try {
|
||||
AppManager appManager = AppManager.getAppManager();
|
||||
if (appManager != null) {
|
||||
// 打印当前 activityStack 和 currentResumedActivity,方便排查 currentActivity 为空的问题
|
||||
AppManager.logActivityStackInternal("BaseApplication.onUniMPEventReceive");
|
||||
currentActivity = appManager.currentActivity();
|
||||
LogUtil.i("unimp", "BaseApplication 获取 currentActivity = "
|
||||
+ (currentActivity == null ? "null" : currentActivity.getClass().getSimpleName()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.e("获取当前Activity失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 如果获取不到Activity,直接返回失败结果(不再重试)
|
||||
if (currentActivity == null) {
|
||||
LogUtil.e("当前Activity为空,无法处理uniapp事件");
|
||||
LogUtil.w("当前Activity为空,无法处理uniapp事件: " + finalEvent);
|
||||
if (finalCallback != null) {
|
||||
try {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", 0);
|
||||
result.put("msg", "no_activity");
|
||||
result.put("event", finalEvent);
|
||||
finalCallback.invoke(result);
|
||||
} catch (Exception e) {
|
||||
LogUtil.e("回调 uniapp 活动获取失败结果时出错: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.equals("goTabbarPage")){
|
||||
// MainActivity 特有的逻辑,需要检查当前 Activity 是否是 MainActivity
|
||||
if (currentActivity instanceof cn.shangyu.gdxzExpert.activity.MainActivity) {
|
||||
cn.shangyu.gdxzExpert.activity.MainActivity mainActivity = (cn.shangyu.gdxzExpert.activity.MainActivity) currentActivity;
|
||||
if (currentActivity instanceof BaseActivity) {
|
||||
((BaseActivity) currentActivity).handleMainActivityEvent(mainActivity, event, msgValue);
|
||||
}
|
||||
}
|
||||
} else if (event.equals("getScanCodeAuth")){
|
||||
if (currentActivity instanceof BaseActivity) {
|
||||
((BaseActivity) currentActivity).handleScanCodeAuth(callback);
|
||||
}
|
||||
} else if(event.equals("checkToken")){
|
||||
if (currentActivity instanceof BaseActivity) {
|
||||
((BaseActivity) currentActivity).handleCheckToken(callback);
|
||||
}
|
||||
} else if(event.equals("getNewToken")){
|
||||
if (currentActivity instanceof BaseActivity) {
|
||||
((BaseActivity) currentActivity).handleCheckToken(callback);
|
||||
}
|
||||
} else if(event.equals("goHomeSearch")){
|
||||
if (currentActivity != null) {
|
||||
Intent intentv = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.PublicSearchActivity.class);
|
||||
|
||||
if (msgValue.equals("patientVideo")) {
|
||||
intentv.setType("patientVideo");
|
||||
}else if (msgValue.equals("meetVideo")) {
|
||||
intentv.setType("video");
|
||||
}else if (msgValue.equals("zhinan")) {
|
||||
intentv.setType("drug");
|
||||
}else if (msgValue.equals("ppt")) {
|
||||
intentv.setType("course");
|
||||
}
|
||||
currentActivity.startActivity(intentv);
|
||||
}
|
||||
} else if(event.equals("buyPointPage")) {
|
||||
if (currentActivity != null) {
|
||||
Intent intentv = new Intent(currentActivity, cn.shangyu.gdxzExpert.pointsmall.BuyIntegerActivty.class);
|
||||
currentActivity.startActivity(intentv);
|
||||
}
|
||||
} else if(event.equals("payPptPage")) {
|
||||
if (currentActivity != null) {
|
||||
LogUtil.i("payPptPage", msgValue);
|
||||
JSONObject jsonObject = new JSONObject(msgValue);
|
||||
|
||||
// 获取值
|
||||
Integer price = jsonObject.getInt("price");
|
||||
String providername = jsonObject.getString("providername");
|
||||
// String order_id = jsonObject.getString("order_id");
|
||||
String trade_no = jsonObject.getString("trade_no");
|
||||
Intent intent = new Intent(currentActivity, UniappPayCourseActivity.class);
|
||||
intent.putExtra("providername", providername);
|
||||
intent.putExtra("money", price + "");
|
||||
intent.putExtra("order_id", trade_no);
|
||||
currentActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
// 处理事件
|
||||
handleUniMPEvent(currentActivity, finalEvent, finalMsgValue, finalCallback);
|
||||
}catch (Exception e){
|
||||
LogUtil.e("处理uniapp事件时出错: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
@@ -423,6 +450,239 @@ public class BaseApplication extends Application {
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 安全地从JSONObject获取整数值(支持字符串和数字类型)
|
||||
*/
|
||||
private Integer getIntSafely(JSONObject jsonObject, String key) {
|
||||
try {
|
||||
if (jsonObject.has(key)) {
|
||||
Object value = jsonObject.get(key);
|
||||
if (value instanceof Integer) {
|
||||
return (Integer) value;
|
||||
} else if (value instanceof String) {
|
||||
return Integer.parseInt((String) value);
|
||||
} else if (value instanceof Number) {
|
||||
return ((Number) value).intValue();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.e("解析JSON字段 " + key + " 失败: " + e.getMessage());
|
||||
}
|
||||
return 0; // 默认返回0
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理uniapp事件的实际逻辑
|
||||
*/
|
||||
private void handleUniMPEvent(Activity currentActivity, String event, String msgValue, DCUniMPJSCallback callback) {
|
||||
try {
|
||||
if(event.equals("goTabbarPage")){
|
||||
// MainActivity 特有的逻辑,需要检查当前 Activity 是否是 MainActivity
|
||||
if (currentActivity instanceof cn.shangyu.gdxzExpert.activity.MainActivity) {
|
||||
cn.shangyu.gdxzExpert.activity.MainActivity mainActivity = (cn.shangyu.gdxzExpert.activity.MainActivity) currentActivity;
|
||||
if (currentActivity instanceof BaseActivity) {
|
||||
((BaseActivity) currentActivity).handleMainActivityEvent(mainActivity, event, msgValue);
|
||||
}
|
||||
}
|
||||
} else if (event.equals("getScanCodeAuth")){
|
||||
if (currentActivity instanceof BaseActivity) {
|
||||
((BaseActivity) currentActivity).handleScanCodeAuth(callback);
|
||||
}
|
||||
} else if(event.equals("checkToken")){
|
||||
if (currentActivity instanceof BaseActivity) {
|
||||
((BaseActivity) currentActivity).handleCheckToken(callback);
|
||||
}
|
||||
} else if(event.equals("getNewToken")){
|
||||
if (currentActivity instanceof BaseActivity) {
|
||||
((BaseActivity) currentActivity).handleCheckToken(callback);
|
||||
}
|
||||
} else if(event.equals("goHomeSearch")){
|
||||
if (currentActivity != null) {
|
||||
Intent intentv = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.PublicSearchActivity.class);
|
||||
|
||||
if (msgValue.equals("patientVideo")) {
|
||||
intentv.setType("patientVideo");
|
||||
}else if (msgValue.equals("meetVideo")) {
|
||||
intentv.setType("video");
|
||||
}else if (msgValue.equals("zhinan")) {
|
||||
intentv.setType("drug");
|
||||
}else if (msgValue.equals("ppt")) {
|
||||
intentv.setType("course");
|
||||
}else if (msgValue.equals("pointMall")) {
|
||||
intentv.setType("shopping");
|
||||
}else if (msgValue.equals("patientClass")) {
|
||||
intentv.setType("science");
|
||||
}else if (msgValue.equals("news")) {
|
||||
intentv.setType("news");
|
||||
}
|
||||
currentActivity.startActivity(intentv);
|
||||
}
|
||||
} else if(event.equals("buyPointPage")) {
|
||||
// 我的积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面
|
||||
Intent intentv = new Intent(BaseApplication.this, cn.shangyu.gdxzExpert.pointsmall.BuyIntegerActivty.class);
|
||||
intentv.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intentv);
|
||||
} else if(event.equals("payPptPage")) {
|
||||
if (currentActivity != null) {
|
||||
LogUtil.i("payPptPage", msgValue);
|
||||
JSONObject jsonObject = new JSONObject(msgValue);
|
||||
|
||||
// 获取值,安全地处理可能是字符串或数字的字段
|
||||
Integer price = getIntSafely(jsonObject, "price");
|
||||
String providername = jsonObject.optString("providername", "");
|
||||
String trade_no = jsonObject.optString("trade_no", "");
|
||||
Intent intent = new Intent(currentActivity, UniappPayCourseActivity.class);
|
||||
intent.putExtra("providername", providername);
|
||||
intent.putExtra("money", price + "");
|
||||
intent.putExtra("order_id", trade_no);
|
||||
currentActivity.startActivity(intent);
|
||||
}
|
||||
}else if(event.equals("payPonitPage")) {
|
||||
// 支付积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面
|
||||
LogUtil.i("payPointPage", msgValue);
|
||||
JSONObject jsonObject = new JSONObject(msgValue);
|
||||
// 获取值,安全地处理可能是字符串或数字的字段
|
||||
Integer price = getIntSafely(jsonObject, "price");
|
||||
Integer jifen = getIntSafely(jsonObject, "jifen");
|
||||
Integer product_id = getIntSafely(jsonObject, "product_id");
|
||||
String trade_no = jsonObject.optString("trade_no", "");
|
||||
String type = jsonObject.optString("type", "");
|
||||
|
||||
Intent intent = new Intent(BaseApplication.this, UniappPayPointActivity.class);
|
||||
intent.putExtra("money", price + "");
|
||||
intent.putExtra("order_id", trade_no);
|
||||
intent.putExtra("jifen", jifen + "");
|
||||
intent.putExtra("type", type + "");
|
||||
intent.putExtra("product_id", product_id + "");
|
||||
intent.setType("detail");
|
||||
// Application 上下文启动 Activity 必须加 NEW_TASK
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}else if(event.equals("goPatientMsg")) {
|
||||
Intent intent = null;
|
||||
if (currentActivity != null) {
|
||||
intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.MyPatientActivity.class);
|
||||
// 尽量复用栈中的 MyPatientActivity,并把新 Intent 分发到 onNewIntent
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.putExtra("open_patient_msg", true);
|
||||
currentActivity.startActivity(intent);
|
||||
} else {
|
||||
intent = new Intent(BaseApplication.this, cn.shangyu.gdxzExpert.activity.MyPatientActivity.class);
|
||||
intent.putExtra("open_patient_msg", true);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
}else if(event.equals("goSendMsg")) {
|
||||
if (currentActivity != null) {
|
||||
String patientUuid = msgValue;
|
||||
try {
|
||||
// 兼容 msg 为纯字符串或 JSON 字符串两种格式
|
||||
JSONObject jsonObject = new JSONObject(msgValue);
|
||||
patientUuid = jsonObject.optString("patientuuid", jsonObject.optString("uuid", msgValue));
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
if (!TextUtils.isEmpty(patientUuid)) {
|
||||
SessionHelper.startP2PSession(currentActivity, patientUuid.toLowerCase(), Constant.general, "");
|
||||
} else {
|
||||
LogUtil.w("goSendMsg 缺少 patientUuid, msgValue=" + msgValue);
|
||||
}
|
||||
}
|
||||
}else if(event.equals("goCourseDetail")) {
|
||||
String courseId = msgValue;
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(msgValue);
|
||||
courseId = jsonObject.optString("id",
|
||||
jsonObject.optString("excellentcourse_id", msgValue));
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
if (TextUtils.isEmpty(courseId)) {
|
||||
LogUtil.w("goCourseDetail 缺少课程id, msgValue=" + msgValue);
|
||||
return;
|
||||
}
|
||||
Intent intent = null;
|
||||
if (currentActivity != null) {
|
||||
intent = new Intent(currentActivity, CourseDetailPolyvPlayerActivity.class);
|
||||
intent.putExtra("excellentcourse_id", courseId);
|
||||
intent.putExtra("pinglun", "yes");
|
||||
intent.putExtra("from_unimp_go_course_detail", true);
|
||||
currentActivity.startActivity(intent);
|
||||
} else {
|
||||
intent = new Intent(BaseApplication.this, CourseDetailPolyvPlayerActivity.class);
|
||||
intent.putExtra("excellentcourse_id", courseId);
|
||||
intent.putExtra("pinglun", "yes");
|
||||
intent.putExtra("from_unimp_go_course_detail", true);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
}else if(event.equals("goGroupMessagePage")) {
|
||||
Intent intent = null;
|
||||
if (currentActivity != null) {
|
||||
intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.SendGroupMsgListActivity.class);
|
||||
currentActivity.startActivity(intent);
|
||||
} else {
|
||||
intent = new Intent(BaseApplication.this, cn.shangyu.gdxzExpert.activity.SendGroupMsgListActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
}else if(event.equals("portraitReport")){
|
||||
String event_nickname = "";
|
||||
String page_type = "";
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(msgValue);
|
||||
event_nickname = jsonObject.optString("event_nickname");
|
||||
page_type = jsonObject.optString("page_type");
|
||||
String resource_name = jsonObject.optString("resource_name");
|
||||
String resource_option = jsonObject.optString("resource_option");
|
||||
String belong = jsonObject.optString("belong");
|
||||
String number = jsonObject.optString("number");
|
||||
// String tags = jsonObject.optString("tags");
|
||||
String event_val = jsonObject.optString("event_val");
|
||||
String event_unit = jsonObject.optString("event_unit");
|
||||
if(event_nickname.equals("list_page")){
|
||||
// 执行列表页上报
|
||||
needreportPage(page_type);
|
||||
} else if (event_nickname.equals("magazine_donwload")) {
|
||||
needreportDown(resource_name,resource_option,belong,number,page_type);
|
||||
} else if (event_nickname.equals("detail_page")) {
|
||||
needreportDetail(page_type,resource_option,resource_name);
|
||||
} else if (event_nickname.equals("viorder_deo_download")) {
|
||||
needreportPay(event_nickname,event_val,event_unit,number,resource_name,resource_option,belong,page_type);
|
||||
} else if (event_nickname.equals("collect")) {
|
||||
needreportSome(event_nickname,resource_name,resource_option,page_type);
|
||||
} else if (event_nickname.equals("share")) {
|
||||
needreportSome(event_nickname,resource_name,resource_option,page_type);
|
||||
} else if (event_nickname.equals("like")) {
|
||||
needreportSome(event_nickname,resource_name,resource_option,page_type);
|
||||
} else if (event_nickname.equals("comment")) {
|
||||
needreportSome(event_nickname,resource_name,resource_option,page_type);
|
||||
} else if (event_nickname.equals("order_gdfile_download")) {
|
||||
needreportPays(event_nickname,event_val,event_unit,number,resource_name,resource_option,page_type);
|
||||
} else if (event_nickname.equals("magazine_donwload")) {
|
||||
needreportPays(event_nickname,event_val,event_unit,number,resource_name,resource_option,page_type);
|
||||
} else if (event_nickname.equals("boint_jifengood")) {
|
||||
needreportPay(event_nickname,event_val,event_unit,number,resource_name,resource_option,belong,page_type);
|
||||
} else if (event_nickname.equals("read_message")) {
|
||||
needreportSimple(event_nickname);
|
||||
} else if (event_nickname.equals("clear_message")) {
|
||||
needreportSimple(event_nickname);
|
||||
} else if (event_nickname.equals("signin")) {
|
||||
needreportSimple(event_nickname);
|
||||
} else if(event_nickname.equals("watch_video")){
|
||||
needreportPay(event_nickname,event_val,event_unit,number,resource_name,resource_option,belong,page_type);
|
||||
} else {
|
||||
needreportSimple(event_nickname);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
LogUtil.e("上报事件时出错: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
LogUtil.e("处理uniapp事件时出错: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void initYinsi()
|
||||
{
|
||||
OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||
@@ -887,4 +1147,158 @@ public class BaseApplication extends Application {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void needreportDown(String page,String tags,String bl,String nm,String pagetype)
|
||||
{
|
||||
List<reportBean> reportBeans=new ArrayList<>();
|
||||
reportBean rbens=new reportBean();
|
||||
rbens.setUser_id(Constant.Report_userId);
|
||||
rbens.setApp_key(Constant.Repotr_app_key);
|
||||
rbens.setOs(CommUtil.Repotr_os);
|
||||
rbens.setDevice(CommUtil.getDeviceName());
|
||||
rbens.setDevice_type(CommUtil.getDeviceType());
|
||||
rbens.setApp_version(CommUtil.getVersionName());
|
||||
rbens.setNetwork_carrier(CommUtil.getCarrierName);
|
||||
rbens.setNetwork_type(CommUtil.getCurrentNetworkType(UIUtils.getContext()));
|
||||
rbens.setEvent_nickname("magazine_donwload");
|
||||
rbens.setBelong(bl);
|
||||
rbens.setNumber(nm);
|
||||
rbens.setResource_name(page);
|
||||
rbens.setResource_option(tags+"");
|
||||
rbens.setPage_type(pagetype);
|
||||
rbens.setCreate_date(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
reportBeans.add(rbens);
|
||||
startReport(reportBeans);
|
||||
}
|
||||
public void needreportDetail(String page,String tags,String name)
|
||||
{
|
||||
List<reportBean> reportBeans=new ArrayList<>();
|
||||
reportBean rbens=new reportBean();
|
||||
rbens.setUser_id(Constant.Report_userId);
|
||||
rbens.setApp_key(Constant.Repotr_app_key);
|
||||
rbens.setOs(CommUtil.Repotr_os);
|
||||
rbens.setDevice(CommUtil.getDeviceName());
|
||||
rbens.setDevice_type(CommUtil.getDeviceType());
|
||||
rbens.setApp_version(CommUtil.getVersionName());
|
||||
rbens.setNetwork_carrier(CommUtil.getCarrierName);
|
||||
rbens.setNetwork_type(CommUtil.getCurrentNetworkType(UIUtils.getContext()));
|
||||
rbens.setEvent_nickname("detail_page");
|
||||
rbens.setPage_type(page);
|
||||
rbens.setResource_name(name);
|
||||
rbens.setPage_type(page);
|
||||
rbens.setResource_option(tags+"");
|
||||
rbens.setCreate_date(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
reportBeans.add(rbens);
|
||||
startReport(reportBeans);
|
||||
}
|
||||
public void needreportSome(String name,String page,String tags,String typepage)
|
||||
{
|
||||
List<reportBean> reportBeans=new ArrayList<>();
|
||||
reportBean rbens=new reportBean();
|
||||
rbens.setUser_id(Constant.Report_userId);
|
||||
rbens.setApp_key(Constant.Repotr_app_key);
|
||||
rbens.setOs(CommUtil.Repotr_os);
|
||||
rbens.setDevice(CommUtil.getDeviceName());
|
||||
rbens.setDevice_type(CommUtil.getDeviceType());
|
||||
rbens.setApp_version(CommUtil.getVersionName());
|
||||
rbens.setNetwork_carrier(CommUtil.getCarrierName);
|
||||
rbens.setNetwork_type(CommUtil.getCurrentNetworkType(UIUtils.getContext()));
|
||||
rbens.setEvent_nickname(name);
|
||||
rbens.setResource_name(page);
|
||||
rbens.setPage_type(typepage);
|
||||
rbens.setResource_option(tags+"");
|
||||
rbens.setCreate_date(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
reportBeans.add(rbens);
|
||||
startReport(reportBeans);
|
||||
}
|
||||
public void needreportSimple(String name)
|
||||
{
|
||||
List<reportBean> reportBeans=new ArrayList<>();
|
||||
reportBean rbens=new reportBean();
|
||||
rbens.setUser_id(Constant.Report_userId);
|
||||
rbens.setApp_key(Constant.Repotr_app_key);
|
||||
rbens.setOs(CommUtil.Repotr_os);
|
||||
rbens.setDevice(CommUtil.getDeviceName());
|
||||
rbens.setDevice_type(CommUtil.getDeviceType());
|
||||
rbens.setApp_version(CommUtil.getVersionName());
|
||||
rbens.setNetwork_carrier(CommUtil.getCarrierName);
|
||||
rbens.setNetwork_type(CommUtil.getCurrentNetworkType(UIUtils.getContext()));
|
||||
rbens.setEvent_nickname(name);
|
||||
rbens.setCreate_date(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
reportBeans.add(rbens);
|
||||
startReport(reportBeans);
|
||||
}
|
||||
|
||||
public void needreportPage(String page) {
|
||||
List<reportBean> reportBeans = new ArrayList<>();
|
||||
reportBean rbens = new reportBean();
|
||||
rbens.setUser_id(Constant.Report_userId);
|
||||
rbens.setApp_key(Constant.Repotr_app_key);
|
||||
rbens.setOs(CommUtil.Repotr_os);
|
||||
rbens.setDevice(CommUtil.getDeviceName());
|
||||
rbens.setDevice_type(CommUtil.getDeviceType());
|
||||
rbens.setApp_version(CommUtil.getVersionName());
|
||||
rbens.setNetwork_carrier(CommUtil.getCarrierName);
|
||||
rbens.setNetwork_type(CommUtil.getCurrentNetworkType(this));
|
||||
rbens.setEvent_nickname("list_page");
|
||||
rbens.setPage_type(page);
|
||||
rbens.setCreate_date(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
reportBeans.add(rbens);
|
||||
startReport(reportBeans);
|
||||
}
|
||||
public void needreportPays(String name, String ev,String ui,String num,String rs,String op,String page)
|
||||
{
|
||||
List<reportBean> reportBeans=new ArrayList<>();
|
||||
reportBean rbens=new reportBean();
|
||||
rbens.setUser_id(Constant.Report_userId);
|
||||
rbens.setApp_key(Constant.Repotr_app_key);
|
||||
rbens.setOs(CommUtil.Repotr_os);
|
||||
rbens.setDevice(CommUtil.getDeviceName());
|
||||
rbens.setDevice_type(CommUtil.getDeviceType());
|
||||
rbens.setApp_version(CommUtil.getVersionName());
|
||||
rbens.setNetwork_carrier(CommUtil.getCarrierName);
|
||||
rbens.setNetwork_type(CommUtil.getCurrentNetworkType(UIUtils.getContext()));
|
||||
rbens.setEvent_nickname(name);
|
||||
rbens.setEvent_val(ev);
|
||||
rbens.setEvent_unit(ui);
|
||||
rbens.setNumber(num);
|
||||
rbens.setResource_name(rs);
|
||||
rbens.setPage_type(page);
|
||||
rbens.setResource_option(op);
|
||||
rbens.setCreate_date(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
reportBeans.add(rbens);
|
||||
startReport(reportBeans);
|
||||
}
|
||||
public void needreportPay(String name, String ev,String ui,String num,String rs,String op,String bl,String pt)
|
||||
{
|
||||
List<reportBean> reportBeans=new ArrayList<>();
|
||||
reportBean rbens=new reportBean();
|
||||
rbens.setUser_id(Constant.Report_userId);
|
||||
rbens.setApp_key(Constant.Repotr_app_key);
|
||||
rbens.setOs(CommUtil.Repotr_os);
|
||||
rbens.setDevice(CommUtil.getDeviceName());
|
||||
rbens.setDevice_type(CommUtil.getDeviceType());
|
||||
rbens.setApp_version(CommUtil.getVersionName());
|
||||
rbens.setNetwork_carrier(CommUtil.getCarrierName);
|
||||
rbens.setNetwork_type(CommUtil.getCurrentNetworkType(UIUtils.getContext()));
|
||||
rbens.setEvent_nickname(name);
|
||||
rbens.setEvent_val(ev);
|
||||
rbens.setEvent_unit(ui);
|
||||
rbens.setNumber(num);
|
||||
rbens.setResource_name(rs);
|
||||
rbens.setResource_option(op);
|
||||
rbens.setBelong(bl);
|
||||
rbens.setPage_type(pt);
|
||||
rbens.setCreate_date(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
reportBeans.add(rbens);
|
||||
startReport(reportBeans);
|
||||
}
|
||||
public void startReport(List<reportBean> list) {
|
||||
Intent intent = new Intent(BaseApplication.this, ReportService.class);
|
||||
if (list != null) {
|
||||
intent.putExtra("report_list", (Serializable) list);
|
||||
}
|
||||
intent.putExtra("report_token", Constant.Repotr_token);
|
||||
startService(intent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user