package com.base.orbit.web;

import java.util.HashMap;
import java.util.Map;

/**
 * @author shuyy
 * @date 2022-01-13
 */
public class Code {

    //太阳高度角
    public static final int SUCCESS = 200;
    public static final int ERROR = 500;
    public static final int SESSIONEXPIRED = -1;
    public static final int NEED_LOGIN = 2;
    public static final int FORBIDDEN = 3;
    public static final int ERROR_PARAM_ERROR = 4001;
    public static final int ERROR_SKU_ERROR = 4002;
    public static final int ERROR_SERVER = 5001;
    public static final int ERROR_DATABASE = 5002;
    public static final int ERROR_NETWORK = 5003;
    public static final int ERROR_ACCESS_DENY = 5004;
    public static final int ERROR_SERVICE = 6001;
    public static final int ERROR_CAPTCHA = 6002;
    public static Map<Integer, String> map = new HashMap();

    public Code() {
    }

    public static String getInfo(int code) {
        return map.containsKey(code) ? (String)map.get(code) : "未知错误，请联系管理员";
    }

    static {
        map.put(200, "操作成功");
        map.put(500, "请求失败");
        map.put(401, "需要客户端登录");
        map.put(4002, "暂无库存");
        map.put(4001, "输入参数错误");
        map.put(5001, "服务器错误");
        map.put(5002, "数据库错误");
        map.put(5003, "网络访问错误");
        map.put(6001, "业务错误");
    }
}
