// Path: app/src/main/java/com/cxsj/runhdu/bean/gson/Status.java
// public class Status {
//     @SerializedName("Result")
//     private boolean result;
// 
//     @SerializedName("Message")
//     private String message;
// 
//     @SerializedName("Which")
//     private int which;
// 
//     public boolean getResult() {
//         return result;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public int getWhich() {
//         return which;
//     }
// 
// }


import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.cxsj.runhdu.bean.gson.Status;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
package com.cxsj.runhdu.Model;





/**
 * Created by SailFlorve on 2017/8/25 0025.
 * 所有model基类
 */

public class BaseModel {

    protected static final String TAG = "";

    static final String CONNECT_FAILED = "网络连接失败。";
    static final String RETURN_DATA_ERROR = "服务器数据出错。";

    static Handler mHandler = new Handler(Looper.getMainLooper());

    public interface BaseCallback {
        void onFailure(String msg);

        void onSuccess();
    }

    /**
     * 检查服务器返回为true还是false
     */
    private static void checkStatusResponse(Response response, BaseCallback callback) throws IOException {
        String result = response.body().string();
        Log.d(TAG, "checkStatusResponse: " + result);
        mHandler.post(() -> {
            if (result.equals("true")) {
                callback.onSuccess();
            } else {
                callback.onFailure(RETURN_DATA_ERROR);
            }
        });
    }

    private static void checkJsonStatusResponse(Response response, BaseCallback callback) throws IOException {
        String jsonStr = response.body().string();
        Log.d(TAG, "checkJsonStatusResponse: " + jsonStr);

        mHandler.post(() -> {
// Path: app/src/main/java/com/cxsj/runhdu/bean/gson/Status.java
// public class Status {
//     @SerializedName("Result")
//     private boolean result;
// 
//     @SerializedName("Message")
//     private String message;
// 
//     @SerializedName("Which")
//     private int which;
// 
//     public boolean getResult() {
//         return result;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public int getWhich() {
//         return which;
//     }
// 
// }


// Path: app/src/main/java/com/cxsj/runhdu/Model/BaseModel.java
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.cxsj.runhdu.bean.gson.Status;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

package com.cxsj.runhdu.Model;





/**
 * Created by SailFlorve on 2017/8/25 0025.
 * 所有model基类
 */

public class BaseModel {

    protected static final String TAG = "";

    static final String CONNECT_FAILED = "网络连接失败。";
    static final String RETURN_DATA_ERROR = "服务器数据出错。";

    static Handler mHandler = new Handler(Looper.getMainLooper());

    public interface BaseCallback {
        void onFailure(String msg);

        void onSuccess();
    }

    /**
     * 检查服务器返回为true还是false
     */
    private static void checkStatusResponse(Response response, BaseCallback callback) throws IOException {
        String result = response.body().string();
        Log.d(TAG, "checkStatusResponse: " + result);
        mHandler.post(() -> {
            if (result.equals("true")) {
                callback.onSuccess();
            } else {
                callback.onFailure(RETURN_DATA_ERROR);
            }
        });
    }

    private static void checkJsonStatusResponse(Response response, BaseCallback callback) throws IOException {
        String jsonStr = response.body().string();
        Log.d(TAG, "checkJsonStatusResponse: " + jsonStr);

        mHandler.post(() -> {
            Status status = null;