Commit 0ab1296a2eae2ed7dffe761a63f72618a6b39a79
1 parent
9fdc4a8db3
Exists in
master
登录接口,相关user字段修改
Showing
3 changed files
with
14 additions
and
15 deletions
Show diff stats
app/src/main/java/com/hjx/parent/LoginActivity.java
| ... | ... | @@ -175,26 +175,25 @@ public class LoginActivity extends BaseActivity { |
| 175 | 175 | boolean isSucceed = jo.getBoolean("success"); |
| 176 | 176 | if (isSucceed) { |
| 177 | 177 | JSONObject jo2 = jo.getJSONObject("data"); |
| 178 | - if ("parent".equals(jo2.getString("role"))) { | |
| 178 | + String role = jo2.getString("role"); | |
| 179 | + if ("parent".equals(role)) { | |
| 179 | 180 | SharedPreferencesUtil.putData("phone", phone); |
| 180 | - SharedPreferencesUtil.putData("role", jo2.getString("role")); | |
| 181 | - SharedPreferencesUtil.putData("userId", jo2.getString("userId")); | |
| 181 | + SharedPreferencesUtil.putData("role", role); | |
| 182 | + SharedPreferencesUtil.putData("userId", jo2.getString("id")); | |
| 182 | 183 | SharedPreferencesUtil.putData("token", jo2.getString("token")); |
| 183 | - JSONObject user = new JSONObject(jo2.getString("user")); | |
| 184 | - if (user.getString("photo") != null && !user.getString("photo").equals("null")) { | |
| 185 | - SharedPreferencesUtil.putData("photo", user.getString("photo")); | |
| 184 | + if (jo2.has("photo") && !jo2.getString("photo").equals("null")) { | |
| 185 | + SharedPreferencesUtil.putData("photo", jo2.getString("photo")); | |
| 186 | 186 | } |
| 187 | - SharedPreferencesUtil.putData("name", user.getString("userName")); | |
| 187 | + SharedPreferencesUtil.putData("name", jo2.getString("username")); | |
| 188 | 188 | startActivity(ChooseActivity.class); |
| 189 | 189 | finish(); |
| 190 | - } else if ("member_advisor".equals(jo2.getString("role")) || "teaching_supervision".equals(jo2.getString("role"))) { | |
| 190 | + } else if ("member_advisor".equals(role) || "teaching_supervision".equals(role)) { | |
| 191 | 191 | SharedPreferencesUtil.putData("phone", phone); |
| 192 | - SharedPreferencesUtil.putData("role", jo2.getString("role")); | |
| 193 | - SharedPreferencesUtil.putData("userId", jo2.getString("userId")); | |
| 192 | + SharedPreferencesUtil.putData("role", role); | |
| 193 | + SharedPreferencesUtil.putData("userId", jo2.getString("id")); | |
| 194 | 194 | SharedPreferencesUtil.putData("token", jo2.getString("token")); |
| 195 | - JSONObject user = new JSONObject(jo2.getString("user")); | |
| 196 | - SharedPreferencesUtil.putData("name", user.getString("userName")); | |
| 197 | - SharedPreferencesUtil.putData("photo", user.getString("photo")); | |
| 195 | + SharedPreferencesUtil.putData("name", jo2.getString("username")); | |
| 196 | + SharedPreferencesUtil.putData("photo", jo2.getString("photo")); | |
| 198 | 197 | startActivity(TeacherChooseActivity.class); |
| 199 | 198 | finish(); |
| 200 | 199 | } else { | ... | ... |
app/src/main/java/com/hjx/parent/RegisterActivity.java
| ... | ... | @@ -252,7 +252,7 @@ public class RegisterActivity extends BaseActivity { |
| 252 | 252 | JSONObject jo2 = jo.getJSONObject("data"); |
| 253 | 253 | SharedPreferencesUtil.putData("phone", phone); |
| 254 | 254 | SharedPreferencesUtil.putData("role", jo2.getString("role")); |
| 255 | - SharedPreferencesUtil.putData("userId", jo2.getString("userId")); | |
| 255 | + SharedPreferencesUtil.putData("userId", jo2.getString("id")); | |
| 256 | 256 | SharedPreferencesUtil.putData("token", jo2.getString("token")); |
| 257 | 257 | startActivity(ChooseActivity.class); |
| 258 | 258 | finish(); | ... | ... |
libs/common/src/main/java/com/prws/common/net/NetWorks.java
| ... | ... | @@ -92,7 +92,7 @@ public class NetWorks extends RetrofitUtils { |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | @Headers("Content-Type: application/json") |
| 95 | - @POST("/api/v1/auth/login") | |
| 95 | + @POST("/api/v1/login/userLogin") | |
| 96 | 96 | Observable<ResponseBody> login(@Body RequestBody body); |
| 97 | 97 | |
| 98 | 98 | @GET("/api/v1/resource/listGradeAndSubject") | ... | ... |