Sfoglia il codice sorgente

添加新的id event统计

zengjiebin 7 anni fa
parent
commit
d73b346659

+ 15 - 1
app/build.gradle

@@ -65,7 +65,7 @@ android {
     }
     productFlavors {
         sheeptest {
-            applicationId "com.sheep.jiuyan.samllsheep.test"
+            applicationId "com.sheep.jiuyan.samllsheep"
             manifestPlaceholders = [DUANDUAN_GRAPH     : "sheeptest",
                                     DUANDUAN_DATASHARE : "sheeptest",
                                     jpush_appkey       : "4fea09bdbf9661a9689ee306",
@@ -78,6 +78,20 @@ android {
             buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
             signingConfig signingConfigs.config
         }
+        sheeptestjiguang {
+            applicationId "com.sheep.jiuyan.samllsheep.test"
+            manifestPlaceholders = [DUANDUAN_GRAPH     : "sheeptestjiguang",
+                                    DUANDUAN_DATASHARE : "sheeptestjiguang",
+                                    jpush_appkey       : "4fea09bdbf9661a9689ee306",
+                                    umeng_app_key       : "5ab0a1da8f4a9d742900035f"
+            ]
+            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptestjiguang"'
+            buildConfigField "String", "DUANDUAN_GRAPH", '"sheeptestjiguang"'
+            buildConfigField "String", "app_name", '"小绵羊测试"'
+            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
+            buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
+            signingConfig signingConfigs.config
+        }
         sheep {
             applicationId "com.sheep.jiuyan.samllsheep"
             manifestPlaceholders = [DUANDUAN_GRAPH     : "sheep",

+ 6 - 1
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -66,6 +66,7 @@ import com.sheep.gamegroup.util.AppUtil;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.ImageGlarryDrawable;
 import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.gamegroup.util.MyGridview;
 import com.sheep.gamegroup.util.MyListview;
@@ -897,8 +898,12 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
         mImageGlarryStr.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                SlideshowEty clickedGameObj = slideshowEtyLists.get(position);
+                SlideshowEty clickedGameObj = ListUtil.getIndex(slideshowEtyLists, position);
+                if(clickedGameObj == null){
+                    return;
+                }
                 UMConfigUtils.onEvent(UMConfigUtils.Event.BANNER_CLICK_HORIZONTAL);
+                UMConfigUtils.IdEvent.BANNER.commit(clickedGameObj.getId());
                 switch (clickedGameObj.getType()) {// 0,类型 1跳转试玩赚钱、2单个任务详情、3信用卡办理、4 H5页面、5 微信二维码任务
                     case 1:
                         Jump2View.getInstance()

+ 3 - 3
app/src/main/java/com/kfzs/duanduan/utils/ApkUtils.java

@@ -297,10 +297,10 @@ public class ApkUtils {
             return "0.0.0";
         }
     }
-    public static PackageInfo getPackageInfo(Context context) {
+    public static PackageInfo getPackageInfo(String packageName) {
         try {
-            PackageManager pm = context.getPackageManager();
-            PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
+            PackageManager pm = SheepApp.getInstance().getPackageManager();
+            PackageInfo pi = pm.getPackageInfo(packageName, 0);
             return pi;
         } catch (Exception e) {
             return null;

+ 7 - 0
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -559,4 +559,11 @@ public interface ApiService {
      */
     @GET("app/version/new_version")
     Observable<BaseMessage> getNewVersion(@Query("type") int type);
+
+    /**
+     * 用户统计分析--id事件
+     */
+    @POST("app/event_tracking/userBehavior")
+    Observable<BaseMessage> commitIdEvent(@Body JSONObject jsonObject);
+
 }

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/HomeListEntity.java

@@ -9,7 +9,7 @@ public class HomeListEntity {
     private String CreateTime;//	integer ($int64)创建时间,时间戳
     private String Desc;//	string描述
     private String Icon;//	string图标地址
-    private String Id;//	integer ($int64)
+    private int Id;//	integer ($int64)
     private String Jump;//	string跳转(h5填跳转地址,原生:1试玩赚钱,2邀请赚钱,3躺着赚钱,4办卡赚钱)
     private String Order;//	integer ($int64)排序,默认99,越小越靠前
     private String Title;//	string标题
@@ -52,11 +52,11 @@ public class HomeListEntity {
         Icon = icon;
     }
 
-    public String getId() {
+    public int getId() {
         return Id;
     }
 
-    public void setId(String id) {
+    public void setId(int id) {
         Id = id;
     }
 

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/SlideshowEty.java

@@ -9,7 +9,7 @@ public class SlideshowEty {
     
     private String CreateTime;// 0,
             private String Ext;// 扩展字段 跳转任务就是任务id 跳转H5就是url地址
-            private String Id;// 0,
+            private int Id;// 0,
             private int IsDisplay;// 0,
             private int Platform;// 0,平台 1:android 2:ios
             private int Type = 1;// 0,类型 1跳转试玩赚钱、2单个任务详情、3信用卡办理、4 H5页面
@@ -51,11 +51,11 @@ public class SlideshowEty {
         Ext = ext;
     }
 
-    public String getId() {
+    public int getId() {
         return Id;
     }
 
-    public void setId(String id) {
+    public void setId(int id) {
         Id = id;
     }
 

+ 3 - 1
app/src/main/java/com/sheep/gamegroup/model/util/AddPuplicParameIntercept.java

@@ -4,6 +4,7 @@ import android.text.TextUtils;
 
 import com.sheep.gamegroup.model.api.BaseMessageConverter;
 import com.sheep.gamegroup.util.DeviceUtil;
+import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
@@ -51,7 +52,7 @@ public class AddPuplicParameIntercept implements Interceptor {
                 .newBuilder();
         String method = oldRequest.method();
         RequestBody body = oldRequest.body();
-        if (BuildConfig.XXTEA_ENCRYPT && (method.equals("POST") || method.equals("PUT"))) {//张伟服务器不用加密
+        if (BuildConfig.XXTEA_ENCRYPT && (method.equals("POST") || method.equals("PUT"))) {
             RequestBody requestBody = oldRequest.body();
             if (requestBody instanceof FormBody) {
             } else if (requestBody != null){
@@ -64,6 +65,7 @@ public class AddPuplicParameIntercept implements Interceptor {
                 }
                 String oldParamsJson = buffer.readUtf8();
                 String newJsonParams = BaseMessageConverter.encrypt(oldParamsJson);
+                LogUtil.println("加密", oldRequest, oldParamsJson, newJsonParams);
                 if(!TextUtils.isEmpty(newJsonParams))
                     body = RequestBody.create(requestBody.contentType(), newJsonParams);
             }

+ 22 - 9
app/src/main/java/com/sheep/gamegroup/util/ConnectAddress.java

@@ -51,6 +51,16 @@ public enum ConnectAddress {
         public String getName() {
             return "张伟";
         }
+    },sheeplishuyang {
+
+        @Override
+        public String getAppUrl() {
+            return "http://10.8.210.170:8080/";
+        }
+        @Override
+        public String getName() {
+            return "李抒阳";
+        }
     },sheeptest {
 
         @Override
@@ -72,16 +82,7 @@ public enum ConnectAddress {
         public String getName() {
             return "正式服";
         }
-    },sheeplishuyang {
 
-        @Override
-        public String getAppUrl() {
-            return "http://10.8.210.170:8080/";
-        }
-        @Override
-        public String getName() {
-            return "李抒阳";
-        }
     };
     public abstract String getAppUrl();
 
@@ -104,4 +105,16 @@ public enum ConnectAddress {
     public String getWorldCupUrl(){
         return "http://10.8.210.172:8080/#/";
     }
+
+    public int getVersionType() {
+        switch (BuildConfig.FLAVOR){
+            case "sheep":
+                return 1;
+            case "sheeptestjiguang":
+                return 2;
+            case "sheeptest":
+            default:
+                return 0;
+        }
+    }
 }

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java

@@ -323,7 +323,7 @@ public class SysAppUtil {
      * @param ignoreMd5 用户手动时传null;进入主要界面时不要传null,传保存的忽略md5值,为空字符串时传""
      */
     public static void showVersionInfo(final Activity activity, final String ignoreMd5) {
-        SheepApp.getInstance().getNetComponent().getApiService().getNewVersion(TestUtil.isSheep() ? 1 : 0)
+        SheepApp.getInstance().getNetComponent().getApiService().getNewVersion(SheepApp.getInstance().getConnectAddress().getVersionType())
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
@@ -339,7 +339,7 @@ public class SysAppUtil {
                             LogUtil.println("showVersionInfo", "忽略", ignoreMd5, version.getVersion_name());
                             return;
                         }
-                        PackageInfo packageInfo = ApkUtils.getPackageInfo(SheepApp.getInstance());
+                        PackageInfo packageInfo = ApkUtils.getPackageInfo(SheepApp.getInstance().getPackageName());
                         if(packageInfo == null || TextUtils.isEmpty(packageInfo.applicationInfo.sourceDir)){
 //                            G.showToast(R.string.unknown_error);
                             Beta.checkUpgrade();//检查版本号

+ 7 - 7
app/src/main/java/com/sheep/gamegroup/util/TestUtil.java

@@ -181,19 +181,19 @@ public class TestUtil {
     }
     public static void testChangeUser(final Activity activity, TextView test_change) {
         if (isTest()) {
-            final List<LoginUser> loginUserList = MyDbManager.getInstance().getAllLoginUser();
-            if(ListUtil.isEmpty(loginUserList)){
-//                G.showToast("无用户");
-                return;
-            }
-            final List<Object> list = ListUtil.emptyList();
-            ListUtil.addAll(list, loginUserList);
 
             test_change.setVisibility(View.VISIBLE);
             test_change.setText("切换账号");
             test_change.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View view) {
+                    final List<LoginUser> loginUserList = MyDbManager.getInstance().getAllLoginUser();
+                    if(ListUtil.isEmpty(loginUserList)){
+//                G.showToast("无用户");
+                        return;
+                    }
+                    final List<Object> list = ListUtil.emptyList();
+                    ListUtil.addAll(list, loginUserList);
                     AlertDialog dialog = new AlertDialog.Builder(activity).setTitle("选择要登录的账号")
                             .setAdapter(new ArrayAdapter<>(activity, android.R.layout.simple_list_item_1, list),  new DialogInterface.OnClickListener() {
 

+ 34 - 0
app/src/main/java/com/sheep/gamegroup/util/UMConfigUtils.java

@@ -4,6 +4,9 @@ package com.sheep.gamegroup.util;
 import android.content.Context;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.statistics.AppStatistics;
 import com.sheep.gamegroup.statistics.AppStatisticsConfig;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -11,6 +14,9 @@ import com.sheep.jiuyan.samllsheep.SheepApp;
 
 import java.util.Map;
 
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
 /**
  * Created by zhanghai on 2018/3/30.
  */
@@ -96,6 +102,34 @@ public class UMConfigUtils {
         }
     }
 
+    public enum IdEvent{
+        HOME_LIST,//id 1 首页功能列表
+        BANNER(),//id 2 首页轮播图
+        TASK(),//id 3   任务列表
+        ;
+        private int getType(){
+            return ordinal()+1;
+        }
+        synchronized public void commit(int click_id){
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("click_id", click_id);
+            jsonObject.put("type", getType());
+            SheepApp.getInstance().getNetComponent().getApiService().commitIdEvent(jsonObject)
+                            .subscribeOn(Schedulers.io())
+                            .observeOn(AndroidSchedulers.mainThread())
+                            .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                                @Override
+                                public void onNext(BaseMessage baseMessage) {
+                                    LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
+                                }
+
+                                @Override
+                                public void onError(BaseMessage baseMessage) {
+                                    LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
+                                }
+                            });
+        }
+    }
     public static class Source{
         public static final String QQ = "QQ";
         public static final String WECHAT = "wechat";

+ 3 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpHomeListGrideview.java

@@ -13,6 +13,8 @@ import com.bumptech.glide.Glide;
 import com.bumptech.glide.request.RequestOptions;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
 import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.utils.G;
@@ -80,6 +82,7 @@ public class AdpHomeListGrideview extends BaseAdapter {
         convertView.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
+                UMConfigUtils.IdEvent.HOME_LIST.commit(entity.getId());
                 CommonUtil.getInstance()
                         .goWhere(context, entity);
             }

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpHomeListListview.java

@@ -12,6 +12,7 @@ import com.bumptech.glide.Glide;
 import com.bumptech.glide.request.RequestOptions;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
 import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.R;
 
@@ -82,6 +83,7 @@ public class AdpHomeListListview extends BaseAdapter {
         convertView.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
+                UMConfigUtils.IdEvent.HOME_LIST.commit(entity.getId());
                 CommonUtil.getInstance()
                         .goWhere(context, entity);
             }

+ 13 - 2
app/src/main/java/com/sheep/gamegroup/view/adapter/TryMakeMoneyAdp.java

@@ -251,9 +251,12 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                 viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
-                        if(!ListUtil.hasIndex(etyList, i)){
+                        OrienteeringDetail item = ListUtil.getIndex(etyList, i);
+                        if(item == null){
                             return;
                         }
+                        UMConfigUtils.IdEvent.TASK.commit(item.getId());
+
                         Jump2View.getInstance().goTaskDetailView(context,  etyList.get(i).getTask_id(), etyList.get(i).getGame_id());
                     }
                 });
@@ -406,9 +409,12 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                 viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
-                        if(!ListUtil.hasIndex(etyList, i)){
+                        TaskReleaseEty item = ListUtil.getIndex(etyList, i);
+                        if(item == null){
                             return;
                         }
+                        UMConfigUtils.IdEvent.TASK.commit(item.getId());
+
                         TaskEty taskEty = etyList.get(i).getTask();
                         taskEty.setRunTask(0);
                         taskEty.setBonus(etyList.get(i).getBonus());
@@ -528,6 +534,11 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                 viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
+                        TaskAcceptedEty item = ListUtil.getIndex(etyList, i);
+                        if(item == null){
+                            return;
+                        }
+                        UMConfigUtils.IdEvent.TASK.commit(item.getId());
 
                         TaskEty taskEty = etyList.get(i).getRelease_task().getTask();
                         taskEty.setRunTask(1);

+ 3 - 1
app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

@@ -92,7 +92,9 @@ public class SheepApp extends BaseApplication {
                 flavor = BuildConfig.FLAVOR;
             }
             connectAddress = ConnectAddress.valueOf(flavor);
-
+            if(connectAddress == null){
+                connectAddress = ConnectAddress.sheep;
+            }
             registerActivityLifecycleCallbacks(activityLifecycleCallbacks);
             initGoble();
             initNet();

+ 1 - 0
app/src/main/res/layout/login_act_layout.xml

@@ -24,6 +24,7 @@
                 android:id="@+id/tel_agreement_cb"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
+                android:checked="true"
                 android:scaleX="1.4"
                 android:scaleY="1.4"
                 android:button="@drawable/drawable_selector_check"/>

+ 2 - 2
app/src/main/res/values/strings.xml

@@ -23,10 +23,10 @@
     <string name="total_money_lable">绵羊币总余额:</string>
     <string name="total_money">%s元</string>
     <string name="task_reward">任务奖励余额:%s元</string>
-    <string name="agent_extract">推广提成:%s元</string>
+    <string name="agent_extract">推广提成余额:%s元</string>
     <string name="recharge_amount">充值余额:%s元</string>
     <string name="available_amount">可提现金额:%s元</string>
-    <string name="dingxiang_amount">定向货币:%s元</string>
+    <string name="dingxiang_amount">定向货币余额:%s元</string>
 
     <string name="rechargeq_amount">当前绵羊币余额:%s元</string>
 

+ 3 - 0
app/src/sheeptestjiguang/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">小绵羊极光</string>
+</resources>