InBoxResponse.java 1.69 KB
package com.yohoufo.inboxclient.model;

import org.apache.commons.lang3.StringUtils;

/**
 * API 响应格式
 * /**
 * 响应为:
 * <pre>
 * {
 * "code": 200,
 * "message": "\u767b\u5f55\u6210\u529f",
 * “alg": "SALT_MD5"
 * "data": {
 * "uid": "10216497",
 * "passport": "18751986615",
 * "session_key": "fa31d3a5d069c6c98cd8c38c3a5f89e6",
 * "vip": 0
 * },
 * "md5": "fa5b07f95a0bf95c26ac50abf0024eed"
 * }
 * Created by chang@yoho.cn on 2015/11/3.
 */
public class InBoxResponse {

    private static String DEFAULT_MSG = "操作成功";
    private static int DEFAULT_CODE = 200;

    private int code;
    private String message;
    private String md5;

    //如果客户端判断有这个,则校验MD5
    private String alg = "SALT_MD5";
    private Object data;

    public InBoxResponse() {
        this(DEFAULT_CODE, DEFAULT_MSG, null);
    }


    public InBoxResponse(int code, String message, Object data) {
        this.code = code;
        if (StringUtils.isNotEmpty(message)) {
            this.message = message;
        }
        this.data = data;
    }

    public String getAlg() {
        return alg;
    }
    public void setAlg(String alg) {
        this.alg = alg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}