|
@@ -2,6 +2,11 @@ package com.ynstkz.shitu.android.data;
|
|
|
|
|
|
import com.common.library.okhttp.OkHttpUtils;
|
|
|
import com.common.library.okhttp.callback.Callback;
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.ynstkz.shitu.android.application.STSign;
|
|
|
+import com.ynstkz.shitu.android.bean.UserBean;
|
|
|
+
|
|
|
+import org.json.JSONObject;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
@@ -19,6 +24,11 @@ public class RequestGroup {
|
|
|
*/
|
|
|
public static Map<String, String> getSystemParams() {
|
|
|
Map<String, String> params = new HashMap<>();
|
|
|
+ if(SharedPreferencesUtils.isLogin()){
|
|
|
+ UserBean userBean = STSign.getInstance().getUser();
|
|
|
+ params.put("token", userBean.getToken());
|
|
|
+ params.put("userId", userBean.getUserId());
|
|
|
+ }
|
|
|
return params;
|
|
|
}
|
|
|
|
|
@@ -35,7 +45,7 @@ public class RequestGroup {
|
|
|
params.put("userName", userName);
|
|
|
params.put("pwd", pwd);
|
|
|
params.put("rePwd", rePwd);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_REGISTER).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_REGISTER).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -48,7 +58,7 @@ public class RequestGroup {
|
|
|
Map<String, String> params = getSystemParams();
|
|
|
params.put("userName", userName);
|
|
|
params.put("userPwd", userPwd);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_LOGIN).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_LOGIN).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -68,7 +78,7 @@ public class RequestGroup {
|
|
|
Map<String, String> params = getSystemParams();
|
|
|
params.put("type", type);
|
|
|
params.put("mobile", mobile);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_SMS_SEND).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_SMS_SEND).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -81,7 +91,7 @@ public class RequestGroup {
|
|
|
params.put("type", type);
|
|
|
params.put("mobile", mobile);
|
|
|
params.put("code", code);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_SMS_VERIFY).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_SMS_VERIFY).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -104,7 +114,7 @@ public class RequestGroup {
|
|
|
params.put("isParent", isParent);
|
|
|
params.put("realName", realName);
|
|
|
params.put("idCardNum", idCardNum);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_USER_AUTH).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_USER_AUTH).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -118,7 +128,7 @@ public class RequestGroup {
|
|
|
params.put("mobile", mobile);
|
|
|
params.put("pwd", pwd);
|
|
|
params.put("rePwd", rePwd);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_USER_FINDPWD).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_USER_FINDPWD).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -126,7 +136,7 @@ public class RequestGroup {
|
|
|
*/
|
|
|
public static void userInfo(Callback callback){
|
|
|
Map<String, String> params = getSystemParams();
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_USER_INFO).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_USER_INFO).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -138,7 +148,7 @@ public class RequestGroup {
|
|
|
Map<String, String> params = getSystemParams();
|
|
|
params.put("mobile", mobile);
|
|
|
params.put("code", code);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_LOGIN_CODE).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_LOGIN_CODE).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -150,7 +160,7 @@ public class RequestGroup {
|
|
|
Map<String, String> params = getSystemParams();
|
|
|
params.put("thirdId", thirdId);
|
|
|
params.put("thirdType", thirdType);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_LOGIN_THIRD).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_LOGIN_THIRD).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -160,7 +170,7 @@ public class RequestGroup {
|
|
|
*/
|
|
|
public static void userResetHeadpic(String headPic, Callback callback){
|
|
|
Map<String, String> params = getSystemParams();
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_USER_HEADPIC).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_USER_HEADPIC).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -170,7 +180,7 @@ public class RequestGroup {
|
|
|
public static void userResetMobile(String mobile, Callback callback){
|
|
|
Map<String, String> params = getSystemParams();
|
|
|
params.put("mobile", mobile);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_USER_RESET_MOBILE).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_USER_RESET_MOBILE).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -181,7 +191,7 @@ public class RequestGroup {
|
|
|
params.put("oldPwd", oldPwd);
|
|
|
params.put("pwd", pwd);
|
|
|
params.put("rePwd", rePwd);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_USER_RESET_PWD).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_USER_RESET_PWD).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -191,6 +201,6 @@ public class RequestGroup {
|
|
|
public static void userResetUsername(String userName, Callback callback){
|
|
|
Map<String, String> params = getSystemParams();
|
|
|
params.put("userName", userName);
|
|
|
- OkHttpUtils.post().url(UrlCat.URL_USER_RESET_USERNAME).params(params).build().execute(callback);
|
|
|
+ OkHttpUtils.postString().url(UrlCat.URL_USER_RESET_USERNAME).content(new Gson().toJson(params)).build().execute(callback);
|
|
|
}
|
|
|
}
|