OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.excelliance.kxqp.gs.discover.bbs;
import android.content.Context;
import android.content.SharedPreferences;
import android.media.MediaMetadataRetriever;
import android.os.Build;
import android.text.TextUtils;
import com.bytedance.sdk.open.aweme.common.constants.ParamKeyConstants;
import com.excelliance.kxqp.gs.discover.model.CDNData;
import com.excelliance.kxqp.gs.discover.model.Comment;
import com.excelliance.kxqp.gs.discover.model.Forum;
import com.excelliance.kxqp.gs.discover.model.ForumCategory;
import com.excelliance.kxqp.gs.discover.model.LatestActivity;
import com.excelliance.kxqp.gs.discover.model.ResourceType;
import com.excelliance.kxqp.gs.discover.model.ResponseData;
import com.excelliance.kxqp.gs.discover.model.Topic;
import com.excelliance.kxqp.gs.discover.model.UploadWrap;
import com.excelliance.kxqp.gs.discover.user.d;
import com.excelliance.kxqp.gs.ui.make_money.f;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.gs.util.t;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
public class a {
private static a f4622a;
private Context f4623b;
private by c;
private Gson d = new Gson();
private c e;
public static a a(Context context) {
if (f4622a == null) {
synchronized (a.class) {
if (f4622a == null) {
f4622a = new a(context.getApplicationContext());
}
}
}
return f4622a;
}
private a(Context context) {
this.f4623b = context;
this.c = by.a(this.f4623b, "repository_cache_name");
this.e = new c(context.getApplicationContext());
}
public ResponseData<Forum> a(String str) {
JSONObject i = cn.i(this.f4623b);
try {
i.put("plateid", str);
i.put("userid", bx.a().a(this.f4623b));
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i.toString(), "http://api.ourplay.com.cn/bbs/detail", new com.excelliance.kxqp.gs.discover.a.c<Forum>() {
@Override
public ResponseData<Forum> a(String str2) {
return (ResponseData) a.this.d.a(str2, new TypeToken<ResponseData<Forum>>() {
}.getType());
}
});
}
public ResponseData<Object> a(String str, int i) {
JSONObject i2 = cn.i(this.f4623b);
try {
i2.put("plateid", str);
i2.put("operation", i);
i2.put("userid", bx.a().a(this.f4623b));
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i2.toString(), "http://api.ourplay.com.cn/bbs/collect", new com.excelliance.kxqp.gs.discover.a.c<Object>() {
@Override
public ResponseData<Object> a(String str2) {
return (ResponseData) a.this.d.a(str2, new TypeToken<ResponseData<Object>>() {
}.getType());
}
});
}
public ResponseData<List<Topic>> a(String str, int i, int i2, int i3, int i4) {
JSONObject i5 = cn.i(this.f4623b);
try {
i5.put("userid", bx.a().a(this.f4623b));
i5.put("plateid", str);
i5.put("elite", i);
i5.put("sort", i2);
i5.put("page", i3);
i5.put("pageSize", i4);
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i5.toString(), "http://api.ourplay.com.cn/bbs/list", new com.excelliance.kxqp.gs.discover.a.c<List<Topic>>() {
@Override
public ResponseData<List<Topic>> a(String str2) {
return (ResponseData) a.this.d.a(str2, new TypeToken<ResponseData<List<Topic>>>() {
}.getType());
}
});
}
public ResponseData<List<LatestActivity>> a(int i, int i2) {
JSONObject i3 = cn.i(this.f4623b);
try {
i3.put("page", i);
i3.put("pageSize", i2);
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i3.toString(), "http://10.0.0.247:3000/bbs/activity", new com.excelliance.kxqp.gs.discover.a.c<List<LatestActivity>>() {
@Override
public ResponseData<List<LatestActivity>> a(String str) {
return (ResponseData) a.this.d.a(str, new TypeToken<ResponseData<List<LatestActivity>>>() {
}.getType());
}
});
}
public ResponseData<List<ForumCategory>> a() {
JSONObject i = cn.i(this.f4623b);
az.d("ForumRepository", "encrypt request:" + cn.b(i.toString()));
return this.e.a(i.toString(), "http://api.ourplay.com.cn/bbs/boardlist", new com.excelliance.kxqp.gs.discover.a.c<List<ForumCategory>>() {
@Override
public ResponseData<List<ForumCategory>> a(String str) {
return (ResponseData) a.this.d.a(str, new TypeToken<ResponseData<List<ForumCategory>>>() {
}.getType());
}
});
}
public ResponseData<List<Comment>> a(int i, String str, String str2, String str3) {
JSONObject i2 = cn.i(this.f4623b);
try {
i2.put("page", i);
i2.put("newsid", str);
i2.put("sort", str2);
i2.put("condition", str3);
i2.put("userid", bx.a().a(this.f4623b));
i2.put("equipment", URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
i2.put("pageSize", 10);
} catch (Exception e) {
e.printStackTrace();
}
return this.e.a(i2.toString(), "http://api.ourplay.com.cn/comment/ranklist", new com.excelliance.kxqp.gs.discover.a.c<List<Comment>>() {
@Override
public ResponseData<List<Comment>> a(String str4) {
return (ResponseData) a.this.d.a(str4, new TypeToken<ResponseData<List<Comment>>>() {
}.getType());
}
});
}
public ResponseData<Object> a(String str, float f, String str2) {
JSONObject i = cn.i(this.f4623b);
try {
i.put("content", str);
i.put("grade", f);
i.put("id", str2);
i.put("userid", bx.a().a(this.f4623b));
i.put("equipment", URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
} catch (Exception e) {
e.printStackTrace();
}
return this.e.a(i.toString(), "http://api.ourplay.com.cn/comment/addrank", new com.excelliance.kxqp.gs.discover.a.c<Object>() {
@Override
public ResponseData<Object> a(String str3) {
return (ResponseData) a.this.d.a(str3, new TypeToken<ResponseData<Object>>() {
}.getType());
}
});
}
public ResponseData<Comment.Reply> a(final String str, final String str2, String str3, String str4, final String str5) {
JSONObject i = cn.i(this.f4623b);
try {
i.put("id", str4);
i.put("pid", str3);
i.put(ParamKeyConstants.WebViewConstants.QUERY_FROM, bx.a().a(this.f4623b));
i.put("to", str5);
i.put("content", str);
} catch (Exception e) {
e.printStackTrace();
}
return this.e.a(i.toString(), "http://api.ourplay.com.cn/comment/addchild", new com.excelliance.kxqp.gs.discover.a.c<Comment.Reply>() {
@Override
public ResponseData<Comment.Reply> a(String str6) {
ResponseData<Comment.Reply> responseData = (ResponseData) a.this.d.a(str6, new TypeToken<ResponseData<Comment.Reply>>() {
}.getType());
responseData.data.content = str;
responseData.data.to = str5;
responseData.data.toname = str2;
String a2 = bx.a().a(a.this.f4623b.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4), "USER_NAME");
responseData.data.from = bx.a().a(a.this.f4623b);
responseData.data.fromname = a2;
responseData.data.likenum = "0";
return responseData;
}
});
}
public ResponseData<Object> a(String str, String str2, String str3) {
JSONObject i = cn.i(this.f4623b);
try {
i.put("content", str);
i.put("title", str2);
i.put("type", 1);
i.put("cid", str3);
i.put("userid", bx.a().a(this.f4623b));
} catch (Exception e) {
e.printStackTrace();
}
return this.e.a(i.toString(), "http://api.ourplay.com.cn/comment/complaint", new com.excelliance.kxqp.gs.discover.a.c<Object>() {
@Override
public ResponseData<Object> a(String str4) {
return (ResponseData) a.this.d.a(str4, new TypeToken<ResponseData<Object>>() {
}.getType());
}
});
}
public ResponseData<Object> a(String str, int i, int i2) {
JSONObject i3 = cn.i(this.f4623b);
try {
i3.put("commentid", str);
i3.put("operation", i2);
i3.put("type", i);
i3.put("userid", bx.a().a(this.f4623b));
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i3.toString(), "http://api.ourplay.com.cn/comment/setlike", new com.excelliance.kxqp.gs.discover.a.c<Object>() {
@Override
public ResponseData<Object> a(String str2) {
return (ResponseData) a.this.d.a(str2, new TypeToken<ResponseData<Object>>() {
}.getType());
}
});
}
public ResponseData<Topic> a(boolean z, String str, String str2, String str3, String str4, List<String> list) {
String a2;
ArrayList arrayList;
String str5;
String str6;
List<String> list2 = list;
ResponseData responseData = new ResponseData();
d a3 = d.a(this.f4623b);
b a4 = b.a(this.f4623b);
ResponseData<UploadWrap> a5 = a3.a();
az.d("ForumRepository", "uploadWrapResponseData:" + a5);
String str7 = "";
az.d("ForumRepository", "videoPath:" + str4);
az.d("ForumRepository", "imagePaths:" + list2);
if (!TextUtils.isEmpty(str4)) {
if (a5.code == 0) {
UploadWrap uploadWrap = a5.data;
ResponseData<CDNData> a6 = a4.a(ResourceType.VIDEO_MP4, uploadWrap.token, uploadWrap.upload, str4);
az.d("ForumRepository", "uploadWrapResponseData:" + a5);
if (a6.code == 0) {
str7 = uploadWrap.domain + a6.data.key;
if (a4.a(str7).code != 0) {
ResponseData<Topic> responseData2 = new ResponseData<>();
responseData2.code = 1;
responseData2.msg = com.excelliance.kxqp.swipe.a.a.getString(this.f4623b, "cache_cover_error");
return responseData2;
}
} else {
responseData.data = false;
responseData.msg = "video upload to qiniu error";
}
} else {
responseData.data = false;
responseData.msg = "get cdn token error";
}
}
if ((list2 == null || list.size() == 0) && !TextUtils.isEmpty(str4)) {
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
try {
mediaMetadataRetriever.setDataSource(str4, new HashMap());
a2 = f.a(mediaMetadataRetriever.getFrameAtTime());
az.d("ForumRepository", "imagePath:" + a2);
arrayList = new ArrayList();
} catch (Exception e) {
e = e;
}
try {
arrayList.add(a2);
list2 = arrayList;
} catch (Exception e2) {
e = e2;
list2 = arrayList;
az.d("ForumRepository", "ex:" + e.getMessage());
if (list2 != null) {
if (a5.code != 0) {
}
}
str5 = "";
str6 = str3;
az.d("ForumRepository", "content:" + str6);
return a(z, str, str2, str6, str7, str5);
}
}
if (list2 != null && list2.size() > 0) {
if (a5.code != 0) {
UploadWrap uploadWrap2 = a5.data;
str5 = "";
str6 = str3;
for (String str8 : list2) {
if (TextUtils.isEmpty(str8)) {
break;
}
ResponseData<CDNData> a7 = a4.a(ResourceType.PIC_JPG, uploadWrap2.token, uploadWrap2.upload, str8);
az.d("ForumRepository", "imageUploadResponse:" + a5);
if (a7.code == 0) {
str5 = uploadWrap2.domain + a7.data.key;
str6 = str6.replaceAll(str8, str5);
} else {
responseData.data = false;
responseData.msg = "image upload to qiniu error";
az.d("ForumRepository", "error:" + a7.msg);
}
}
az.d("ForumRepository", "content:" + str6);
return a(z, str, str2, str6, str7, str5);
}
responseData.data = false;
responseData.msg = "get cdn token error";
}
str5 = "";
str6 = str3;
az.d("ForumRepository", "content:" + str6);
return a(z, str, str2, str6, str7, str5);
}
public ResponseData<Topic> a(boolean z, String str, final String str2, final String str3, String str4, final String str5) {
String str6;
JSONObject i = cn.i(this.f4623b);
try {
i.put("title", str2);
if (z) {
str6 = "<p>" + str3 + "</p><video>" + str4 + "</video>";
} else {
str6 = str3;
}
i.put("content", str6);
i.put("type", str);
i.put("isweb", "0");
i.put("isvideo", z ? 1 : 0);
i.put("video", str4);
i.put("titlepic", str5);
i.put("userid", bx.a().a(this.f4623b));
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i.toString(), "http://api.ourplay.com.cn/news/add", new com.excelliance.kxqp.gs.discover.a.c<Topic>() {
@Override
public ResponseData<Topic> a(String str7) {
ResponseData<Topic> responseData = (ResponseData) new Gson().a(str7, new TypeToken<ResponseData<Topic>>() {
}.getType());
responseData.data.title = str2;
responseData.data.content = str3;
responseData.data.readCount = 0L;
responseData.data.islike = 2;
responseData.data.commentCount = 0L;
responseData.data.image = str5;
responseData.data.is_vip = bx.a().u(a.this.f4623b);
SharedPreferences sharedPreferences = a.this.f4623b.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
String a2 = bx.a().a(sharedPreferences, t.f);
responseData.data.ownName = bx.a().a(sharedPreferences, "USER_NAME");
responseData.data.ownIcon = a2;
return responseData;
}
});
}
public ResponseData<Object> b(String str, int i) {
JSONObject i2 = cn.i(this.f4623b);
try {
i2.put("id", str);
i2.put("type", i);
i2.put("userid", bx.a().a(this.f4623b));
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i2.toString(), "http://api.ourplay.com.cn/news/like", new com.excelliance.kxqp.gs.discover.a.c<Object>() {
@Override
public ResponseData<Object> a(String str2) {
return (ResponseData) new Gson().a(str2, new TypeToken<ResponseData<Object>>() {
}.getType());
}
});
}
public ResponseData<List<Comment.Reply>> b(String str, int i, int i2) {
JSONObject i3 = cn.i(this.f4623b);
try {
i3.put("page", i);
i3.put("pageSize", i2);
i3.put("userid", bx.a().a(this.f4623b));
i3.put("commentid", str);
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i3.toString(), "http://api.ourplay.com.cn/comment/newschildlist", new com.excelliance.kxqp.gs.discover.a.c<List<Comment.Reply>>() {
@Override
public ResponseData<List<Comment.Reply>> a(String str2) {
return (ResponseData) a.this.d.a(str2, new TypeToken<ResponseData<List<Comment.Reply>>>() {
}.getType());
}
});
}
public ResponseData<Object> a(Comment.Reply reply) {
JSONObject i = cn.i(this.f4623b);
try {
i.put("cid", reply.id);
i.put("type", 2);
i.put("userid", bx.a().a(this.f4623b));
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i.toString(), "http://api.ourplay.com.cn/comment/delete", new com.excelliance.kxqp.gs.discover.a.c<Object>() {
@Override
public ResponseData<Object> a(String str) {
return (ResponseData) a.this.d.a(str, new TypeToken<ResponseData<Object>>() {
}.getType());
}
});
}
public ResponseData<Comment.Reply> a(final Comment.Reply reply, String str, final String str2) {
JSONObject i = cn.i(this.f4623b);
try {
i.put("id", str);
i.put("pid", reply.id);
i.put("to", reply.from);
i.put("content", str2);
i.put(ParamKeyConstants.WebViewConstants.QUERY_FROM, bx.a().a(this.f4623b));
} catch (JSONException e) {
e.printStackTrace();
}
return this.e.a(i.toString(), "http://api.ourplay.com.cn/comment/addchild", new com.excelliance.kxqp.gs.discover.a.c<Comment.Reply>() {
@Override
public ResponseData<Comment.Reply> a(String str3) {
ResponseData<Comment.Reply> responseData = (ResponseData) a.this.d.a(str3, new TypeToken<ResponseData<Comment.Reply>>() {
}.getType());
responseData.data.to = reply.from;
responseData.data.toname = reply.fromname;
responseData.data.content = str2;
responseData.data.islike = 2;
responseData.data.likenum = "0";
responseData.data.from = bx.a().a(a.this.f4623b);
SharedPreferences sharedPreferences = a.this.f4623b.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
String a2 = bx.a().a(sharedPreferences, t.f);
responseData.data.fromname = bx.a().a(sharedPreferences, "USER_NAME");
responseData.data.header = a2;
return responseData;
}
});
}
}