|
@@ -2,6 +2,7 @@ package com.hw.nativeapp.ui.activity;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
import android.app.ProgressDialog;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.CountDownTimer;
|
|
@@ -71,6 +72,8 @@ public class PurchaseInfoActivity extends BaseActivity {
|
|
|
TextView tx_player;
|
|
|
@BindView(R.id.tx_personnelNum)
|
|
|
TextView tx_personnelNum;
|
|
|
+ @BindView(R.id.tx_isAuth)
|
|
|
+ TextView tx_isAuth;
|
|
|
|
|
|
public static final Integer COUNTDOWN_TIME = 240000;
|
|
|
private CountDownTimer timer;
|
|
@@ -88,6 +91,7 @@ public class PurchaseInfoActivity extends BaseActivity {
|
|
|
private String date = "";
|
|
|
private String goodsId = "";
|
|
|
private Integer personnelNum = 1;
|
|
|
+ private Integer isAuth = 1;
|
|
|
private Integer goodsSaleNum = 1;
|
|
|
private String salePeice = "";
|
|
|
private String performTimeId = "";
|
|
@@ -170,10 +174,29 @@ public class PurchaseInfoActivity extends BaseActivity {
|
|
|
ToastUtils.showShortToast(this, "身份证信息为空");
|
|
|
return;
|
|
|
}
|
|
|
- if (!IdNumberUtils.isValidatedAllIdcard(idcard)){
|
|
|
- ToastUtils.showShortToast(this, "身份证格式错误");
|
|
|
- return;
|
|
|
+ if (isAuth != null && isAuth.equals(1)){
|
|
|
+ if (!IdNumberUtils.isValidatedAllIdcard(idcard)){
|
|
|
+ ToastUtils.showShortToast(this, "身份证格式错误");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ factorAuth(name, idcard, new OnAuthCall() {
|
|
|
+ @Override
|
|
|
+ public void success() {
|
|
|
+ addTouristSuccess(name, idcard);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void fail() {
|
|
|
+ ToastUtils.showLongToast(PurchaseInfoActivity.this,name +":实名认证失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ addTouristSuccess(name, idcard);
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addTouristSuccess(String name, String idcard){
|
|
|
TouristEntity touristEntity = new TouristEntity();
|
|
|
touristEntity.name = name;
|
|
|
touristEntity.idcard = idcard;
|
|
@@ -298,6 +321,7 @@ public class PurchaseInfoActivity extends BaseActivity {
|
|
|
auditoriumId = transmitIntent.getStringExtra("auditoriumId");
|
|
|
goodsId = transmitIntent.getStringExtra("goodsId");
|
|
|
personnelNum = transmitIntent.getIntExtra("personnelNum",1);
|
|
|
+ isAuth = transmitIntent.getIntExtra("isAuth",1);
|
|
|
salePeice = transmitIntent.getStringExtra("salePeice");
|
|
|
performTimeId = transmitIntent.getStringExtra("performTimeId");
|
|
|
seatTypeId = transmitIntent.getStringExtra("seatTypeId");
|
|
@@ -305,6 +329,11 @@ public class PurchaseInfoActivity extends BaseActivity {
|
|
|
if (!StringUtils.isEmpty(mMobile)){
|
|
|
tx_player.setText(mMobile);
|
|
|
}
|
|
|
+ if (isAuth != null && isAuth.equals(1)){
|
|
|
+ tx_isAuth.setText("(需实名)");
|
|
|
+ }else {
|
|
|
+ tx_isAuth.setText("(无需实名)");
|
|
|
+ }
|
|
|
tx_personnelNum.setText(String.valueOf(personnelNum));
|
|
|
}
|
|
|
|
|
@@ -444,4 +473,40 @@ public class PurchaseInfoActivity extends BaseActivity {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ // 二要数认证
|
|
|
+ @SuppressLint("CheckResult")
|
|
|
+ private void factorAuth(String name, String idcard, OnAuthCall call){
|
|
|
+ JSONObject options = new JSONObject();
|
|
|
+ options.put("name", name);
|
|
|
+ options.put("idcard", idcard);
|
|
|
+ MApplication.getApiService().factorAuth( options, System.currentTimeMillis() / 1000)
|
|
|
+ .compose(RxUtil.applyObservableAsync())
|
|
|
+ .subscribe(new ResponseConsumer<JSONObject>() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(JSONObject data) {
|
|
|
+ if(data.getIntValue("status") == 1) {
|
|
|
+ if (call != null){
|
|
|
+ call.success();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (call != null){
|
|
|
+ call.fail();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailed(int code, String msg) {
|
|
|
+ if (call != null){
|
|
|
+ call.fail();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, new ErrorConsumer());
|
|
|
+ }
|
|
|
+
|
|
|
+ public interface OnAuthCall{
|
|
|
+ void success();
|
|
|
+ void fail();
|
|
|
+ }
|
|
|
}
|