| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.JsonObject; |
| | | import com.lcjian.library.DeviceUuidFactory; |
| | | import com.lcjian.library.okhttp.OkHttpUtils; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.lcjian.library.util.common.PackageUtils2; |
| | |
| | | import com.loopj.android.http.ResponseHandlerInterface; |
| | | import com.loopj.android.http.SyncHttpClient; |
| | | import com.ut.device.UTDevice; |
| | | import com.video.youth.util.YouthUtil; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | |
| | | import okhttp3.Call; |
| | | import okhttp3.Callback; |
| | |
| | | private static AsyncHttpClient sortTimeAsyncHttpClient = new AsyncHttpClient(); |
| | | |
| | | static { |
| | | |
| | | mOkHttpClient = new OkHttpClient().newBuilder() |
| | | .connectTimeout(10 * 1000, TimeUnit.SECONDS)//设置超时时间 |
| | | .readTimeout(10 * 1000, TimeUnit.SECONDS)//设置读取超时时间 |
| | |
| | | } |
| | | |
| | | public static void getUid(Context context, String channel, String device, |
| | | String imei, String mac, String lat, String lng, |
| | | String imei, String lat, String lng, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "getUid"); |
| | | params.put("Device", device); |
| | | params.put("Imei", imei); |
| | | params.put("Mac", mac); |
| | | params.put("Lat", lat); |
| | | params.put("Lng", lng); |
| | | params.put("Channel", channel); |
| | |
| | | commonPost(context, BASE_URL + "user", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void phoneLogin(Context context, String phone, String code, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "phoneLogin"); |
| | | params.put("phone", phone); |
| | | params.put("code", code); |
| | | commonPost(context, BASE_URL + "user", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 电话号码绑定 |
| | | * |
| | |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "sendBindVerifyCode"); |
| | | params.put("loginUid", loginUid); |
| | | params.put("phone", phone); |
| | | commonPost(context, BASE_URL + "user", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void sendLoginVerifyCode(Context context, String phone, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "sendSMSCode"); |
| | | params.put("phone", phone); |
| | | commonPost(context, BASE_URL + "user", params, handler); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /*************事件上报**************/ |
| | | |
| | | public static void readNews(Context context, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | if (UserUtil.getUid(context) != null) |
| | | params.put("Uid", UserUtil.getUid(context)); |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | if (loginUid != null) { |
| | | params.put("LoginUid", loginUid); |
| | | } |
| | | commonPost(context, BASE_URL + "event/readNews", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void playDrawVideo(Context context,String source, String from, boolean finish, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | if (UserUtil.getUid(context) != null) |
| | | params.put("Uid", UserUtil.getUid(context)); |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | if (loginUid != null) { |
| | | params.put("LoginUid", loginUid); |
| | | } |
| | | params.put("From", from); |
| | | params.put("Source", source); |
| | | params.put("Finish", finish + ""); |
| | | commonPost(context, BASE_URL+ "event/playDrawVideo", params, handler); |
| | | } |
| | | |
| | | public static void readNovel(Context context, long duration,ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | if (UserUtil.getUid(context) != null) |
| | | params.put("Uid", UserUtil.getUid(context)); |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | if (loginUid != null) { |
| | | params.put("LoginUid", loginUid); |
| | | } |
| | | params.put("Duration", duration + ""); |
| | | commonPost(context, BASE_URL + "event/readNovel", params, handler); |
| | | } |
| | | |
| | | |
| | | public static LinkedHashMap<String, String> validateParams( |
| | | LinkedHashMap<String, String> params, Context context) { |
| | | params.put("System", "1"); |
| | | params.put("Platform", "Android"); |
| | | params.put("YouthMode", YouthUtil.isOpenYouthMode(context) + ""); |
| | | params.put("Channel", ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL")); |
| | | |
| | | //签名 |