酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319

以下内容为反编译后的 a.java 源代码,内容仅作参考


package com.kugou.common.wxapi;

import android.content.Context;
import com.kugou.common.R;
import com.kugou.common.utils.as;
import com.kugou.fanxing.livelist.bi.PgCode;
import com.sina.weibo.sdk.auth.Oauth2AccessToken;
import com.sina.weibo.sdk.web.WebPicUploadResult;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.tencent.open.SocialOperation;
import java.util.Hashtable;
import org.apache.http.HttpEntity;
import org.json.JSONException;
import org.json.JSONObject;

public class a {

    private Context f55169a;

    private IWXAPI f55170b;

    public static class C0965a {

        public String f55171a;

        public String f55172b;

        public String f55173c;

        public String f55174d;

        public String f55175e;
        public String f;
        public boolean g;
    }

    public static class b {

        public String f55176a;

        public String f55177b;

        public int f55178c;

        public String f55179d;

        public String f55180e;
        public String f;
        public String g;
        public String h;
        public boolean i;
        public String j;
        public String k;
    }

    public a(Context context) {
        this.f55169a = context;
        this.f55170b = WXAPIFactory.createWXAPI(context, "wx72b795aca60ad321", true);
        this.f55170b.registerApp("wx72b795aca60ad321");
    }

    public void a() {
        SendAuth.Req req = new SendAuth.Req();
        req.scope = "snsapi_userinfo";
        req.state = this.f55169a.getResources().getString(R.string.app_name);
        req.transaction = "weixin_login";
        this.f55170b.sendReq(req);
    }

    public C0965a a(String str) {
        C0965a c0965a = new C0965a();
        try {
            c cVar = new c(str);
            d dVar = new d();
            com.kugou.common.network.f.b(true).a(cVar, dVar);
            dVar.getResponseData(c0965a);
        } catch (Exception e2) {
            as.e(e2);
        }
        return c0965a;
    }

    public b a(String str, String str2) {
        b bVar = new b();
        try {
            e eVar = new e(str, str2);
            f fVar = new f();
            com.kugou.common.network.f.b(false).a(eVar, fVar);
            fVar.getResponseData(bVar);
        } catch (Exception e2) {
            as.e(e2);
        }
        return bVar;
    }

    class c extends com.kugou.common.network.d.d {

        String f55181a;

        @Override
        public HttpEntity getPostRequestEntity() {
            return null;
        }

        @Override
        public String getRequestModuleName() {
            return null;
        }

        @Override
        public String getRequestType() {
            return null;
        }

        @Override
        public String getUrl() {
            return "https://api.weixin.qq.com/sns/oauth2/access_token";
        }

        public c(String str) {
            this.f55181a = str;
            this.l = new Hashtable<>();
            b(this.l);
        }

        @Override
        public String getGetRequestParams() {
            this.l.put("appid", "wx72b795aca60ad321");
            this.l.put("secret", "33e486041e5e25729a4e3d2da7502f9a");
            this.l.put(WebPicUploadResult.RESP_UPLOAD_PIC_PARAM_CODE, this.f55181a);
            this.l.put("grant_type", "authorization_code");
            return super.getGetRequestParams();
        }
    }

    class d extends com.kugou.android.common.d.b<C0965a> {
        d() {
        }

        @Override
        public void getResponseData(C0965a c0965a) {
            try {
                JSONObject jSONObject = new JSONObject(this.i);
                if (jSONObject.has("errcode")) {
                    c0965a.f55175e = jSONObject.optString("errcode");
                    c0965a.f = jSONObject.optString("errmsg");
                    c0965a.g = true;
                } else {
                    c0965a.f55171a = jSONObject.optString("access_token");
                    c0965a.f55173c = jSONObject.optString("openid");
                    c0965a.f55174d = jSONObject.optString("scope");
                    c0965a.f55172b = jSONObject.optString(Oauth2AccessToken.KEY_REFRESH_TOKEN);
                    c0965a.g = false;
                }
            } catch (JSONException e2) {
                as.e(e2);
            }
        }
    }

    class e extends com.kugou.common.network.d.d {

        String f55184a;

        String f55185b;

        @Override
        public HttpEntity getPostRequestEntity() {
            return null;
        }

        @Override
        public String getRequestModuleName() {
            return null;
        }

        @Override
        public String getRequestType() {
            return null;
        }

        @Override
        public String getUrl() {
            return "https://api.weixin.qq.com/sns/userinfo";
        }

        public e(String str, String str2) {
            this.f55184a = str2;
            this.f55185b = str;
            this.l = new Hashtable<>();
            this.l.put("access_token", this.f55185b);
            this.l.put("openid", str2);
            b(this.l);
        }

        @Override
        public String getGetRequestParams() {
            return super.getGetRequestParams();
        }
    }

    class f extends com.kugou.android.common.d.b<b> {
        f() {
        }

        @Override
        public void getResponseData(b bVar) {
            try {
                JSONObject jSONObject = new JSONObject(this.i);
                if (jSONObject.has("errcode")) {
                    bVar.k = jSONObject.optString("errcode");
                    bVar.j = jSONObject.optString("errmsg");
                    bVar.i = true;
                } else {
                    bVar.f55177b = jSONObject.optString("nickname");
                    bVar.f55176a = jSONObject.optString("openid");
                    bVar.f55178c = jSONObject.optInt("sex");
                    bVar.f55179d = jSONObject.optString("province");
                    bVar.f55180e = jSONObject.optString(PgCode.city);
                    bVar.f = jSONObject.optString("country");
                    bVar.g = jSONObject.optString("headimgurl");
                    bVar.h = jSONObject.optString(SocialOperation.GAME_UNION_ID);
                    bVar.i = false;
                }
            } catch (JSONException e2) {
                as.e(e2);
            }
        }
    }

    public boolean b() {
        return this.f55170b.isWXAppInstalled();
    }
}