FreeShare Geek v3.1.8290版本的 MD5 值为:492ca3ae4cdfab7e2d18d5e1b4428e75
以下内容为反编译后的 f.java 源代码,内容仅作参考
package com.aigestudio.chafer.d;
import android.content.Context;
import android.os.SystemClock;
import android.text.TextUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class f extends e implements g {
private static String g = null;
private final String d;
private final String e;
private final String f;
public f(Context context) {
super(context);
this.d = "http://" + a.e + ":8088/" + a.f975c + "/";
StringBuilder sb = new StringBuilder("?");
for (String str : this.b.keySet()) {
sb.append(str).append("=").append(this.b.get(str)).append("&");
}
this.e = sb.deleteCharAt(sb.length() - 1).toString();
this.f = c.b(context);
g = c.a(context);
}
private com.aigestudio.chafer.b.f a(String str) {
try {
JSONObject jSONObject = new JSONObject(str);
String optString = jSONObject.optString("token");
if (TextUtils.isEmpty(optString) || optString.equals("null")) {
return null;
}
com.aigestudio.chafer.b.f fVar = new com.aigestudio.chafer.b.f();
fVar.f962a = optString;
fVar.b = jSONObject.getString("type");
fVar.f963c = jSONObject.optString("lang");
fVar.d = jSONObject.optString("chanel_id");
return fVar;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
public synchronized String a(String str, Map<String, String> map) {
String str2;
str2 = this.d + str + this.e;
if (map != null && !map.isEmpty()) {
StringBuilder sb = new StringBuilder(str2);
sb.append("&");
for (String str3 : map.keySet()) {
sb.append(str3).append("=").append(map.get(str3)).append("&");
}
sb.deleteCharAt(sb.length() - 1);
str2 = sb.toString();
}
if (str2.contains(" ")) {
str2 = str2.replace(" ", JsonProperty.USE_DEFAULT_NAME).replace("#", JsonProperty.USE_DEFAULT_NAME);
}
return c(str2);
}
private synchronized String b(String str) {
return a(str, (Map<String, String>) null);
}
private synchronized String c(String str) {
?? r4;
HttpURLConnection httpURLConnection;
ByteArrayOutputStream byteArrayOutputStream;
?? valueOf;
int read;
ByteArrayOutputStream byteArrayOutputStream2 = null;
r2 = null;
byteArrayOutputStream2 = null;
r2 = null;
ByteArrayOutputStream byteArrayOutputStream3 = null;
?? r2 = 0;
synchronized (this) {
InputStream inputStream = null;
ByteArrayOutputStream byteArrayOutputStream4 = null;
try {
valueOf = (HttpURLConnection) new URL(str).openConnection();
try {
valueOf.setReadTimeout(5000);
valueOf.setConnectTimeout(5000);
valueOf.setRequestMethod("GET");
valueOf.setRequestProperty("accept", "*/*");
valueOf.setRequestProperty("connection", "Keep-Alive");
valueOf.setRequestProperty("User-Agent", this.f);
} catch (IOException e) {
byteArrayOutputStream = byteArrayOutputStream3;
httpURLConnection = valueOf;
r2 = byteArrayOutputStream3;
} catch (Throwable th) {
r4 = byteArrayOutputStream3;
httpURLConnection = valueOf;
th = th;
byteArrayOutputStream2 = byteArrayOutputStream3;
}
} catch (IOException e2) {
byteArrayOutputStream = null;
httpURLConnection = null;
} catch (Throwable th2) {
th = th2;
r4 = null;
httpURLConnection = null;
}
if (valueOf.getResponseCode() != 200) {
String valueOf2 = String.valueOf(500);
if (0 != 0) {
try {
byteArrayOutputStream4.close();
} catch (IOException e3) {
e3.printStackTrace();
}
}
if (0 != 0) {
inputStream.close();
}
if (valueOf != 0) {
valueOf.disconnect();
}
valueOf = valueOf2;
} else {
r4 = valueOf.getInputStream();
try {
ByteArrayOutputStream byteArrayOutputStream5 = new ByteArrayOutputStream();
try {
byte[] bArr = new byte[1024];
while (true) {
read = r4.read(bArr);
if (read == -1) {
break;
}
byteArrayOutputStream5.write(bArr, 0, read);
}
byteArrayOutputStream5.flush();
String byteArrayOutputStream6 = byteArrayOutputStream5.toString();
if (byteArrayOutputStream5 != null) {
try {
byteArrayOutputStream5.close();
} catch (IOException e4) {
e4.printStackTrace();
}
}
if (r4 != null) {
r4.close();
}
if (valueOf != 0) {
valueOf.disconnect();
}
valueOf = byteArrayOutputStream6;
byteArrayOutputStream3 = read;
} catch (IOException e5) {
byteArrayOutputStream = byteArrayOutputStream5;
r2 = r4;
httpURLConnection = valueOf;
try {
valueOf = String.valueOf(600);
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (IOException e6) {
e6.printStackTrace();
}
}
if (r2 != 0) {
r2.close();
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
return valueOf;
} catch (Throwable th3) {
th = th3;
r4 = r2;
byteArrayOutputStream2 = byteArrayOutputStream;
if (byteArrayOutputStream2 != null) {
try {
byteArrayOutputStream2.close();
} catch (IOException e7) {
e7.printStackTrace();
throw th;
}
}
if (r4 != null) {
r4.close();
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
throw th;
}
} catch (Throwable th4) {
byteArrayOutputStream2 = byteArrayOutputStream5;
httpURLConnection = valueOf;
th = th4;
if (byteArrayOutputStream2 != null) {
}
if (r4 != null) {
}
if (httpURLConnection != null) {
}
throw th;
}
} catch (IOException e8) {
byteArrayOutputStream = null;
httpURLConnection = valueOf;
r2 = r4;
} catch (Throwable th5) {
httpURLConnection = valueOf;
th = th5;
}
}
}
return valueOf;
}
public synchronized void d(String str) {
InputStream inputStream;
HttpURLConnection httpURLConnection;
ByteArrayOutputStream byteArrayOutputStream;
HttpURLConnection httpURLConnection2;
ByteArrayOutputStream byteArrayOutputStream2;
ByteArrayOutputStream byteArrayOutputStream3 = null;
byteArrayOutputStream3 = null;
r3 = null;
byteArrayOutputStream3 = null;
InputStream inputStream2 = null;
synchronized (this) {
InputStream inputStream3 = null;
ByteArrayOutputStream byteArrayOutputStream4 = null;
try {
httpURLConnection2 = (HttpURLConnection) new URL(str).openConnection();
try {
httpURLConnection2.setReadTimeout(5000);
httpURLConnection2.setConnectTimeout(5000);
httpURLConnection2.setRequestMethod("GET");
httpURLConnection2.setRequestProperty("accept", "*/*");
httpURLConnection2.setRequestProperty("connection", "Keep-Alive");
} catch (IOException e) {
httpURLConnection = httpURLConnection2;
e = e;
byteArrayOutputStream = null;
} catch (Throwable th) {
inputStream = null;
httpURLConnection = httpURLConnection2;
th = th;
}
} catch (IOException e2) {
e = e2;
byteArrayOutputStream = null;
httpURLConnection = null;
} catch (Throwable th2) {
th = th2;
inputStream = null;
httpURLConnection = null;
}
if (httpURLConnection2.getResponseCode() != 200) {
if (0 != 0) {
try {
byteArrayOutputStream4.close();
} catch (IOException e3) {
e3.printStackTrace();
}
}
if (0 != 0) {
inputStream3.close();
}
if (httpURLConnection2 != null) {
httpURLConnection2.disconnect();
}
} else {
inputStream = httpURLConnection2.getInputStream();
try {
byteArrayOutputStream2 = new ByteArrayOutputStream();
} catch (IOException e4) {
httpURLConnection = httpURLConnection2;
e = e4;
byteArrayOutputStream = null;
inputStream2 = inputStream;
} catch (Throwable th3) {
httpURLConnection = httpURLConnection2;
th = th3;
}
try {
byte[] bArr = new byte[1024];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
break;
} else {
byteArrayOutputStream2.write(bArr, 0, read);
}
}
byteArrayOutputStream2.flush();
if (byteArrayOutputStream2 != null) {
try {
byteArrayOutputStream2.close();
} catch (IOException e5) {
e5.printStackTrace();
}
}
if (inputStream != null) {
inputStream.close();
}
if (httpURLConnection2 != null) {
httpURLConnection2.disconnect();
}
} catch (IOException e6) {
inputStream2 = inputStream;
httpURLConnection = httpURLConnection2;
e = e6;
byteArrayOutputStream = byteArrayOutputStream2;
try {
e.printStackTrace();
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (IOException e7) {
e7.printStackTrace();
}
}
if (inputStream2 != null) {
inputStream2.close();
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
} catch (Throwable th4) {
th = th4;
inputStream = inputStream2;
byteArrayOutputStream3 = byteArrayOutputStream;
if (byteArrayOutputStream3 != null) {
try {
byteArrayOutputStream3.close();
} catch (IOException e8) {
e8.printStackTrace();
throw th;
}
}
if (inputStream != null) {
inputStream.close();
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
throw th;
}
} catch (Throwable th5) {
byteArrayOutputStream3 = byteArrayOutputStream2;
httpURLConnection = httpURLConnection2;
th = th5;
if (byteArrayOutputStream3 != null) {
}
if (inputStream != null) {
}
if (httpURLConnection != null) {
}
throw th;
}
}
}
}
public com.aigestudio.chafer.b.f a() {
com.aigestudio.chafer.b.f a2;
String e = d.a().e();
if (e != null && (a2 = a(e)) != null) {
return a2;
}
String b = b("get_msg.php");
try {
Integer.valueOf(b);
} catch (NumberFormatException e2) {
com.aigestudio.chafer.b.f a3 = a(b);
if (a3 != null) {
d.a().a(b);
d.a().b(a3.b);
return a3;
}
}
return null;
}
@Override
public void a(final b<List<com.aigestudio.chafer.b.e>> bVar) {
f980a.execute(new Runnable() {
@Override
public void run() {
com.aigestudio.chafer.b.f a2 = f.this.a();
int i = 0;
while (a2 == null && i < 3) {
a2 = f.this.a();
i++;
SystemClock.sleep(3000L);
}
if (a2 == null) {
f.this.a(bVar, 410);
return;
}
HashMap hashMap = new HashMap();
hashMap.put("token", a2.f962a);
hashMap.put("type", a2.b);
if (a2.d != null) {
hashMap.put("channel_id", a2.d);
}
if (a2.f963c != null) {
hashMap.put("lang_server", a2.f963c);
}
String a3 = f.this.a("get_category.php", hashMap);
try {
f.this.a(bVar, Integer.valueOf(a3).intValue());
} catch (NumberFormatException e) {
try {
JSONArray jSONArray = new JSONObject(a3).getJSONArray("list");
ArrayList arrayList = new ArrayList();
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
com.aigestudio.chafer.b.e eVar = new com.aigestudio.chafer.b.e();
JSONObject jSONObject = jSONArray.getJSONObject(i2);
eVar.f961a = jSONObject.getString("chanel_id");
eVar.b = jSONObject.getString("c_name");
arrayList.add(eVar);
}
f.this.a((b<b>) bVar, (b) arrayList);
} catch (JSONException e2) {
f.this.a(bVar, 411);
}
}
}
});
}
@Override
public void a(final String str, final int i, final boolean z, final b<List<com.aigestudio.chafer.b.a>> bVar) {
f980a.execute(new Runnable() {
@Override
public void run() {
JSONObject optJSONObject;
com.aigestudio.chafer.b.f a2 = f.this.a();
int i2 = 0;
while (a2 == null && i2 < 3) {
a2 = f.this.a();
i2++;
SystemClock.sleep(3000L);
}
if (a2 == null) {
f.this.a(bVar, 410);
return;
}
HashMap hashMap = new HashMap();
hashMap.put("token", a2.f962a);
hashMap.put("type", a2.b);
if (a2.d != null) {
hashMap.put("channel_id", a2.d);
}
if (a2.f963c != null) {
hashMap.put("lang_server", a2.f963c);
}
hashMap.put("chanel_id", str);
hashMap.put("page", String.valueOf(i));
hashMap.put("ad_index", String.valueOf(d.a().g(str)));
hashMap.put("min_behot_time", String.valueOf(d.a().c(str)));
hashMap.put("max_behot_time", String.valueOf(d.a().e(str)));
String a3 = f.this.a("get_list.php", hashMap);
try {
f.this.a(bVar, Integer.valueOf(a3).intValue());
} catch (NumberFormatException e) {
try {
ArrayList arrayList = new ArrayList();
JSONObject jSONObject = new JSONObject(a3);
String optString = jSONObject.optString("offer");
int optInt = jSONObject.optInt("ad_index");
if (i == 1 && z) {
com.aigestudio.chafer.b.a aVar = new com.aigestudio.chafer.b.a();
aVar.l = optInt;
ArrayList arrayList2 = new ArrayList();
JSONArray optJSONArray = jSONObject.optJSONArray("category");
if (optJSONArray != null) {
for (int i3 = 0; i3 < optJSONArray.length(); i3++) {
com.aigestudio.chafer.b.b bVar2 = new com.aigestudio.chafer.b.b();
JSONObject jSONObject2 = optJSONArray.getJSONObject(i3);
bVar2.b = jSONObject2.getString("icon");
bVar2.f956a = jSONObject2.getString("name");
bVar2.f957c = jSONObject2.getString("url");
bVar2.d = a.f974a[i3];
arrayList2.add(bVar2);
}
}
aVar.f954a = 99;
aVar.f955c = arrayList2;
arrayList.add(aVar);
}
JSONArray jSONArray = jSONObject.getJSONArray("articles");
for (int i4 = 0; i4 < jSONArray.length(); i4++) {
com.aigestudio.chafer.b.a aVar2 = new com.aigestudio.chafer.b.a();
aVar2.b = optString;
aVar2.l = optInt;
JSONObject jSONObject3 = jSONArray.getJSONObject(i4);
JSONArray optJSONArray2 = jSONObject3.optJSONArray("imgUrl");
if (optJSONArray2 != null) {
ArrayList arrayList3 = new ArrayList();
for (int i5 = 0; i5 < optJSONArray2.length(); i5++) {
arrayList3.add(optJSONArray2.getString(i5));
}
aVar2.d = arrayList3;
}
aVar2.e = jSONObject3.getString("title");
aVar2.f = jSONObject3.getString("source");
aVar2.g = jSONObject3.getString("pubtime");
aVar2.h = jSONObject3.getString("news_id");
aVar2.i = jSONObject3.getString("chanel_id");
aVar2.f954a = jSONObject3.getInt("type");
switch (aVar2.f954a) {
case -1:
aVar2.k = jSONObject3.optString("ad_pos");
aVar2.j = jSONObject3.getString("url");
optJSONObject = jSONObject3.optJSONObject("report_data");
if (optJSONObject == null) {
com.aigestudio.chafer.b.c cVar = null;
char c2 = 65535;
switch (optString.hashCode()) {
case 3726:
if (optString.equals("uc")) {
c2 = 0;
}
default:
switch (c2) {
case 0:
com.aigestudio.chafer.b.d dVar = new com.aigestudio.chafer.b.d();
dVar.b = optJSONObject.getInt("ac");
dVar.d = optJSONObject.getString("aid");
dVar.e = optJSONObject.getString("recoid");
dVar.g = optJSONObject.getInt("cid");
dVar.h = optJSONObject.getInt("item_type");
dVar.f959a = optJSONObject.getString("app");
ArrayList arrayList4 = new ArrayList();
arrayList4.add(dVar);
cVar = new com.aigestudio.chafer.b.c(arrayList4);
default:
aVar2.m = cVar;
break;
}
}
}
arrayList.add(aVar2);
default:
aVar2.j = jSONObject3.getString("url");
optJSONObject = jSONObject3.optJSONObject("report_data");
if (optJSONObject == null) {
}
arrayList.add(aVar2);
break;
}
}
f.this.a((b<b>) bVar, (b) arrayList);
} catch (JSONException e2) {
f.this.a(bVar, 411);
}
}
}
});
}
@Override
public void a(String str, String str2) {
a(str, str2, 0);
}
@Override
public void a(String str, String str2, int i) {
a(str, str2, (String) null, i);
}
@Override
public void a(String str, String str2, String str3) {
a(str, str2, str3, 0);
}
@Override
public void a(String str, String str2, String str3, int i) {
a(str, str2, str3, i, null, null);
}
@Override
public void a(final String str, final String str2, final String str3, final int i, final String str4, final String str5) {
f980a.execute(new Runnable() {
@Override
public void run() {
HashMap hashMap = new HashMap();
hashMap.put("source", str);
hashMap.put("act", str2);
if (str3 != null) {
hashMap.put("channel", str3);
}
if (i != 0) {
hashMap.put("t", String.valueOf(i));
}
if (str4 != null && str5 != null) {
hashMap.put(str4, str5);
}
String a2 = f.this.a("new_log.php", hashMap);
try {
Integer.valueOf(a2);
} catch (NumberFormatException e) {
try {
String string = new JSONObject(a2).getString("url");
if (TextUtils.isEmpty(string)) {
return;
}
f.this.d(string);
} catch (JSONException e2) {
e2.printStackTrace();
}
}
}
});
}
@Override
public void b(final String str, final String str2) {
f980a.execute(new Runnable() {
@Override
public void run() {
InputStreamReader inputStreamReader;
HttpsURLConnection httpsURLConnection;
InputStreamReader inputStreamReader2;
HttpsURLConnection httpsURLConnection2;
boolean z;
BufferedReader bufferedReader;
BufferedReader bufferedReader2 = null;
HttpsURLConnection httpsURLConnection3 = null;
InputStreamReader inputStreamReader3 = null;
BufferedReader bufferedReader3 = null;
try {
com.aigestudio.chafer.b.f a2 = f.this.a();
if (a2 == null) {
if (0 != 0) {
try {
bufferedReader3.close();
} catch (IOException e) {
e.printStackTrace();
return;
}
}
if (0 != 0) {
inputStreamReader3.close();
}
if (0 != 0) {
httpsURLConnection3.disconnect();
return;
}
return;
}
HashMap hashMap = new HashMap();
hashMap.put("access_token", a2.f962a);
hashMap.put("app", str);
hashMap.put("dn", d.a().b());
hashMap.put("fr", "android");
hashMap.put("ve", f.this.b.get("ver"));
hashMap.put("imei", f.this.b.get("imei"));
String str3 = f.this.b.get("net");
switch (str3.hashCode()) {
case 1621:
if (str3.equals("2G")) {
z = false;
break;
}
z = -1;
break;
case 2664213:
if (str3.equals("WIFI")) {
z = true;
break;
}
z = -1;
break;
default:
z = -1;
break;
}
switch (z) {
case false:
hashMap.put("nt", "0");
break;
case true:
hashMap.put("nt", "2");
break;
default:
hashMap.put("nt", "99");
break;
}
StringBuilder sb = new StringBuilder("https://open.uczzd.cn/openlog/openapi/v1/client_event");
sb.append("?");
for (String str4 : hashMap.keySet()) {
sb.append(str4).append("=").append((String) hashMap.get(str4)).append("&");
}
sb.deleteCharAt(sb.length() - 1);
String sb2 = sb.toString();
if (sb2.contains(" ")) {
sb2 = sb2.replace(" ", JsonProperty.USE_DEFAULT_NAME);
}
httpsURLConnection = a.a.a.a.a(sb2);
try {
httpsURLConnection.setReadTimeout(3000);
httpsURLConnection.setConnectTimeout(3000);
httpsURLConnection.setUseCaches(false);
httpsURLConnection.setDoOutput(true);
httpsURLConnection.setDoInput(true);
httpsURLConnection.setRequestProperty("accept", "*/*");
httpsURLConnection.setRequestProperty("connection", "Keep-Alive");
httpsURLConnection.setRequestMethod("POST");
httpsURLConnection.setRequestProperty("charset", "utf-8");
httpsURLConnection.setRequestProperty("Content-Type", "application/json");
OutputStream outputStream = httpsURLConnection.getOutputStream();
outputStream.write(str2.getBytes("UTF-8"));
outputStream.flush();
outputStream.close();
if (httpsURLConnection.getResponseCode() == 200) {
inputStreamReader = new InputStreamReader(httpsURLConnection.getInputStream());
try {
bufferedReader = new BufferedReader(inputStreamReader);
String str5 = JsonProperty.USE_DEFAULT_NAME;
while (true) {
try {
String readLine = bufferedReader.readLine();
if (readLine != null) {
str5 = str5 + readLine;
} else if (!str5.isEmpty()) {
}
} catch (IOException e2) {
e = e2;
bufferedReader2 = bufferedReader;
inputStreamReader2 = inputStreamReader;
httpsURLConnection2 = httpsURLConnection;
try {
e.printStackTrace();
if (bufferedReader2 != null) {
try {
bufferedReader2.close();
} catch (IOException e3) {
e3.printStackTrace();
return;
}
}
if (inputStreamReader2 != null) {
inputStreamReader2.close();
}
if (httpsURLConnection2 != null) {
httpsURLConnection2.disconnect();
return;
}
return;
} catch (Throwable th) {
th = th;
httpsURLConnection = httpsURLConnection2;
inputStreamReader = inputStreamReader2;
if (bufferedReader2 != null) {
try {
bufferedReader2.close();
} catch (IOException e4) {
e4.printStackTrace();
throw th;
}
}
if (inputStreamReader != null) {
inputStreamReader.close();
}
if (httpsURLConnection != null) {
httpsURLConnection.disconnect();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
bufferedReader2 = bufferedReader;
if (bufferedReader2 != null) {
}
if (inputStreamReader != null) {
}
if (httpsURLConnection != null) {
}
throw th;
}
}
} catch (IOException e5) {
e = e5;
inputStreamReader2 = inputStreamReader;
httpsURLConnection2 = httpsURLConnection;
} catch (Throwable th3) {
th = th3;
}
} else {
bufferedReader = null;
inputStreamReader = null;
}
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e6) {
e6.printStackTrace();
return;
}
}
if (inputStreamReader != null) {
inputStreamReader.close();
}
if (httpsURLConnection != null) {
httpsURLConnection.disconnect();
}
} catch (IOException e7) {
e = e7;
inputStreamReader2 = null;
httpsURLConnection2 = httpsURLConnection;
} catch (Throwable th4) {
th = th4;
inputStreamReader = null;
}
} catch (IOException e8) {
e = e8;
inputStreamReader2 = null;
httpsURLConnection2 = null;
} catch (Throwable th5) {
th = th5;
inputStreamReader = null;
httpsURLConnection = null;
}
}
});
}
}