京东到家.apk(点击下载) / MainServiceProtocol.java


package main.net;

import android.app.Activity;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import base.net.open.RequestEntity;
import com.huawei.hms.framework.common.ContainerUtils;
import com.jingdong.sdk.gatewaysign.GatewaySignatureHelper;
import com.tencent.open.SocialConstants;
import jd.MyInfoHelper;
import jd.MyInfoShippingAddress;
import jd.app.JDApplication;
import jd.net.ServiceProtocol;
import jd.net.z;
import jd.utils.PersistentUtils;
import jd.utils.SearchHelper;
import jd.utils.StatisticsReportUtil;
import org.json.JSONException;
import org.json.JSONObject;

public class MainServiceProtocol extends ServiceProtocol {
    static String dataversion = "0";

    public static RequestEntity getUpdatePlunginList() {
        int i;
        try {
            i = JDApplication.getInstance().getPackageManager().getPackageInfo(JDApplication.getInstance().getPackageName(), 0).versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            i = 0;
        }
        JSONObject jSONObject = new JSONObject();
        try {
            dataversion = PersistentUtils.getDataversion(JDApplication.getInstance().getApplicationContext());
            if (TextUtils.isEmpty(dataversion)) {
                dataversion = "0";
            }
            jSONObject.put("dataVersion", dataversion);
            jSONObject.put("appId", "jddj");
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
        String str = "https://api.m.jd.com/client.action?appid=jddaojia&uuid=" + StatisticsReportUtil.getUUIDMD5() + "&functionId=apkListExtend&clientVersion=" + StatisticsReportUtil.getVersionName() + "&build=" + i + "&client=android&body=" + jSONObject.toString() + "&t=" + System.currentTimeMillis();
        String jdk = z.jdk();
        RequestEntity requestEntity = new RequestEntity(GatewaySignatureHelper.signature(str, jdk) + ContainerUtils.FIELD_DELIMITER, null);
        requestEntity.method = 0;
        return requestEntity;
    }

    public static RequestEntity getAPPIcons(Activity activity, String str) {
        RequestEntity requestEntity = new RequestEntity(BASE_URL, null);
        requestEntity.putParam("functionId", "lauch/getAppIcon");
        requestEntity.method = 0;
        baseUrl(null, "", requestEntity);
        return requestEntity;
    }

    public static RequestEntity getUserGrayInfo(Activity activity) {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("groupCode", "flutterRequestDistribution");
            jSONObject.put("dictCode", StatisticsReportUtil.getSimpleVersionName());
            jSONObject.put("sysCode", JDApplication.getInstance().getPackageName());
            if (_T) {
                jSONObject.put("token", "86f47c9bb74217185b863d60f70aafc8");
            } else {
                jSONObject.put("token", "ddbdd474bab9da217bcfb80a78893d01");
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        RequestEntity requestEntity = new RequestEntity(BASE_URL, jSONObject);
        requestEntity.putParam("functionId", "client/request/distribution");
        requestEntity.method = 0;
        baseUrl(null, requestEntity);
        return requestEntity;
    }

    public static RequestEntity homePrivacySecond() {
        RequestEntity requestEntity = new RequestEntity(BASE_URL, new JSONObject());
        requestEntity.putParam("functionId", "me/homePrivacySecond");
        requestEntity.method = 0;
        baseUrl(null, requestEntity);
        return requestEntity;
    }

    public static RequestEntity getSimpleCmsTypeAll(Activity activity) {
        JSONObject jSONObject = new JSONObject();
        MyInfoShippingAddress myInfoShippingAddress = MyInfoHelper.myInfoShippingAddress;
        String str = "";
        if (myInfoShippingAddress != null) {
            str = myInfoShippingAddress.getCityName();
        }
        try {
            if (TextUtils.isEmpty(str)) {
                str = "";
            }
            jSONObject.put("city", str);
            addAddress(jSONObject);
            jSONObject.put("coordType", "2");
            jSONObject.put("appVersion", StatisticsReportUtil.getSimpleVersionName());
            jSONObject.put("platform", "2");
            if (myInfoShippingAddress != null) {
                jSONObject.put("areaCode", myInfoShippingAddress.getCityId());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        RequestEntity requestEntity = new RequestEntity(BASE_URL, jSONObject);
        requestEntity.putParam("functionId", "zone/getSimpleIndex");
        baseUrl(activity, requestEntity);
        return requestEntity;
    }

    public static RequestEntity openCardByDiscoveryOnClick(Activity activity, String str, String str2) {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put(SearchHelper.SEARCH_STORE_ID, str);
            jSONObject.put("orgCode", str2);
            jSONObject.put(SocialConstants.PARAM_SOURCE, "discoveryoneclick");
            RequestEntity requestEntity = new RequestEntity(BASE_URL, jSONObject);
            requestEntity.putParam("functionId", "gateway/openCardByDiscoveryOnClick");
            requestEntity.method = 1;
            baseUrl(activity, requestEntity);
            return requestEntity;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}