This commit is contained in:
@ -6,8 +6,10 @@ import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.common.exposure.ExposureSource;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.entity.CommunityEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.SpecialColumn;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
import com.gh.gamecenter.qa.entity.Questions;
|
||||
@ -19,6 +21,9 @@ import com.lightgame.utils.Utils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by khy on 2/01/18.
|
||||
*/
|
||||
@ -49,7 +54,7 @@ public class LogUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
upload(object);
|
||||
uploadToCommunity(object);
|
||||
}
|
||||
|
||||
public static void uploadDevice(LunchType launchType) {
|
||||
@ -64,7 +69,7 @@ public class LogUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
upload(object);
|
||||
uploadToCommunity(object);
|
||||
}
|
||||
|
||||
public static void uploadAnswerReadTime(String tracers, int readTime, String answerId, Questions questions, String communityId, String CommunityName, SpecialColumn specialColumn) {
|
||||
@ -93,7 +98,7 @@ public class LogUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
upload(object);
|
||||
uploadToCommunity(object);
|
||||
}
|
||||
|
||||
public static void uploadQuestionReadTime(String tracers, int readTime, Questions questions, String communityId, String communityName, SpecialColumn specialColumn) {
|
||||
@ -121,7 +126,7 @@ public class LogUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
upload(object);
|
||||
uploadToCommunity(object);
|
||||
}
|
||||
|
||||
public static void uploadSearch(String searchKey) {
|
||||
@ -137,10 +142,9 @@ public class LogUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
upload(object);
|
||||
uploadToCommunity(object);
|
||||
}
|
||||
|
||||
|
||||
public static void communityRefresh(int dataCount, boolean manualRefresh) {
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
@ -153,7 +157,7 @@ public class LogUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
upload(object);
|
||||
uploadToCommunity(object);
|
||||
}
|
||||
|
||||
public static void login(String loginStep, String loginType, String entrance) {
|
||||
@ -167,7 +171,7 @@ public class LogUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
upload(object);
|
||||
uploadToCommunity(object);
|
||||
}
|
||||
|
||||
public static void qaAccess(String access, CommunityEntity communityEntity) {
|
||||
@ -181,10 +185,30 @@ public class LogUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
upload(object);
|
||||
uploadToCommunity(object);
|
||||
}
|
||||
|
||||
private static void upload(JSONObject object) {
|
||||
public static void logReservation(GameEntity gameEntity, List<ExposureSource> exposureSourceList) {
|
||||
JSONObject object = new JSONObject();
|
||||
|
||||
if (exposureSourceList == null) {
|
||||
exposureSourceList = new ArrayList<>();
|
||||
exposureSourceList.add(new ExposureSource("其它",""));
|
||||
}
|
||||
|
||||
try {
|
||||
object.put("source", GsonUtils.toJson(exposureSourceList));
|
||||
object.put("game_name", gameEntity.getName());
|
||||
object.put("game_id", gameEntity.getId());
|
||||
object.put("game_platform", gameEntity.getPlatform());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
uploadToReservation(object);
|
||||
}
|
||||
|
||||
private static void uploadToCommunity(JSONObject object) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Utils.log("LogUtils->" + object.toString());
|
||||
}
|
||||
@ -209,4 +233,28 @@ public class LogUtils {
|
||||
// 暂时除了曝光外的数据都是扔到 community 这个库的,要是不是这个这个库的话这里要改一下
|
||||
LogHubUtils.uploadLog(DeviceUtils.getIPAddress(context), object, "community");
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传数据到“预约”的 logStore
|
||||
*/
|
||||
private static void uploadToReservation(JSONObject object) {
|
||||
Context context = HaloApp.getInstance().getApplication();
|
||||
try {
|
||||
object.put("version", PackageUtils.getVersionName());
|
||||
object.put("channel", HaloApp.getInstance().getChannel());
|
||||
object.put("android_id", Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID));
|
||||
object.put("time", Utils.getTime(context));
|
||||
object.put("network", DeviceUtils.getNetwork(context));
|
||||
object.put("user_id", UserManager.getInstance().getUserId());
|
||||
object.put("device_system", android.os.Build.VERSION.RELEASE);
|
||||
object.put("device_model", android.os.Build. MODEL);
|
||||
object.put("imei", Util_System_Phone_State.getImei(HaloApp.getInstance()
|
||||
.getApplication()));
|
||||
object.put("G_ID", UserManager.getInstance().getDeviceId());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
LogHubUtils.uploadLog(DeviceUtils.getIPAddress(context), object, "appointment");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user