fix [获取指导员备注信息 为空时的闪退问题]

This commit is contained in:
zlzw 2024-03-26 16:31:15 +08:00
parent 7e6a296722
commit 7c669b338f

View File

@ -4,12 +4,16 @@ import android.content.Context;
import android.os.Handler;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.google.gson.Gson;
import com.lzy.okgo.model.Response;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.JsonBean;
import com.yunbao.common.manager.base.BaseCacheManager;
import com.yunbao.common.utils.StringUtil;
import java.util.HashMap;
import java.util.Map;
@ -36,8 +40,12 @@ public class InstructorRemarkManager extends BaseCacheManager {
*/
public Map<String, String> getInstructorRemark() {
if (null == instructorRemarkMap) {
instructorRemarkMap = JSON.parseObject(getString(KEY_INSTRUCTOR_REMARK), new TypeReference<Map<String, String>>() {
});
String string = getString(KEY_INSTRUCTOR_REMARK);
if (!StringUtil.isEmpty(string)) {
instructorRemarkMap = JSON.parseObject(string, new TypeReference<Map<String, String>>() {
});
}
}
if (instructorRemarkMap == null) {
instructorRemarkMap = new HashMap<>();
@ -103,8 +111,8 @@ public class InstructorRemarkManager extends BaseCacheManager {
public void run() {
IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo();
HttpClient.getInstance().get("User.getInstructorRemark", "getInstructorRemark")
.params("uid", userInfo.getId(),true)
.params("token", userInfo.getToken(),true)
.params("uid", userInfo.getId(), true)
.params("token", userInfo.getToken(), true)
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@ -116,6 +124,11 @@ public class InstructorRemarkManager extends BaseCacheManager {
}
}
@Override
public void onError(Response<JsonBean> response) {
super.onError(response);
}
});