package com.qsmx.qigyou.ec.httputil;
import android.text.TextUtils;
import com.qsmx.qigyou.app.Atmos;
import com.qsmx.qigyou.ec.util.ApkUtil;
import com.qsmx.qigyou.ec.util.Md5Util;
import com.qsmx.qigyou.manager.ApkManager;
import com.qsmx.qigyou.util.storage.AtmosPreference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.WeakHashMap;
public class BaseRequestWrapper {
private WeakHashMap<String, Object> map = new WeakHashMap();
public WeakHashMap<String, Object> sign() {
ArrayList arrayList = new ArrayList();
for (String add : this.map.keySet()) {
arrayList.add(add);
}
String[] strArr = (String[]) arrayList.toArray(new String[arrayList.size()]);
Arrays.sort(strArr);
String str = "eaM3N_sUOqQn,A,q";
for (Object obj : strArr) {
if (!TextUtils.isEmpty((CharSequence) this.map.get(obj))) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(str);
stringBuilder.append(obj);
stringBuilder.append(this.map.get(obj));
str = stringBuilder.toString();
}
}
StringBuilder stringBuilder2 = new StringBuilder();
stringBuilder2.append(str);
stringBuilder2.append("eaM3N_sUOqQn,A,q");
try {
this.map.put("sign", Md5Util.md5(stringBuilder2.toString()));
} catch (Exception e) {
e.printStackTrace();
}
return this.map;
}
public BaseRequestWrapper() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(ApkManager.getVersionCode(Atmos.getApplicationContext()));
stringBuilder.append("");
this.map.put("version", stringBuilder.toString());
this.map.put("deviceType", "2");
this.map.put("token", AtmosPreference.getCustomAppProfile("token"));
this.map.put("deviceId", getMac());
this.map.put("channel", "Umeng");
this.map.put("gpsCity", AtmosPreference.getCustomAppProfile("location_city"));
this.map.put("timestamp", new BaseRequestWrapper("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())));
}
public BaseRequestWrapper(String str) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(ApkManager.getVersionCode(Atmos.getApplicationContext()));
stringBuilder.append("");
this.map.put("version", stringBuilder.toString());
this.map.put("deviceType", "2");
this.map.put("token", str);
this.map.put("deviceId", getMac());
this.map.put("channel", "Umeng");
this.map.put("gpsCity", AtmosPreference.getCustomAppProfile("location_city"));
this.map.put("timestamp", new BaseRequestWrapper("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())));
}
private String getMac() {
return ApkUtil.getDeviceId();
}
public void put(String str, String str2) {
this.map.put(str, str2);
}
public void put(WeakHashMap<String, Object> weakHashMap) {
this.map.putAll(weakHashMap);
}
}
package com.qsmx.qigyou.ec.httputil;
import android.text.TextUtils;
import com.qsmx.qigyou.app.Atmos;
import com.qsmx.qigyou.ec.util.ApkUtil;
import com.qsmx.qigyou.ec.util.Md5Util;
import com.qsmx.qigyou.manager.ApkManager;
import com.qsmx.qigyou.util.storage.AtmosPreference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.WeakHashMap;
public class BaseRequestWrapper {
private WeakHashMap<String, Object> map = new WeakHashMap();
public WeakHashMap<String, Object> sign() {
ArrayList arrayList = new ArrayList();
for (String add : this.map.keySet()) {
arrayList.add(add);
}
String[] strArr = (String[]) arrayList.toArray(new String[arrayList.size()]);
Arrays.sort(strArr);
String str = "eaM3N_sUOqQn,A,q";
for (Object obj : strArr) {
if (!TextUtils.isEmpty((CharSequence) this.map.get(obj))) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(str);
stringBuilder.append(obj);
stringBuilder.append(this.map.get(obj));
str = stringBuilder.toString();
}
}
StringBuilder stringBuilder2 = new StringBuilder();
stringBuilder2.append(str);
stringBuilder2.append("eaM3N_sUOqQn,A,q");
try {
this.map.put("sign", Md5Util.md5(stringBuilder2.toString()));
} catch (Exception e) {
e.printStackTrace();
}
return this.map;
}
public BaseRequestWrapper() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(ApkManager.getVersionCode(Atmos.getApplicationContext()));
stringBuilder.append("");
this.map.put("version", stringBuilder.toString());
this.map.put("deviceType", "2");
this.map.put("token", AtmosPreference.getCustomAppProfile("token"));
this.map.put("deviceId", getMac());
this.map.put("channel", "Umeng");
this.map.put("gpsCity", AtmosPreference.getCustomAppProfile("location_city"));
this.map.put("timestamp", new BaseRequestWrapper("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())));
}
public BaseRequestWrapper(String str) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(ApkManager.getVersionCode(Atmos.getApplicationContext()));
stringBuilder.append("");
this.map.put("version", stringBuilder.toString());
this.map.put("deviceType", "2");
this.map.put("token", str);
this.map.put("deviceId", getMac());
this.map.put("channel", "Umeng");
this.map.put("gpsCity", AtmosPreference.getCustomAppProfile("location_city"));
this.map.put("timestamp", new BaseRequestWrapper("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())));
}
private String getMac() {
return ApkUtil.getDeviceId();
}
public void put(String str, String str2) {
this.map.put(str, str2);
}
public void put(WeakHashMap<String, Object> weakHashMap) {
this.map.putAll(weakHashMap);
}
}