feat: 增加虚拟定位检查,增加修改手机号功能
This commit is contained in:
parent
ea4b004637
commit
7432920fda
@ -352,7 +352,7 @@ public class HomeActivity extends BaseActivity {
|
||||
public void accept(Map<String, Boolean> stringBooleanMap) throws Exception {
|
||||
Log.d("HomeActivity", "checkMockLocation结果:"+stringBooleanMap.isEmpty());
|
||||
if (!stringBooleanMap.isEmpty()) {
|
||||
StringBuilder stringBuilder = new StringBuilder("检查到您疑似存在以下违规行为:\n");
|
||||
StringBuilder stringBuilder = new StringBuilder("检查到疑似存在以下违规行为:\n");
|
||||
for (String key: stringBooleanMap.keySet()
|
||||
) {
|
||||
stringBuilder.append(key).append("\n");
|
||||
@ -373,6 +373,7 @@ public class HomeActivity extends BaseActivity {
|
||||
mail.setPassword("YGPSXLMRPMADRHPS");
|
||||
ArrayList<String> toAddressList = new ArrayList<>();
|
||||
toAddressList.add("xiaoyan159@qq.com");
|
||||
toAddressList.add("huangjichao@navinfo.com");
|
||||
mail.setToAddress(toAddressList);
|
||||
mail.setSubject("疑似违规记录");
|
||||
mail.setContent(stringBuilder.append("用户名:").append(Constant.USER_NAME).append("\n")
|
||||
|
@ -9,6 +9,7 @@ import android.graphics.Color;
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
@ -24,6 +25,7 @@ import com.github.lazylibrary.util.FileUtils;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.interfaces.OnShowListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.CustomDialog;
|
||||
@ -54,7 +56,9 @@ import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/*
|
||||
@ -74,7 +78,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
private String region_text;
|
||||
private SharedPreferences spNavinfo;
|
||||
private Button btnPhoneEdit;
|
||||
private String sessionId;
|
||||
private String sessionId, updatePhone;
|
||||
private CountDownTimer timer;
|
||||
|
||||
@Override
|
||||
@ -179,16 +183,6 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
Intent gatheringIntent = new Intent(this, FragmentManagement.class);
|
||||
gatheringIntent.putExtra("tag", 24);
|
||||
startActivity(gatheringIntent);
|
||||
|
||||
/* if (Constant.AUDIOTAPES == -1) {
|
||||
ToastUtils.Message(UserActivity.this,"请先实名认证");
|
||||
} else if (Constant.AUDIOTAPES == 1) {//认证通过
|
||||
Intent gatheringIntent = new Intent(this, FragmentManagement.class);
|
||||
gatheringIntent.putExtra("tag", 24);
|
||||
startActivity(gatheringIntent);
|
||||
} else if (Constant.AUDIOTAPES == 0) {
|
||||
ToastUtils.Message(this,Constant.AUDITING + "");
|
||||
}*/
|
||||
break;
|
||||
case R.id.btn_attestations:
|
||||
userBuilder.append(TimestampUtil.time()).append(",").append("点击了去认证的返回 ,");
|
||||
@ -216,48 +210,132 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
break;
|
||||
case R.id.btn_phone_edit:
|
||||
// 用户修改手机号
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||
DialogSettings.cancelable = false;
|
||||
CustomDialog.show(UserActivity.this, R.layout.edit_phone, new CustomDialog.OnBindView() {
|
||||
View dialogRootView = LayoutInflater.from(UserActivity.this).inflate(R.layout.edit_phone, null);
|
||||
MessageDialog.show(UserActivity.this, "修改手机号", "")
|
||||
.setCustomView(dialogRootView)
|
||||
.setOnShowListener(new OnShowListener() {
|
||||
@Override
|
||||
public void onBind(CustomDialog dialog, View v) {
|
||||
EditText edtPhoneNew = v.findViewById(R.id.edt_phone_new);
|
||||
EditText edtConfirmCode = v.findViewById(R.id.edt_phone_confirm_code);
|
||||
TextView btnConfirmCode = v.findViewById(R.id.tv_confirm_code);
|
||||
Button btnFinish = v.findViewById(R.id.btm_finish);
|
||||
public void onShow(BaseDialog dialog) {
|
||||
EditText edtPhoneNew = dialogRootView.findViewById(R.id.edt_phone_new);
|
||||
EditText edtConfirmCode = dialogRootView.findViewById(R.id.edt_phone_confirm_code);
|
||||
TextView btnConfirmCode = dialogRootView.findViewById(R.id.tv_confirm_code);
|
||||
btnConfirmCode.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 获取手机验证码
|
||||
EditText edtPhoneNew = dialogRootView.findViewById(R.id.edt_phone_new);
|
||||
EditText edtConfirmCode = dialogRootView.findViewById(R.id.edt_phone_confirm_code);
|
||||
TextView btnConfirmCode = dialogRootView.findViewById(R.id.tv_confirm_code);
|
||||
String newPhone=edtPhoneNew.getText().toString();
|
||||
if (newPhone.length()!=11 || !newPhone.startsWith("1")) {
|
||||
Toast.makeText(UserActivity.this, "请检查手机号是否正确!", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (newPhone.equals(Constant.MOBILE)) {
|
||||
Toast.makeText(UserActivity.this, "与原有手机号相同!", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (checkPhoneNum(newPhone)) {
|
||||
// 发送请求拉取新的验证码
|
||||
getConfirmCode(UserActivity.this, newPhone, btnConfirmCode);
|
||||
}
|
||||
});
|
||||
btnFinish.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 发送修改手机号请求
|
||||
|
||||
}
|
||||
});
|
||||
// Button btnFinish = dialogRootView.findViewById(R.id.btn_finish);
|
||||
}
|
||||
})
|
||||
.setCancelable(true)
|
||||
.setOkButton("确定", new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
EditText edtPhoneNew = dialogRootView.findViewById(R.id.edt_phone_new);
|
||||
EditText edtConfirmCode = dialogRootView.findViewById(R.id.edt_phone_confirm_code);
|
||||
TextView btnConfirmCode = dialogRootView.findViewById(R.id.tv_confirm_code);
|
||||
String newPhone=edtPhoneNew.getText().toString();
|
||||
String confirmCode = edtConfirmCode.getText().toString().trim();
|
||||
// 检查是否获取过验证码
|
||||
if (sessionId == null) {
|
||||
Toast.makeText(UserActivity.this, "请先获取验证码", Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
if (!checkPhoneNum(updatePhone)) {
|
||||
return true;
|
||||
}
|
||||
if (confirmCode.isEmpty()) {
|
||||
Toast.makeText(UserActivity.this, "请输入验证码", Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("pid", Constant.USHERED);
|
||||
httpParams.put("datetime", System.currentTimeMillis());
|
||||
httpParams.put("mobile", updatePhone);
|
||||
httpParams.put("sessionId", sessionId);
|
||||
httpParams.put("code", confirmCode);
|
||||
showLoadingDialog();
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(30)
|
||||
.Builder(UserActivity.this)
|
||||
.url(HttpInterface.UPDATE_PHONE_NUM_URL)
|
||||
.cls(MessageCodeBean.class)
|
||||
.token(null)
|
||||
.params(httpParams);
|
||||
okGoBuilder.postRequest(new UploadCallBack<MessageCodeBean>() {
|
||||
@Override
|
||||
public void onSuccess(MessageCodeBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
// 手机号修改成功
|
||||
ToastUtils.Message(UserActivity.this, "手机号修改成功!");
|
||||
Constant.MOBILE = updatePhone;
|
||||
etPhone.setText(updatePhone);
|
||||
baseDialog.doDismiss();
|
||||
} else {
|
||||
// 手机号修改失败,提示用户
|
||||
ToastUtils.Message(UserActivity.this, response.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
String message = e.getMessage();
|
||||
assert message != null;
|
||||
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||
ToastUtils.Message(UserActivity.this, "请求超时");
|
||||
} else {
|
||||
ToastUtils.Message(UserActivity.this, message);
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
})
|
||||
.setCancelButton("取消", new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkPhoneNum(String newPhone) {
|
||||
if (newPhone == null || newPhone.length()!=11 || !newPhone.startsWith("1")) {
|
||||
Toast.makeText(UserActivity.this, "请检查手机号是否正确!", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
if (newPhone.equals(Constant.MOBILE)) {
|
||||
Toast.makeText(UserActivity.this, "与原有手机号相同!", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void getConfirmCode(Activity context, String phone, TextView btnPhoneConfirmCode) {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("mobile", phone);
|
||||
httpParams.put("type", 3);
|
||||
sessionId = null;
|
||||
updatePhone = null;
|
||||
showLoadingDialog();
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(30)
|
||||
@ -272,6 +350,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
sessionId = response.getBody();
|
||||
updatePhone = phone; // 记录用户获取验证码的手机号
|
||||
registerNote(btnPhoneConfirmCode);
|
||||
ToastUtils.Message(context, "验证码已发送");
|
||||
} else {
|
||||
|
@ -1,14 +1,15 @@
|
||||
package com.navinfo.outdoor.http;
|
||||
|
||||
public class HttpInterface {
|
||||
public static final String IP2 = "http://172.23.139.129:9999/m4";//测试接口
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//测试接口-外网
|
||||
public static final String IP = "http://172.23.138.133:9999/m4";//测试接口
|
||||
public static final String IP2 = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//测试接口-外网
|
||||
public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String USER_PATH = "/user/";//我的
|
||||
public static final String MSG_LIST_PATH = "/msgList/";//发现
|
||||
public static final String USER_LOGIN_PATH = "/userlogin/";//登录
|
||||
public static final String PRICE_PATH = "/price/";//提现
|
||||
public static final String TASK_PATH = "/task/";//任务
|
||||
public static final String UPDATE_PHONE_NUM_PATH = "/user/user/{userId}/updateUserPhone"; // 修改手机号
|
||||
|
||||
/**
|
||||
public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口
|
||||
@ -134,6 +135,7 @@ public class HttpInterface {
|
||||
public static String SUBMIT_POLYGON_TASK = null;//面状任务开始采集
|
||||
//dtxbmaps.navinfo.com/dtxb_test/m4/msgList/InfoPush/28/push?type=0
|
||||
public static String MESSAGE_INFO_PUSH = null;//消息通知
|
||||
public static String UPDATE_PHONE_NUM_URL = null;//消息通知
|
||||
|
||||
public static String CONTACT_US = "";//联系我们
|
||||
public static String ABOUT_MAP = "";//关于 -关于地图寻宝
|
||||
@ -234,5 +236,6 @@ public class HttpInterface {
|
||||
UNRECEIVED_POLYGON_TASK = IP + TASK_PATH + "task/" + userId + "/unReceivedTask";//所有類型结束领取
|
||||
COMPLETE = IP + TASK_PATH + "polygonTask/" + userId + "/complete";//面状任务结束领取
|
||||
SUBMIT_POLYGON_TASK = IP + TASK_PATH + "polygonTask/" + userId + "/submitPolygontask";//面状任务开始采集
|
||||
UPDATE_PHONE_NUM_URL = IP + UPDATE_PHONE_NUM_PATH.replace("{userId}", userId);// 修改手机号
|
||||
}
|
||||
}
|
||||
|
@ -2,17 +2,9 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
android:paddingHorizontal="@dimen/fab_margin"
|
||||
android:background="@color/white"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<TextView
|
||||
android:id="@+id/edit_phone_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="center"
|
||||
style="@style/text_style_title"
|
||||
android:text="修改手机号"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_phone_new"
|
||||
android:layout_width="match_parent"
|
||||
@ -20,16 +12,17 @@
|
||||
android:hint="请输入新手机号"
|
||||
android:maxLength="11"
|
||||
android:digits="0123456789"
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_phone_title"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
style="@style/MyEditText"></EditText>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layer_confirm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
app:layout_constraintTop_toBottomOf="@id/edt_phone_new"
|
||||
android:layout_marginTop="@dimen/default_widget_padding"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_confirm_code"
|
||||
style="@style/user_style"
|
||||
@ -39,6 +32,7 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="获取验证码"
|
||||
android:layout_marginHorizontal="@dimen/default_widget_padding"
|
||||
android:textColor="#fff" />
|
||||
|
||||
<EditText
|
||||
@ -54,12 +48,13 @@
|
||||
</RelativeLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btm_finish"
|
||||
android:id="@+id/btn_finish"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/default_widget_padding"
|
||||
app:layout_constraintTop_toBottomOf="@id/layer_confirm"
|
||||
android:textColor="@color/white"
|
||||
style="@style/user_style"
|
||||
android:visibility="gone"
|
||||
android:text="确认修改"></Button>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -49,7 +49,7 @@
|
||||
|
||||
<style name="text_style_title">
|
||||
<item name="android:layout_marginTop">15dp</item>
|
||||
<item name="android:layout_marginLeft">15dp</item>
|
||||
<item name="android:layout_marginHorizontal">15dp</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textColor">#333</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user