diff --git a/config.gradle b/config.gradle index cb4fb0dff..6f5c50bd0 100644 --- a/config.gradle +++ b/config.gradle @@ -23,7 +23,7 @@ ext { baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB", baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", // true表示谷歌支付 false - isGooglePlay : false, + isGooglePlay : true, //是否上报异常日志 isUploadLog : false ] diff --git a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java index 17e9aaae5..335212217 100644 --- a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java @@ -110,7 +110,6 @@ public class LoginActivity extends AbsActivity { String channelCode = appData.getChannel(); //获取自定义数据 String bindData = appData.getData(); - Toast.makeText(LoginActivity.this, "" + appData.toString(), Toast.LENGTH_LONG); Log.d("OpenInstall", "getInstall : installData = " + appData.toString()); } }); diff --git a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java index a56ccfc9f..2ccbd912e 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -20,6 +20,7 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import android.widget.Toast; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -119,6 +120,8 @@ public class RegisterActivity extends AbsActivity { mBtnRegister = findViewById(R.id.btn_register); edit_invitecode_2 = (EditText) findViewById(R.id.edit_invitecode_2); yqm_view = (LinearLayout) findViewById(R.id.yqm_view); + //获取设备唯一标识符 + getUuidDevice(); getPromoCode(); mGetCode = WordUtil.getString(R.string.reg_get_code); @@ -275,8 +278,7 @@ public class RegisterActivity extends AbsActivity { int i = v.getId(); if (i == R.id.btn_code) { webview.setVisibility(View.VISIBLE); - //获取设备唯一标识符 - getUuidDevice(); + } else if (i == R.id.btn_register) { register(); } else if (i == R.id.btn_tip2) { @@ -361,8 +363,13 @@ public class RegisterActivity extends AbsActivity { if (mDialog != null) { mDialog.show(); } - - MainHttpUtil.register(edit_invitecode_2.getText().toString().trim(), phoneNum, mPromoCode, mUuidDevice, mCountryCode, pwd, pwd2, code, new HttpCallback() { + String ti = ""; + if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")){ + ti = ""; + }else{ + ti = edit_invitecode_2.getText().toString().trim(); + } + MainHttpUtil.register(ti, phoneNum, mPromoCode, mUuidDevice, mCountryCode, pwd, pwd2, code, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { @@ -397,9 +404,24 @@ public class RegisterActivity extends AbsActivity { //获取自定义数据 if (appData.getData() != null && !appData.getData().equals("")) { JSONObject data = JSON.parseObject(appData.getData()); - mPromoCode = data.getString("admin_id") + ""; if (!mPromoCode.equals("")) { yqm_view.setVisibility(View.GONE); + }else if (CommonAppConfig.IS_GOOGLE_PLAY == true) { + yqm_view.setVisibility(View.VISIBLE); + MainHttpUtil.getDeviceLoginType(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if(code == 201){ + edit_invitecode_2.setText("此設備已註冊"); + edit_invitecode_2.setEnabled(false); + } + } + }); + }else{ + //推广的码 + mPromoCode = data.getString("admin_id") + ""; + //用户的码 + mPromoCode = data.getString("user_id") + ""; } Log.d("OpenInstall", "appData.getData()1111= " + mPromoCode); } diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java index ac91b309d..e70252a60 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java @@ -703,6 +703,15 @@ public class MainHttpUtil { } }); } + /** + * 获取设备号有没有注册过 + */ + public static void getDeviceLoginType( HttpCallback callback) { + HttpClient.getInstance().get("Login.getDeviceLoginType", "Login.getDeviceLoginType") + .params("uuid_Device", DeviceUtils.getUniqueDeviceId()) + .execute(callback); + + } }