|
@@ -1,7 +1,8 @@
|
|
|
package com.sheep.gamegroup.statistics;
|
|
package com.sheep.gamegroup.statistics;
|
|
|
|
|
|
|
|
|
|
+import android.text.TextUtils;
|
|
|
|
|
+
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.googlecode.protobuf.format.util.TextUtils;
|
|
|
|
|
import com.sheep.gamegroup.model.api.ApiService;
|
|
import com.sheep.gamegroup.model.api.ApiService;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
@@ -48,26 +49,24 @@ public class AppStatistics {
|
|
|
*/
|
|
*/
|
|
|
synchronized public void sendDataToServer(int type,int subType,String subString){
|
|
synchronized public void sendDataToServer(int type,int subType,String subString){
|
|
|
String openid = PreferenceUtils.getPrefString(SheepApp.mContext, UMConfigUtils.LOGIN_OPENID,"");
|
|
String openid = PreferenceUtils.getPrefString(SheepApp.mContext, UMConfigUtils.LOGIN_OPENID,"");
|
|
|
- int uid = android.text.TextUtils.isEmpty(openid)?0:Integer.valueOf(openid);
|
|
|
|
|
|
|
+ //openid要转换成int类型
|
|
|
|
|
+ int uid = 0;
|
|
|
|
|
+ if(!TextUtils.isEmpty(openid)){
|
|
|
|
|
+ uid = Integer.parseInt(openid);
|
|
|
|
|
+ }
|
|
|
String deviceId = DeviceUtil.getDeviceId(SheepApp.mContext);
|
|
String deviceId = DeviceUtil.getDeviceId(SheepApp.mContext);
|
|
|
ApiService apiService =SheepApp.getInstance().getNetComponent().getApiService();
|
|
ApiService apiService =SheepApp.getInstance().getNetComponent().getApiService();
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
- //openid要转换成int类型
|
|
|
|
|
jsonObject.put("uid",uid);
|
|
jsonObject.put("uid",uid);
|
|
|
jsonObject.put("type",type);
|
|
jsonObject.put("type",type);
|
|
|
jsonObject.put("subtype",subType);
|
|
jsonObject.put("subtype",subType);
|
|
|
jsonObject.put("substring",subString);
|
|
jsonObject.put("substring",subString);
|
|
|
-//System.out.println("sendDataToServer --> " + jsonObject.toString());
|
|
|
|
|
apiService.appEventTracking(jsonObject).subscribeOn(Schedulers.io())
|
|
apiService.appEventTracking(jsonObject).subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(new Subscriber<BaseMessage>() {
|
|
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
|
|
|
@Override
|
|
@Override
|
|
|
- public void onCompleted() {
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onError(Throwable throwable) {
|
|
|
|
|
- System.out.println("sendDataToServer onError-->>"+throwable.toString());
|
|
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ System.out.println("sendDataToServer onError-->>"+baseMessage.toString());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -76,4 +75,5 @@ public class AppStatistics {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|