|
@@ -12,6 +12,7 @@ import com.yyrh.pay.PaymentNotify;
|
|
import com.yyrh.sdk.SDKEntry;
|
|
import com.yyrh.sdk.SDKEntry;
|
|
import com.yyrh.sdk.callback.ShowPolicyCallback;
|
|
import com.yyrh.sdk.callback.ShowPolicyCallback;
|
|
import com.yyrh.ui.fragment.UserPhoneLoginFragment;
|
|
import com.yyrh.ui.fragment.UserPhoneLoginFragment;
|
|
|
|
+import com.yyrh.ui.fragment.UserPhoneLoginSetpwdFragment;
|
|
import com.yyrh.ui.fragment.UserRetrievePwdFragment;
|
|
import com.yyrh.ui.fragment.UserRetrievePwdFragment;
|
|
import com.yyrh.utils.ResourceUtil;
|
|
import com.yyrh.utils.ResourceUtil;
|
|
import com.yyrh.utils.SignUtils;
|
|
import com.yyrh.utils.SignUtils;
|
|
@@ -31,13 +32,13 @@ import com.yyrh.sdk.callback.RegisterCallback;
|
|
import com.yyrh.ui.ProgressDialogUtils;
|
|
import com.yyrh.ui.ProgressDialogUtils;
|
|
import com.yythird.sdk.ChannelSDK;
|
|
import com.yythird.sdk.ChannelSDK;
|
|
|
|
|
|
-import org.json.JSONArray;
|
|
|
|
|
|
+
|
|
import org.json.JSONException;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
-import java.util.List;
|
|
|
|
|
|
+
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@@ -57,9 +58,10 @@ import static com.yyrh.constant.URLConstants.FASTREGISTER;
|
|
import static com.yyrh.constant.URLConstants.GETCAPTCHA;
|
|
import static com.yyrh.constant.URLConstants.GETCAPTCHA;
|
|
import static com.yyrh.constant.URLConstants.INIT;
|
|
import static com.yyrh.constant.URLConstants.INIT;
|
|
|
|
|
|
|
|
+import static com.yyrh.constant.URLConstants.LOGINWITHSMS;
|
|
import static com.yyrh.constant.URLConstants.QUERYORDER;
|
|
import static com.yyrh.constant.URLConstants.QUERYORDER;
|
|
import static com.yyrh.constant.URLConstants.REALNAMERECORD;
|
|
import static com.yyrh.constant.URLConstants.REALNAMERECORD;
|
|
-import static com.yyrh.constant.URLConstants.RECHARGEINT;
|
|
|
|
|
|
+
|
|
import static com.yyrh.constant.URLConstants.REGISTERWITHPHONE;
|
|
import static com.yyrh.constant.URLConstants.REGISTERWITHPHONE;
|
|
import static com.yyrh.constant.URLConstants.RESETPWDWITHPHONE;
|
|
import static com.yyrh.constant.URLConstants.RESETPWDWITHPHONE;
|
|
import static com.yyrh.constant.URLConstants.RSAKEY;
|
|
import static com.yyrh.constant.URLConstants.RSAKEY;
|
|
@@ -73,7 +75,7 @@ public class NetRequestApi {
|
|
|
|
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_initing")));
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_initing")));
|
|
|
|
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(true);
|
|
|
|
|
|
String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
|
|
String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
|
|
String paramSign = SignUtils.paramSign(map, time);
|
|
String paramSign = SignUtils.paramSign(map, time);
|
|
@@ -144,27 +146,28 @@ public class NetRequestApi {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public static void loginWithYy(boolean isShowPrg, final Activity activity, String account, String password, final LoginCallback loginCallback) {
|
|
|
|
- if (isShowPrg){
|
|
|
|
- ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_logging")));
|
|
|
|
- }
|
|
|
|
|
|
+ public static void loginWithYy(boolean isShowPrg, final Activity activity, String account, String password,String login_token, final LoginCallback loginCallback) {
|
|
|
|
|
|
|
|
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
map.put("smt_type", SignUtils.toURLEncoded(SDKSettings.isSimulator));
|
|
map.put("smt_type", SignUtils.toURLEncoded(SDKSettings.isSimulator));
|
|
|
|
|
|
|
|
+ if (Utils.judgeStrNull(password)){
|
|
|
|
+ map.put("login_token", login_token);
|
|
|
|
+ }else {
|
|
|
|
+ String uname_pwd = null;
|
|
|
|
|
|
- String uname_pwd = null;
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- uname_pwd = SignUtils.encryptRsaByPublicKey(RSAKEY, account + "|" + password);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- // TODO Auto-generated catch block
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ try {
|
|
|
|
+ uname_pwd = SignUtils.encryptRsaByPublicKey(RSAKEY, account + "|" + password);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ // TODO Auto-generated catch block
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ map.put("uname_pwd", uname_pwd);
|
|
}
|
|
}
|
|
- map.put("uname_pwd", uname_pwd);
|
|
|
|
|
|
+
|
|
map.put("package_name", SDKSettings.package_name);
|
|
map.put("package_name", SDKSettings.package_name);
|
|
|
|
|
|
String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
|
|
String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
|
|
@@ -173,21 +176,19 @@ public class NetRequestApi {
|
|
map.put("sign", paramSign);
|
|
map.put("sign", paramSign);
|
|
|
|
|
|
|
|
|
|
- UrlHttpUtil.post(USERLOGIN, map, new CallBackUtil.CallBackString() {
|
|
|
|
|
|
+ UrlHttpUtil.post(activity,USERLOGIN, map, new CallBackUtil.CallBackString() {
|
|
@Override
|
|
@Override
|
|
public void onFailure(int code, String errorMessage) {
|
|
public void onFailure(int code, String errorMessage) {
|
|
- ProgressDialogUtils.dismiss();
|
|
|
|
- new TosUtil(activity, TosUtil.TOAST_ERROR, activity.getString(ResourceUtil.getStringId(activity, "qj_network_error_tip"))).show();
|
|
|
|
|
|
|
|
- loginCallback.onLoginError(activity.getString(ResourceUtil.getStringId(activity, "qj_network_error_tip")));
|
|
|
|
|
|
+ new TosUtil(activity, TosUtil.TOAST_ERROR, activity.getString(ResourceUtil.getStringId(activity, "hnyy_network_error_tip"))).show();
|
|
|
|
+
|
|
|
|
+ loginCallback.onLoginError(activity.getString(ResourceUtil.getStringId(activity, "hnyy_network_error_tip")));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onResponse(String response) {
|
|
public void onResponse(String response) {
|
|
|
|
|
|
|
|
|
|
- ProgressDialogUtils.dismiss();
|
|
|
|
-
|
|
|
|
JSONObject json = null;
|
|
JSONObject json = null;
|
|
JSONObject data = null;
|
|
JSONObject data = null;
|
|
try {
|
|
try {
|
|
@@ -211,7 +212,7 @@ public class NetRequestApi {
|
|
|
|
|
|
SDKSettings.LOGINTAG = LOGIN;
|
|
SDKSettings.LOGINTAG = LOGIN;
|
|
|
|
|
|
- if (loginData.is_rn == 0) {
|
|
|
|
|
|
+ if (Utils.judgeStrNull(loginData.authentication)) {
|
|
SDKSettings.isVefityRealName = false;
|
|
SDKSettings.isVefityRealName = false;
|
|
} else {
|
|
} else {
|
|
SDKSettings.isVefityRealName = true;
|
|
SDKSettings.isVefityRealName = true;
|
|
@@ -226,6 +227,8 @@ public class NetRequestApi {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
public static void registerWithYy(final Activity activity, String account, String password, final RegisterCallback registerCallback) {
|
|
public static void registerWithYy(final Activity activity, String account, String password, final RegisterCallback registerCallback) {
|
|
|
|
|
|
if (ProgressDialogUtils.isShowing()) {
|
|
if (ProgressDialogUtils.isShowing()) {
|
|
@@ -235,7 +238,7 @@ public class NetRequestApi {
|
|
|
|
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_registering")));
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_registering")));
|
|
|
|
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
map.put("smt_type", SignUtils.toURLEncoded(SDKSettings.isSimulator));
|
|
map.put("smt_type", SignUtils.toURLEncoded(SDKSettings.isSimulator));
|
|
@@ -305,7 +308,7 @@ public class NetRequestApi {
|
|
public static void loginWithChannel(final Activity activity, String channelLoginInfo, final LoginCallback loginCallback) {
|
|
public static void loginWithChannel(final Activity activity, String channelLoginInfo, final LoginCallback loginCallback) {
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_logging")));
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_logging")));
|
|
|
|
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
map.put("sdk_params", channelLoginInfo);
|
|
map.put("sdk_params", channelLoginInfo);
|
|
@@ -375,7 +378,7 @@ public class NetRequestApi {
|
|
String roleId, String roleName, String roleLevel, String serverId,
|
|
String roleId, String roleName, String roleLevel, String serverId,
|
|
String serverName, String hasGold, String vipLevel, String role_power, String partyId, String partyName, String createTime, String charge) {
|
|
String serverName, String hasGold, String vipLevel, String role_power, String partyId, String partyName, String createTime, String charge) {
|
|
|
|
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
if (type.equals(Constants.UPLOADTYPE_CREATEROLE)) {
|
|
if (type.equals(Constants.UPLOADTYPE_CREATEROLE)) {
|
|
@@ -500,7 +503,7 @@ public class NetRequestApi {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- HashMap<String, String> orderMap = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> orderMap = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
orderMap.put("uname", loginData.uname);
|
|
orderMap.put("uname", loginData.uname);
|
|
@@ -596,7 +599,7 @@ public class NetRequestApi {
|
|
|
|
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_get_code")));
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_get_code")));
|
|
|
|
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
map.put("phone", SignUtils.toURLEncoded(phone));
|
|
map.put("phone", SignUtils.toURLEncoded(phone));
|
|
@@ -648,13 +651,13 @@ public class NetRequestApi {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public static void registerWithPhone(final Activity activity, String code, String userInfo, final UserPhoneLoginFragment.PhoneRegisterCallback phoneRegisterCallback) {
|
|
|
|
|
|
+ public static void registerWithPhone(final Activity activity, String code, String userInfo, final UserPhoneLoginSetpwdFragment.PhoneRegisterCallback phoneRegisterCallback) {
|
|
if (ProgressDialogUtils.isShowing()) {
|
|
if (ProgressDialogUtils.isShowing()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_registering")));
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_registering")));
|
|
|
|
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
map.put("uname_pwd", userInfo);
|
|
map.put("uname_pwd", userInfo);
|
|
@@ -736,7 +739,7 @@ public class NetRequestApi {
|
|
|
|
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_resetpwd")));
|
|
ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "qj_resetpwd")));
|
|
|
|
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
String uname_pwd = null;
|
|
String uname_pwd = null;
|
|
@@ -798,7 +801,7 @@ public class NetRequestApi {
|
|
}
|
|
}
|
|
|
|
|
|
public static void upLoadUserRealNameInfo(String report_type, String channelRealNameInfo) {
|
|
public static void upLoadUserRealNameInfo(String report_type, String channelRealNameInfo) {
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
map.put("channel_uid", SignUtils.toURLEncoded(loginData.channel_uid));
|
|
map.put("channel_uid", SignUtils.toURLEncoded(loginData.channel_uid));
|
|
@@ -858,7 +861,7 @@ public class NetRequestApi {
|
|
|
|
|
|
public static void recordUserRealNameInfo(Activity activity, String report_type, String channelRealNameInfo) {
|
|
public static void recordUserRealNameInfo(Activity activity, String report_type, String channelRealNameInfo) {
|
|
|
|
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
map.put("channel_uid", SignUtils.toURLEncoded(loginData.channel_uid));
|
|
map.put("channel_uid", SignUtils.toURLEncoded(loginData.channel_uid));
|
|
@@ -921,7 +924,7 @@ public class NetRequestApi {
|
|
}
|
|
}
|
|
|
|
|
|
public static void queryOrder(String order_id, final HashMap<String, Object> payMap) {
|
|
public static void queryOrder(String order_id, final HashMap<String, Object> payMap) {
|
|
- HashMap<String, String> map = getCommonParams();
|
|
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
|
|
|
|
String query_params = (String) payMap.get("query_params");
|
|
String query_params = (String) payMap.get("query_params");
|
|
@@ -1042,29 +1045,98 @@ public class NetRequestApi {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- private static HashMap<String, String> getCommonParams() {
|
|
|
|
- HashMap<String, String> map = new HashMap();
|
|
|
|
|
|
|
|
- map.put("game_code", SignUtils.toURLEncoded(SDKSettings.game_code));
|
|
|
|
- map.put("gcp_code", SignUtils.toURLEncoded(SDKSettings.gcp_code));
|
|
|
|
- map.put("cs_ver", SignUtils.toURLEncoded(SDKSettings.SDK_VERSION));
|
|
|
|
- map.put("system", SignUtils.toURLEncoded(SDKSettings.system));
|
|
|
|
- map.put("ifa", SignUtils.toURLEncoded(SDKSettings.imei));
|
|
|
|
- map.put("device_ver", SignUtils.toURLEncoded(SDKSettings.version));
|
|
|
|
- map.put("sp_code", SignUtils.toURLEncoded(SDKSettings.sp_code));
|
|
|
|
|
|
+ public static void phoneLoginWithSms(final Activity activity, String phone,String code,final UserPhoneLoginFragment.PhoneLoginCallback phoneLoginCallback) {
|
|
|
|
+ if (ProgressDialogUtils.isShowing()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ HashMap<String, String> map = getCommonParams(false);
|
|
|
|
|
|
- map.put("device_model", SignUtils.toURLEncoded(SDKSettings.device_model));
|
|
|
|
- map.put("package_name", SDKSettings.package_name);
|
|
|
|
- map.put("ifa_type", SDKSettings.ifa_type);
|
|
|
|
- map.put("android_id", SDKSettings.android_id);
|
|
|
|
-
|
|
|
|
- if (!Utils.judgeStrNull(SDKSettings.o_cfg)) {
|
|
|
|
- map.put("o_cfg", SDKSettings.o_cfg);
|
|
|
|
- YYLog.i("o_cfg : " + SDKSettings.o_cfg);
|
|
|
|
- } else {
|
|
|
|
- YYLog.i("o_cfg is null");
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ map.put("sms", SignUtils.toURLEncoded(code));
|
|
|
|
+ map.put("phone", SignUtils.toURLEncoded(phone));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
|
|
|
|
+ String paramSign = SignUtils.paramSign(map, time);
|
|
|
|
+ map.put("time", time);
|
|
|
|
+ map.put("sign", paramSign);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ UrlHttpUtil.post(activity,LOGINWITHSMS, map, new CallBackUtil.CallBackString() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onFailure(int code, String errorMessage) {
|
|
|
|
+
|
|
|
|
+ phoneLoginCallback.onPhoneLoginFailed(activity.getString(ResourceUtil.getStringId(activity, "qj_network_error_tip")));
|
|
|
|
+
|
|
|
|
+ YYLog.i(errorMessage);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onResponse(String response) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ JSONObject json = null;
|
|
|
|
+ JSONObject data = null;
|
|
|
|
+ try {
|
|
|
|
+ json = new JSONObject(response);
|
|
|
|
+ data = json.getJSONObject("data");
|
|
|
|
+ } catch (JSONException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ int code = json.optInt("code", -1);
|
|
|
|
+ if (code != 1) {
|
|
|
|
+
|
|
|
|
+ YYLog.i("手机登录失败:" + json.optString("msg", "手机登录失败"));
|
|
|
|
+ phoneLoginCallback.onPhoneLoginFailed(json.optString("msg", "手机登录失败"));
|
|
|
|
+
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (data.optInt("new_user") == 1){
|
|
|
|
+ phoneLoginCallback.onPhoneNewLogin();
|
|
|
|
+ }else{
|
|
|
|
+ SDKSettings.loginData = LoginData.toBean(data);
|
|
|
|
+ YYLog.i("手机注册成功,正在登录游戏。+ token:" + loginData.token);
|
|
|
|
+ phoneLoginCallback.onPhoneLoginSuccess(loginData.token);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private static HashMap<String, String> getCommonParams(boolean isInitApi) {
|
|
|
|
+ HashMap<String, String> map = new HashMap();
|
|
|
|
+ if (isInitApi){
|
|
|
|
+ map.put("game_code", SignUtils.toURLEncoded(SDKSettings.game_code));
|
|
|
|
+ map.put("gcp_code", SignUtils.toURLEncoded(SDKSettings.gcp_code));
|
|
|
|
+ map.put("cs_ver", SignUtils.toURLEncoded(SDKSettings.SDK_VERSION));
|
|
|
|
+ map.put("system", SignUtils.toURLEncoded(SDKSettings.system));
|
|
|
|
+ map.put("ifa", SignUtils.toURLEncoded(SDKSettings.imei));
|
|
|
|
+ map.put("device_ver", SignUtils.toURLEncoded(SDKSettings.version));
|
|
|
|
+ map.put("sp_code", SignUtils.toURLEncoded(SDKSettings.sp_code));
|
|
|
|
+
|
|
|
|
+ map.put("device_model", SignUtils.toURLEncoded(SDKSettings.device_model));
|
|
|
|
+ map.put("package_name", SDKSettings.package_name);
|
|
|
|
+ map.put("ifa_type", SDKSettings.ifa_type);
|
|
|
|
+ map.put("android_id", SDKSettings.android_id);
|
|
|
|
+ if (!Utils.judgeStrNull(SDKSettings.o_cfg)) {
|
|
|
|
+ map.put("o_cfg", SDKSettings.o_cfg);
|
|
|
|
+ YYLog.i("o_cfg : " + SDKSettings.o_cfg);
|
|
|
|
+ } else {
|
|
|
|
+ YYLog.i("o_cfg is null");
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ map.put("access_token", SDKSettings.initConfig.access_token);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|