添加用户认证的bug
This commit is contained in:
parent
43aefade53
commit
8db838ad54
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '29.0.2'
|
||||
//ndkVersion '23.0.7123448'
|
||||
ndkVersion '23.0.7123448'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
|
@ -137,7 +137,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
@Override
|
||||
public void onSuccess(LoginOauthTokenBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(LoginActivity.this, response.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_SHORT).show();
|
||||
if (response.getCode()==200){
|
||||
LoginOauthTokenBean.BodyBean body = response.getBody();
|
||||
navInfoEditor.putString("access_token",body.getAccess_token());
|
||||
@ -154,6 +154,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}else {
|
||||
Toast.makeText(LoginActivity.this, response.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
@ -31,6 +31,7 @@ import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.adapter.BankAdapter;
|
||||
@ -38,8 +39,10 @@ import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.BankPathBean;
|
||||
import com.navinfo.outdoor.bean.BankPhoneBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.GetJsonDataUtil;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
@ -64,7 +67,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
private EditText etBankNum;
|
||||
private ImageView gatheringCamera;
|
||||
private String gatheringPath;
|
||||
private ArrayList<File> gatheringList;
|
||||
|
||||
private ArrayList<BankPathBean> jsonBean;
|
||||
private String value;
|
||||
private SharedPreferences navInfo;
|
||||
@ -171,15 +174,11 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
|
||||
private void gatheringNetWork() {
|
||||
gatheringList = new ArrayList<>();
|
||||
ArrayList<File> gatheringList = new ArrayList<>();
|
||||
if (gatheringCamera.getTag() == null){
|
||||
Toast.makeText(getContext(), "请先拍银行卡", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
// if (!gatheringFile.exists()) {
|
||||
// Toast.makeText(getContext(), "身份证照片不能为空", Toast.LENGTH_SHORT).show();
|
||||
// return;
|
||||
// }
|
||||
String gatheringCameraTag = (String) gatheringCamera.getTag();
|
||||
gatheringList.add(new File(gatheringCameraTag));
|
||||
String etBankAccount = etBankNum.getText().toString().trim();
|
||||
@ -190,7 +189,47 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGo
|
||||
|
||||
HttpParams httpParams = new HttpParams();
|
||||
|
||||
httpParams.put("userid", Constant.USERID);
|
||||
httpParams.put("bankAccount", value);//银行id
|
||||
httpParams.put("idNumber", etBankAccount);//银行卡号
|
||||
OkGoBuilder.getInstance().Builder(getActivity())
|
||||
.url(HttpInterface.USER_BANKCARD_UP_DATA)
|
||||
.cls(BankPhoneBean.class)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.params(httpParams)
|
||||
.fileList( gatheringList)
|
||||
.postFileAsynchronous(new Callback<BankPhoneBean>() {
|
||||
@Override
|
||||
public void onSuccess(BankPhoneBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode()==200){
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "绑定成功", "确定", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
getActivity().finish();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}else {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "绑定失败", "取消", "取消", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
}
|
||||
});
|
||||
/*OkGo
|
||||
// 请求方式和请求url
|
||||
.<BankPhoneBean>post(HttpInterface.USER_BANKCARD_UP_DATA)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
@ -231,7 +270,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
Toast.makeText(getActivity(), response.message(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.message());
|
||||
}
|
||||
});
|
||||
});*/
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
Glide.with(getActivity()).load(R.drawable.mine_harder).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(imageHeard);
|
||||
imageHeard.setOnClickListener(this::onClick);
|
||||
tvName = findViewById(R.id.tv_name);
|
||||
tvName.setText(Constant.USERNAME);
|
||||
tvName.setOnClickListener(this::onClick);
|
||||
tvMoney = findViewById(R.id.tv_money);
|
||||
imageShare = findViewById(R.id.image_share);
|
||||
|
@ -124,8 +124,11 @@ public class RegisterFragment extends BaseFragment implements View.OnClickListen
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
sessionId = response.getBody();
|
||||
Toast.makeText(getActivity(), "注册成功", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
Toast.makeText(getContext(), response.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,13 +23,16 @@ import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.NameAuthenticationBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.navinfo.outdoor.util.PhotoUtils;
|
||||
@ -137,7 +140,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!chineseNameTest(etAttestationName.getText().toString())){
|
||||
if (!chineseNameTest(etAttestationName.getText().toString())) {
|
||||
Toast.makeText(getActivity(), "请输入中文名字", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
@ -149,9 +152,10 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
break;
|
||||
}
|
||||
}
|
||||
/***
|
||||
*
|
||||
*/
|
||||
|
||||
/***
|
||||
*
|
||||
*/
|
||||
public boolean checkNum(String text) {
|
||||
Pattern patternSfzhm1 = Pattern
|
||||
.compile("^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$");
|
||||
@ -164,6 +168,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
else return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 中文姓名效验
|
||||
*/
|
||||
@ -171,7 +176,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
if (!name.matches("[\u4e00-\u9fa5]{2,4}")) {
|
||||
System.out.println("只能输入2到4个汉字");
|
||||
return false;
|
||||
}else return true;
|
||||
} else return true;
|
||||
}
|
||||
|
||||
private void nameAuthentication() {
|
||||
@ -207,13 +212,53 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
String namePhone = etNamePhone.getText().toString().trim();
|
||||
showLoadingDialog();
|
||||
setLoadingDialogText("实名认证中...");
|
||||
OkGo
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("userid", Constant.USERID);
|
||||
httpParams.put("name", attestationName);
|
||||
httpParams.put("idnum", namePhone);
|
||||
OkGoBuilder.getInstance().Builder(getActivity())
|
||||
.url(HttpInterface.USER_AUTH_ADD)
|
||||
.cls(NameAuthenticationBean.class)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.params(httpParams)
|
||||
.fileList(takePhoneList)
|
||||
.postFileAsynchronous(new Callback<NameAuthenticationBean>() {
|
||||
@Override
|
||||
public void onSuccess(NameAuthenticationBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode()==200){
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
getActivity().finish();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}else {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: sss********sssssssssssss 失败" + e.getMessage() + "");
|
||||
}
|
||||
});
|
||||
/* OkGo
|
||||
// 请求方式和请求url
|
||||
.<NameAuthenticationBean>post(HttpInterface.USER_AUTH_ADD)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("userid", "1")
|
||||
.params("name", attestationName)
|
||||
.params("idnum", namePhone)
|
||||
|
||||
|
||||
.addFileParams("file", takePhoneList)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<NameAuthenticationBean>(NameAuthenticationBean.class) {
|
||||
@ -250,7 +295,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
Toast.makeText(getActivity(), response.message(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.message());
|
||||
}
|
||||
});
|
||||
});*/
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -262,11 +307,11 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
}else {
|
||||
} else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation1);
|
||||
tvCard1.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
file = null;
|
||||
ivHera1.setVisibility(View.GONE);
|
||||
tvCard1.setVisibility(View.GONE);
|
||||
// int height = bitmap.getHeight();
|
||||
@ -282,16 +327,16 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}else if (requestCode == 122 && resultCode == RESULT_OK) {
|
||||
} else if (requestCode == 122 && resultCode == RESULT_OK) {
|
||||
if (file == null || !file.exists()) {
|
||||
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
}else {
|
||||
} else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation2);
|
||||
tvCard2.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
file = null;
|
||||
ivHera2.setVisibility(View.GONE);
|
||||
tvCard2.setVisibility(View.GONE);
|
||||
// int height = bitmap.getHeight();
|
||||
@ -307,16 +352,16 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}else if (requestCode == 123 && resultCode == RESULT_OK) {
|
||||
} else if (requestCode == 123 && resultCode == RESULT_OK) {
|
||||
if (file == null || !file.exists()) {
|
||||
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
}else {
|
||||
} else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation3);
|
||||
tvCard3.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
file = null;
|
||||
ivHera3.setVisibility(View.GONE);
|
||||
tvCard3.setVisibility(View.GONE);
|
||||
// int height = bitmap.getHeight();
|
||||
|
@ -113,9 +113,9 @@ public class HttpInterface {
|
||||
public static final String GET_COMMIT_LIST = IP+TASK_PATH +"m4/task/"+USERID+"/getCommitList";//紀錄——已提交
|
||||
public static final String RECEIVED_POLYGON_TASK = IP+TASK_PATH + "polygonTask/"+USERID+"/receivedPolygontask"; //面状任务任务领取
|
||||
//172.23.139.4:8003/m4/task/1/unReceivedTask?taskIds=&auditIds=214,278 取消领取的接口
|
||||
public static final String UNRECEIVED_POLYGON_TASK = IP+TASK_PATH + "m4/task/"+USERID+"/unReceivedTask";//所有类型结束领取
|
||||
public static final String COMPLETE = IP+TASK_PATH + "polygonTask/"+USERID+"/complete";//面状任务结束采集
|
||||
public static final String SUBMIT_POLYGON_TASK = IP+TASK_PATH + "polygonTask/"+USERID+"/submitPolygontask";//面状任务立即采集
|
||||
public static final String UNRECEIVED_POLYGON_TASK = IP+TASK_PATH + "m4/task/"+USERID+"/unReceivedTask";//所有類型结束领取
|
||||
public static final String COMPLETE = IP+TASK_PATH + "polygonTask/"+USERID+"/complete";//面状任务任务采集
|
||||
public static final String SUBMIT_POLYGON_TASK = IP+TASK_PATH + "polygonTask/"+USERID+"/submitPolygontask";//面状任务结束采集
|
||||
|
||||
/**
|
||||
* public static final String IPm8 = "http://172.23.139.4:8003/m4/";
|
||||
|
Loading…
x
Reference in New Issue
Block a user