Commit cbf1b22f authored by mengcuiguang's avatar mengcuiguang

1.0.1版本优化

parent 8c39e26c
......@@ -39,7 +39,7 @@ public class AlipayManager {
* 建议使用支付宝提供的公私钥生成工具生成和获取 RSA2_PRIVATE。
* 工具地址:https://doc.open.alipay.com/docs/doc.htm?treeId=291&articleId=106097&docType=1
*/
public static final String RSA2_PRIVATE = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCKgMOkimaqy0VItuRI8p5JHAZTMuZ3L0V34l4EWuALOPwEd6i2stH8/VyZ7yAosLO6mdFERxbkJHec96kKRIoF/M1INcMuc3vNUGLzPXRI1eBVHNVcP2Ajn9AofXxwH7SCAZSVU84guElI8c7J/z0cVrpmRGeNr1CCGHGuuQLlOG2Se4heelPhCm9ONDx37MBmgMOPS/YWVfIYrOv1hJdUQCmjqqbYBL+1y4tZ6agXJfC58FKxhkxGd8QDG4pqZmJqkKBXdim8JuAxkKQvn2UScdHf/Ba9ETzKU6YSx8/b7cbjQeHaTDcHB8REuEdyslOvG4iF4RkDdJT6bbYl+IwrAgMBAAECggEAL7NXLhUIdOwbCYcLql/8ybsgJolSPFwIddh9fsx5ewP+L9+yOHHvxkzQFqf3kGwDClItc3F0XdB9bY8SJdojGxrM7ICvnxDg4347BgD1Spx2bXnHtcSR7NL+kuNc9xTESz4WGTPKuxQdEUVObd09A8SO3+fRLkfh11xp0r4fVCgO4VWO9v1ioTDClOlSRIRWOmm6l9Q5iBfhriG2DBcdlR9J+DdUipAqyXgljubhyfrzGBxHTUp137igytsagRCjBsT3TzVnI5JK7kG8qXEmMlHlt/3wJLjMFjjrpDAXVWhOJhY96BseqMm4mNP5LLAVDDBUJJpEtrD3BZr5CoOrMQKBgQDaHcNfjqsWwWpnsEpx2bfGwBzRQzFnCYvbk09RJI8moyXvQNhpHx440ZJ86gmuMP7IsolYxEtbZIOV63AjLSGMiEre26e75Qo4gaeXQMFOvY/JeZ8ICHD4QaA+TRaAh8Di9IMlzGIdhNJ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W0XyczasUdlUH13CEpUN/wxE6HZZAoGAI22RzJbLgSDO0+uvt946/aQJ8Fs9cq+tRc16AeIzxP8jePtHbKPBdgufgEK68psKCXbP2KzBJHxc4y+Ht7cv3q2duEf0Ky2HNI+RVOOBkbxPFls9krBIR0KFZK0Dq/qaYNTuno+YuEG8VCnELfsAST6vnizIth+1xEow5JINprA=";
public static final String RSA_PRIVATE = "";
private static final int SDK_AUTH_FLAG = 2;
......
package com.mints.highgold.mvp.presenters;
import android.content.Context;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.mints.highgold.common.Constant;
import com.mints.highgold.common.DeviceInfo;
import com.mints.highgold.manager.AppHttpManager;
import com.mints.highgold.manager.JpushManager;
import com.mints.highgold.manager.ShumeiManager;
import com.mints.highgold.manager.UserManager;
import com.mints.highgold.mvp.model.BaseResponse;
import com.mints.highgold.mvp.model.DrawcashBean;
import com.mints.highgold.mvp.model.LocationBean;
import com.mints.highgold.mvp.model.MyInfo;
import com.mints.highgold.mvp.model.UserBean;
import com.mints.highgold.mvp.model.UserTaskMsgBean;
import com.mints.highgold.mvp.views.GameView;
import com.mints.highgold.utils.DeviceUuidFactory;
import com.mints.highgold.utils.DevicesUtil;
import com.mints.highgold.utils.SPUtil;
import com.mints.highgold.utils.MD5;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import com.mints.library.utils.json.JsonUtil;
import java.util.HashMap;
......@@ -118,10 +106,11 @@ public class GamePresenter extends BasePresenter<GameView> {
/**
* 游客登录
*/
public void userLogin(Context context) {
public void userLogin() {
HashMap<String, Object> vo = new HashMap<>();
String uuid = new DeviceUuidFactory(loanApplication).getDeviceUuid().toString();
vo.put("device", uuid);
vo.put("seq", MD5.GetMD5Code(DevicesUtil.getPesudoUniqueID()+System.currentTimeMillis()));
AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo),
new BaseSubscriber<BaseResponse<UserBean>>() {
......@@ -143,11 +132,6 @@ public class GamePresenter extends BasePresenter<GameView> {
UserBean content = baseResponse.getData();
if (content != null) {
UserManager.getInstance().saveUserInfo(content);
UserBean.ConsumerBean consumer = content.getConsumer();
if (consumer != null) {
saveTerminalInfo(context, uuid, consumer);
}
}
break;
}
......@@ -155,96 +139,4 @@ public class GamePresenter extends BasePresenter<GameView> {
});
}
/**
* 提交设备信息
*
* @param context
* @param uuid
* @param consumer
*/
private void saveTerminalInfo(Context context, String uuid, UserBean.ConsumerBean consumer) {
if (loanApplication == null || context == null) return;
DeviceInfo deviceInfo = DeviceInfo.getDeviceInfo(context);
String macAddress = deviceInfo.getMacAddress(context);
HashMap<String, Object> vo = new HashMap<>();
if (!TextUtils.isEmpty(macAddress)) {
String mac = macAddress.replace(":", "");
vo.put("mac", mac);
vo.put("mac1", macAddress);
}
try {
String imei = deviceInfo.getIMEI();
if (!TextUtils.isEmpty(imei)) {
vo.put("imei", imei);
}
} catch (Exception e) {
e.printStackTrace();
vo.put("imei", "");
}
String androidId = deviceInfo.getAndroidId(context);
if (!TextUtils.isEmpty(androidId)) {
vo.put("androidid", androidId);
}
try {
vo.put("shumeiId", ShumeiManager.getInstance().getShumeiDeviceId());
} catch (Exception e) {
e.printStackTrace();
}
try {
SPUtil spUtil = SPUtil.getInstance(context);
if (spUtil != null) {
String lbStr = spUtil.getString(Constant.LOCATION_DATA);
LocationBean lb = new Gson().fromJson(lbStr, LocationBean.class);
if (lb != null) {
vo.put("gpsInfo", JsonUtil.toJson(lb));
}
}
} catch (Exception e) {
}
vo.put("os", "android");
vo.put("model", deviceInfo.getMobileModel());
vo.put("uuid", uuid);
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("appPkgList", deviceInfo.getPkgInfo(context));
vo.put("oaid", DevicesUtil.getOaid());
vo.put("tempuuid", DevicesUtil.getPesudoUniqueID());
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
int code = baseResponse.getStatus();
switch (code) {
case 200://成功
if (consumer != null) {
//绑定用户jpush
String userId = String.valueOf(consumer.getPk_id());
JpushManager.getInstance().setJpushService(userId);
}
break;
}
}
});
}
}
......@@ -20,6 +20,7 @@ import com.mints.highgold.mvp.model.UserTaskMsgBean;
import com.mints.highgold.mvp.views.LoanView;
import com.mints.highgold.utils.DeviceUuidFactory;
import com.mints.highgold.utils.DevicesUtil;
import com.mints.highgold.utils.MD5;
import com.mints.highgold.utils.SPUtil;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
......@@ -495,6 +496,7 @@ public class LoanPresenter extends BasePresenter<LoanView> {
HashMap<String, Object> vo = new HashMap<>();
uuid = new DeviceUuidFactory(loanApplication).getDeviceUuid().toString();
vo.put("device", uuid);
vo.put("seq", MD5.GetMD5Code(DevicesUtil.getPesudoUniqueID()+System.currentTimeMillis()));
AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo),
new BaseSubscriber<BaseResponse<UserBean>>() {
......@@ -514,24 +516,6 @@ public class LoanPresenter extends BasePresenter<LoanView> {
switch (code) {
case 200://成功
UserBean content = baseResponse.getData();
// if (content != null) {
// UserManager.getInstance().saveUserInfo(content);
//
// UserBean.ConsumerBean consumer = content.getConsumer();
// if (consumer != null) {
// //绑定用户jpush
// String userId = String.valueOf(consumer.getPk_id());
// JpushManager.getInstance().setJpushService(userId);
// }
//
// getUserTaskMsg();
//
// saveTerminalInfo(context, uuid);
//
//// getSignInHomePageMsg();
// getWaterMsgHome();
// }
if (content != null) {
UserManager.getInstance().saveUserInfo(content);
consumer = content.getConsumer();
......
......@@ -15,6 +15,7 @@ import com.mints.highgold.mvp.model.UserBean;
import com.mints.highgold.mvp.views.MyView;
import com.mints.highgold.utils.DeviceUuidFactory;
import com.mints.highgold.utils.DevicesUtil;
import com.mints.highgold.utils.MD5;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
......@@ -22,10 +23,6 @@ import java.util.HashMap;
public class MyPresenter extends BasePresenter<MyView> {
private Context context;
private UserBean.ConsumerBean consumer;
private String uuid;
/**
* isCall -- true 连续调用
* 获取用户配置信息
......@@ -61,7 +58,7 @@ public class MyPresenter extends BasePresenter<MyView> {
switch (code) {
case 200://成功
if (isCall) {
saveTerminalInfo(context, uuid);
// saveTerminalInfo(context, uuid);
view.getUserTaskMsgSuc(baseResponse.getData());
} else {
view.getUserTaskMsgSuc(baseResponse.getData());
......@@ -177,11 +174,11 @@ public class MyPresenter extends BasePresenter<MyView> {
/**
* 游客登录
*/
public void userLogin(Context context) {
this.context = context;
public void userLogin() {
HashMap<String, Object> vo = new HashMap<>();
uuid = new DeviceUuidFactory(loanApplication).getDeviceUuid().toString();
String uuid = new DeviceUuidFactory(loanApplication).getDeviceUuid().toString();
vo.put("device", uuid);
vo.put("seq", MD5.GetMD5Code(DevicesUtil.getPesudoUniqueID() + System.currentTimeMillis()));
AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo),
new BaseSubscriber<BaseResponse<UserBean>>() {
......@@ -203,7 +200,6 @@ public class MyPresenter extends BasePresenter<MyView> {
UserBean content = baseResponse.getData();
if (content != null) {
UserManager.getInstance().saveUserInfo(content);
consumer = content.getConsumer();
getUserTaskMsg(true);
}
break;
......@@ -211,77 +207,4 @@ public class MyPresenter extends BasePresenter<MyView> {
}
});
}
/**
* 提交设备信息
*
* @param context
* @param uuid
*/
private void saveTerminalInfo(Context context, String uuid) {
if (loanApplication == null || context == null) return;
DeviceInfo deviceInfo = DeviceInfo.getDeviceInfo(context);
String macAddress = deviceInfo.getMacAddress(context);
HashMap<String, Object> vo = new HashMap<>();
if (!TextUtils.isEmpty(macAddress)) {
String mac = macAddress.replace(":", "");
vo.put("mac", mac);
vo.put("mac1", macAddress);
}
try {
String imei = deviceInfo.getIMEI();
if (!TextUtils.isEmpty(imei)) {
vo.put("imei", imei);
}
} catch (Exception e) {
e.printStackTrace();
vo.put("imei", "");
}
String androidId = deviceInfo.getAndroidId(context);
if (!TextUtils.isEmpty(androidId)) {
vo.put("androidid", androidId);
}
vo.put("os", "android");
vo.put("model", deviceInfo.getMobileModel());
vo.put("uuid", uuid);
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("appPkgList", deviceInfo.getPkgInfo(context));
vo.put("oaid", DevicesUtil.getOaid());
vo.put("tempuuid", DevicesUtil.getPesudoUniqueID());
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
int code = baseResponse.getStatus();
switch (code) {
case 200://成功
if (consumer != null) {
//绑定用户jpush
String userId = String.valueOf(consumer.getPk_id());
JpushManager.getInstance().setJpushService(userId);
}
break;
}
}
});
}
}
......@@ -14,6 +14,8 @@ import com.mints.highgold.mvp.model.UserBean;
import com.mints.highgold.mvp.model.UserVersusBean;
import com.mints.highgold.mvp.views.VersusView;
import com.mints.highgold.utils.DeviceUuidFactory;
import com.mints.highgold.utils.DevicesUtil;
import com.mints.highgold.utils.MD5;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
......@@ -21,10 +23,6 @@ import java.util.HashMap;
public class VersusPresenter extends BasePresenter<VersusView> {
private Context context;
private UserBean.ConsumerBean consumer;
private String uuid;
/**
* isCall -- true 连续调用
* 获取用户配置信息
......@@ -60,12 +58,10 @@ public class VersusPresenter extends BasePresenter<VersusView> {
switch (code) {
case 200://成功
if (isCall) {
saveTerminalInfo(context, uuid);
// saveTerminalInfo(context, uuid);
} else {
view.getUserTaskMsgSuc(baseResponse.getData());
getSignInHomePageMsg();
// getGameList();
}
break;
......@@ -378,11 +374,11 @@ public class VersusPresenter extends BasePresenter<VersusView> {
/**
* 游客登录
*/
public void userLogin(Context context) {
this.context = context;
public void userLogin() {
HashMap<String, Object> vo = new HashMap<>();
uuid = new DeviceUuidFactory(loanApplication).getDeviceUuid().toString();
String uuid = new DeviceUuidFactory(loanApplication).getDeviceUuid().toString();
vo.put("device", uuid);
vo.put("seq", MD5.GetMD5Code(DevicesUtil.getPesudoUniqueID() + System.currentTimeMillis()));
AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo),
new BaseSubscriber<BaseResponse<UserBean>>() {
......@@ -402,22 +398,8 @@ public class VersusPresenter extends BasePresenter<VersusView> {
switch (code) {
case 200://成功
UserBean content = baseResponse.getData();
// if (content != null) {
// UserManager.getInstance().saveUserInfo(content);
// UserBean.ConsumerBean consumer = content.getConsumer();
// if (consumer != null) {
// //绑定用户jpush
// String userId = String.valueOf(consumer.getPk_id());
// JpushManager.getInstance().setJpushService(userId);
// }
// saveTerminalInfo(context, uuid);
// getUserTaskMsg();
// getSignInHomePageMsg();
// }
if (content != null) {
UserManager.getInstance().saveUserInfo(content);
consumer = content.getConsumer();
getUserTaskMsg(true);
}
break;
......@@ -426,74 +408,4 @@ public class VersusPresenter extends BasePresenter<VersusView> {
});
}
/**
* 提交设备信息
*
* @param context
* @param uuid
*/
private void saveTerminalInfo(Context context, String uuid) {
if (loanApplication == null || context == null) return;
DeviceInfo deviceInfo = DeviceInfo.getDeviceInfo(context);
String macAddress = deviceInfo.getMacAddress(context);
HashMap<String, Object> vo = new HashMap<>();
if (!TextUtils.isEmpty(macAddress)) {
String mac = macAddress.replace(":", "");
vo.put("mac", mac);
vo.put("mac1", macAddress);
}
try {
String imei = deviceInfo.getIMEI();
if (!TextUtils.isEmpty(imei)) {
vo.put("imei", imei);
}
} catch (Exception e) {
e.printStackTrace();
vo.put("imei", "");
}
String androidId = deviceInfo.getAndroidId(context);
if (!TextUtils.isEmpty(androidId)) {
vo.put("androidid", androidId);
}
vo.put("os", "android");
vo.put("model", deviceInfo.getMobileModel());
vo.put("uuid", uuid);
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("appPkgList", deviceInfo.getPkgInfo(context));
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
int code = baseResponse.getStatus();
switch (code) {
case 200://成功
if (consumer != null) {
//绑定用户jpush
String userId = String.valueOf(consumer.getPk_id());
JpushManager.getInstance().setJpushService(userId);
}
break;
}
}
});
}
}
......@@ -15,6 +15,7 @@ import com.mints.highgold.mvp.model.UserBean;
import com.mints.highgold.utils.DeviceUuidFactory;
import com.mints.highgold.utils.DevicesUtil;
import com.mints.highgold.utils.ForegroundOrBackground;
import com.mints.highgold.utils.MD5;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import com.mints.library.utils.TLog;
......@@ -111,19 +112,7 @@ public class GsonConverterFactory extends Converter.Factory {
Activity forwardActivity = ForegroundOrBackground.getApp_activity();
try {
if (forwardActivity != null) {
// boolean isMainActivity = forwardActivity instanceof MainActivity;
//
// if (isMainActivity) {
//// ((MainActivity) forwardActivity).MainHandler.sendEmptyMessage(MainActivity.FLAGLOAN);
// UserManager.getInstance().userLogout();
// }
//
// if (!forwardActivity.isFinishing() && !isMainActivity) {
// forwardActivity.startActivity(new Intent(forwardActivity, LoginActivity.class));
// UserManager.getInstance().userLogout();
// }
AppConfig.mainWaterviewStatus = true;
userLogin(forwardActivity);
}
} catch (Exception e) {
......@@ -150,17 +139,14 @@ public class GsonConverterFactory extends Converter.Factory {
@Override
public RequestBody convert(T value) throws IOException {
Buffer buffer = new Buffer();
Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
gson.toJson(value, type, writer);
writer.flush();
return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
}
}
/**
* 游客登录
*
......@@ -174,7 +160,7 @@ public class GsonConverterFactory extends Converter.Factory {
HashMap<String, Object> vo = new HashMap<>();
String uuid = new DeviceUuidFactory(loanApplication).getDeviceUuid().toString();
vo.put("device", uuid);
vo.put("seq", MD5.GetMD5Code(DevicesUtil.getPesudoUniqueID()+System.currentTimeMillis()));
loanApplication.getLoanService().visitorlogin(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
......@@ -197,82 +183,6 @@ public class GsonConverterFactory extends Converter.Factory {
UserBean content = baseResponse.getData();
if (content != null) {
UserManager.getInstance().saveUserInfo(content);
saveTerminalInfo(loanApplication, activity, uuid,content.getConsumer());
}
break;
}
}
});
}
/**
* 提交设备信息
* @param loanApplication
* @param context
* @param uuid
* @param consumer
*/
private void saveTerminalInfo(MintsApplication loanApplication, Activity context, String uuid, UserBean.ConsumerBean consumer) {
if (loanApplication == null || context == null) return;
DeviceInfo deviceInfo = DeviceInfo.getDeviceInfo(context);
String macAddress = deviceInfo.getMacAddress(context);
HashMap<String, Object> vo = new HashMap<>();
if (!TextUtils.isEmpty(macAddress)) {
String mac = macAddress.replace(":", "");
vo.put("mac", mac);
vo.put("mac1", macAddress);
}
try {
String imei = deviceInfo.getIMEI();
if (!TextUtils.isEmpty(imei)) {
vo.put("imei", imei);
}
} catch (Exception e) {
e.printStackTrace();
vo.put("imei", "");
}
String androidId = deviceInfo.getAndroidId(context);
if (!TextUtils.isEmpty(androidId)) {
vo.put("androidid", androidId);
}
vo.put("os", "android");
vo.put("model", deviceInfo.getMobileModel());
vo.put("uuid", uuid);
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("appPkgList", deviceInfo.getPkgInfo(context));
vo.put("oaid", DevicesUtil.getOaid());
vo.put("tempuuid", DevicesUtil.getPesudoUniqueID());
loanApplication.getLoanService().saveTerminalInfo(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
int code = baseResponse.getStatus();
switch (code) {
case 200://成功
if (consumer != null) {
//绑定用户jpush
String userId = String.valueOf(consumer.getPk_id());
JpushManager.getInstance().setJpushService(userId);
}
break;
}
......
......@@ -15,6 +15,7 @@ import com.mints.highgold.mvp.model.UserBean;
import com.mints.highgold.utils.DeviceUuidFactory;
import com.mints.highgold.utils.DevicesUtil;
import com.mints.highgold.utils.ForegroundOrBackground;
import com.mints.highgold.utils.MD5;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import com.mints.library.utils.TLog;
......@@ -96,41 +97,6 @@ public class HytechGsonConverterFactory extends Converter.Factory {
}
}
}
/**
* 用户登陆失效
*
* @param t
*/
private void loginInvalid(T t) {
if (t instanceof BaseResponse) {
BaseResponse br = (BaseResponse) t;
int code = br.getStatus();
if (code == 401) {
Activity forwardActivity = ForegroundOrBackground.getApp_activity();
try {
if (forwardActivity != null) {
// boolean isMainActivity = forwardActivity instanceof MainActivity;
//
// if (isMainActivity) {
//// ((MainActivity) forwardActivity).MainHandler.sendEmptyMessage(MainActivity.FLAGLOAN);
// UserManager.getInstance().userLogout();
// }
//
// if (!forwardActivity.isFinishing() && !isMainActivity) {
// forwardActivity.startActivity(new Intent(forwardActivity, LoginActivity.class));
// UserManager.getInstance().userLogout();
// }
AppConfig.mainWaterviewStatus = true;
userLogin(forwardActivity);
}
} catch (Exception e) {
TLog.d(Constant.TAG_NAME, "获取最上层activity出错");
}
}
}
}
}
// 在这里创建 从自定类型到ResponseBody 的Converter
......@@ -158,124 +124,4 @@ public class HytechGsonConverterFactory extends Converter.Factory {
}
}
/**
* 游客登录
*
* @param activity
*/
private void userLogin(Activity activity) {
if (activity == null)
return;
MintsApplication loanApplication = (MintsApplication) activity.getApplication();
HashMap<String, Object> vo = new HashMap<>();
String uuid = new DeviceUuidFactory(loanApplication).getDeviceUuid().toString();
vo.put("device", uuid);
loanApplication.getLoanService().visitorlogin(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new BaseSubscriber<BaseResponse<UserBean>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<UserBean> baseResponse) {
int code = baseResponse.getStatus();
switch (code) {
case 200://成功
UserBean content = baseResponse.getData();
if (content != null) {
UserManager.getInstance().saveUserInfo(content);
saveTerminalInfo(loanApplication, activity, uuid,content.getConsumer());
}
break;
}
}
});
}
/**
* 提交设备信息
* @param loanApplication
* @param context
* @param uuid
* @param consumer
*/
private void saveTerminalInfo(MintsApplication loanApplication, Activity context, String uuid, UserBean.ConsumerBean consumer) {
if (loanApplication == null || context == null) return;
DeviceInfo deviceInfo = DeviceInfo.getDeviceInfo(context);
String macAddress = deviceInfo.getMacAddress(context);
HashMap<String, Object> vo = new HashMap<>();
if (!TextUtils.isEmpty(macAddress)) {
String mac = macAddress.replace(":", "");
vo.put("mac", mac);
vo.put("mac1", macAddress);
}
try {
String imei = deviceInfo.getIMEI();
if (!TextUtils.isEmpty(imei)) {
vo.put("imei", imei);
}
} catch (Exception e) {
e.printStackTrace();
vo.put("imei", "");
}
String androidId = deviceInfo.getAndroidId(context);
if (!TextUtils.isEmpty(androidId)) {
vo.put("androidid", androidId);
}
vo.put("os", "android");
vo.put("model", deviceInfo.getMobileModel());
vo.put("uuid", uuid);
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("appPkgList", deviceInfo.getPkgInfo(context));
vo.put("oaid", DevicesUtil.getOaid());
vo.put("tempuuid", DevicesUtil.getPesudoUniqueID());
loanApplication.getLoanService().saveTerminalInfo(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
int code = baseResponse.getStatus();
switch (code) {
case 200://成功
if (consumer != null) {
//绑定用户jpush
String userId = String.valueOf(consumer.getPk_id());
JpushManager.getInstance().setJpushService(userId);
}
break;
}
}
});
}
}
......@@ -238,12 +238,12 @@ public class AlipayBindActivity extends BaseActivity implements AlipayBindView,
if (authResult != null) {
tvAccountAlipaystatus.setText("绑定中");
alipayUserId = authResult.getUserId();
if (!TextUtils.isEmpty(alipayUserId)) {
alipayUserId = authResult.getUserId();
tvAccountAlipaystatus.setText("点击确定,完成绑定");
tvAccountAlipaystatus.setText("授权成功,请点击确定");
alipayFail = true;
} else {
tvAccountAlipaystatus.setText("绑定失败,请手动绑定");
tvAccountAlipaystatus.setText("授权失败,请手动填写");
alipayFail = false;
}
}
......
......@@ -18,7 +18,6 @@ import com.mints.highgold.manager.TTAdManagerHolder;
import com.mints.highgold.manager.TTBannerManager;
import com.mints.highgold.manager.UserManager;
import com.mints.highgold.mvp.model.DrawcashBean;
import com.mints.highgold.mvp.model.UserTaskMsgBean;
import com.mints.highgold.mvp.model.WXInfo;
import com.mints.highgold.mvp.presenters.DrawcashPresenter;
import com.mints.highgold.mvp.views.DrawcashView;
......@@ -32,7 +31,6 @@ import java.util.HashMap;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.sharesdk.framework.Platform;
import cn.sharesdk.framework.ShareSDK;
......@@ -194,8 +192,8 @@ public class DrawcashActivity extends BaseActivity implements DrawcashView, OnLo
if (cashOutMoneyArr != null && cashOutMoneyArr.size() > 1) {
DrawcashBean.CashOutMoneyArrBean moneyArrBean = cashOutMoneyArr.get(0);
DrawcashBean.CashOutMoneyArrBean moneyArrBean1 = cashOutMoneyArr.get(1);
cashOut1yuan = moneyArrBean.isCanCashOut();
cashOut2yuan = moneyArrBean1.isCanCashOut();
cashOut1yuan = moneyArrBean.isCanUseOnce();
cashOut2yuan = moneyArrBean1.isCanUseOnce();
drawcash = moneyArrBean.getMoney();
}
......@@ -203,21 +201,21 @@ public class DrawcashActivity extends BaseActivity implements DrawcashView, OnLo
initBtnStyle();
if (!cashOut1yuan || !cashOut2yuan) {
if (cashOut1yuan || cashOut2yuan) {
if (cashOut2yuan) {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
btnDrawcashTwo.setEnabled(false);
} else {
curCash = 100;
clickTwo(curCash);
} else {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
btnDrawcashTwo.setEnabled(false);
}
if (cashOut1yuan) {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
btnDrawcashOne.setEnabled(false);
} else {
curCash = drawcash;
clickOne(curCash);
} else {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
btnDrawcashOne.setEnabled(false);
}
} else {
btnDrawcashThree.setEnabled(false);
......@@ -534,10 +532,9 @@ public class DrawcashActivity extends BaseActivity implements DrawcashView, OnLo
private void clickOne(double cash) {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_enable));
if (cashOut2yuan) {
// 提现过一元,显示灰
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
} else {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_none));
} else {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
}
btnDrawcashThree.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_none));
btnDrawcashFour.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_none));
......@@ -549,10 +546,9 @@ public class DrawcashActivity extends BaseActivity implements DrawcashView, OnLo
private void clickTwo(double cash) {
if (cashOut1yuan) {
// 提现过一元,显示灰
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
} else {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_none));
} else {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
}
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_enable));
btnDrawcashThree.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_none));
......@@ -565,16 +561,14 @@ public class DrawcashActivity extends BaseActivity implements DrawcashView, OnLo
private void clickThree(double cash) {
if (cashOut1yuan) {
// 提现过一元,显示灰
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
} else {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_none));
} else {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
}
if (cashOut2yuan) {
// 提现过一元,显示灰
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
} else {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_none));
} else {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
}
btnDrawcashThree.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_enable));
btnDrawcashFour.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_none));
......@@ -585,16 +579,14 @@ public class DrawcashActivity extends BaseActivity implements DrawcashView, OnLo
private void clickFour(double cash) {
if (cashOut1yuan) {
// 提现过一元,显示灰
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
} else {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_none));
} else {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
}
if (cashOut2yuan) {
// 提现过一元,显示灰
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
} else {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_none));
} else {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
}
btnDrawcashThree.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_none));
btnDrawcashFour.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_enable));
......@@ -606,16 +598,14 @@ public class DrawcashActivity extends BaseActivity implements DrawcashView, OnLo
private void clickFive(double cash) {
if (cashOut1yuan) {
// 提现过一元,显示灰
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
} else {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_none));
} else {
btnDrawcashOne.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
}
if (cashOut2yuan) {
// 提现过一元,显示灰
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
} else {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_none));
} else {
btnDrawcashTwo.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_new_dont));
}
btnDrawcashThree.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_none));
btnDrawcashFour.setBackground(getResources().getDrawable(R.mipmap.ic_drawcash_none));
......@@ -677,8 +667,6 @@ public class DrawcashActivity extends BaseActivity implements DrawcashView, OnLo
@Override
public boolean onLogin(String platform, HashMap<String, Object> res) {
try {
wxInfo = new WXInfo();
wxInfo.setUnionid(res.get("unionid") + "");
......@@ -698,8 +686,6 @@ public class DrawcashActivity extends BaseActivity implements DrawcashView, OnLo
showToast("微信授权异常,请使用支付宝");
}
return false;
}
}
......@@ -119,7 +119,7 @@ public class GameFragment extends BaseFragment
if (!TextUtils.isEmpty(userManager.getUserID())) {
gamePresenter.getUserTaskMsg();
} else {
gamePresenter.userLogin(getContext());
gamePresenter.userLogin();
}
}
}
......
......@@ -228,7 +228,6 @@ public class MainFragment extends BaseFragment
@Override
public void onResume() {
super.onResume();
userID = userManager.getUserID();
// ttBanner切换时调用
......@@ -296,7 +295,6 @@ public class MainFragment extends BaseFragment
vo.put("block", Constant.BLOCK_THREE);
loanPresenter.reportTaskMsgV1(vo, CARRIER_TYPE);
} else {
if (userConfig != null) {
......
......@@ -160,7 +160,7 @@ public class MyFragment extends BaseFragment
if (!TextUtils.isEmpty(userManager.getUserID())) {
myPresenter.getUserTaskMsg(false);
} else {
myPresenter.userLogin(getContext());
myPresenter.userLogin();
}
if (bvMyBanner != null) {
......@@ -451,7 +451,7 @@ public class MyFragment extends BaseFragment
if (!TextUtils.isEmpty(userManager.getUserID())) {
myPresenter.getUserTaskMsg(false);
} else {
myPresenter.userLogin(getContext());
myPresenter.userLogin();
}
}
......
......@@ -397,7 +397,7 @@ public class VersusFragment extends BaseFragment
if (!TextUtils.isEmpty(userID)) {
versusPresenter.getUserTaskMsg(false);
} else {
versusPresenter.userLogin(getContext());
versusPresenter.userLogin();
}
//首页fragment 只有点击tab时切换banner
......@@ -1677,7 +1677,7 @@ public class VersusFragment extends BaseFragment
if (!TextUtils.isEmpty(userID)) {
versusPresenter.getUserTaskMsg(false);
} else {
versusPresenter.userLogin(getContext());
versusPresenter.userLogin();
}
}
......
highgold/app/src/main/res/mipmap-xhdpi/bg_redbox_bottom.png

40.4 KB | W: | H:

highgold/app/src/main/res/mipmap-xhdpi/bg_redbox_bottom.png

199 KB | W: | H:

highgold/app/src/main/res/mipmap-xhdpi/bg_redbox_bottom.png
highgold/app/src/main/res/mipmap-xhdpi/bg_redbox_bottom.png
highgold/app/src/main/res/mipmap-xhdpi/bg_redbox_bottom.png
highgold/app/src/main/res/mipmap-xhdpi/bg_redbox_bottom.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment