package com.yingying.tourist.exception;

/**
 * @Author: XPF
 * @Description:
 * @Date: Created in 12:02 2018/6/30
 * @Modified by:
 */
public enum ErrorCode {

    SERVER_OK(200, "请求成功"),
    /**
     * 服务端异常
     */
    SERVER_SYSERR(1001, "系统错误"),
    SERVER_BIZERR(1002, "业务逻辑异常"),
    PARAMETERS_ERROR(1003, "参数异常"),
    SESSION_TIMEOUT(1004, "登录超时"),
    PARAM_BINDINGERR(1005, "拦截绑定参数异常"),
    DATA_ERROR(1006, "数据异常"),
    DATA_CURDERR(1007, "数据CURD操作失败"),
    CONNECTION_COINERR(1008,"访问coin服务器失败"),
    
    // 2000以上 错误是业务操作问题
    NOT_LOGIN(2000,"请先登录"),
    FAILURE_LOGIN(2000,"登录失效"),
    HAVE_HAPPENED(2001,"已经发生请勿重复操作，如若没有收到验证码，请在五分钟以后再次操作"),
	CHOICE_VALID_COIN(2002,"请输入正确的币种id"),
	REPEAT_ADD_COIN(2003,"请勿重复添加自选"),
	REPEAT_DEL_COIN(2004,"请勿重复删除自选"),
	CHOICE_VALID_COIN_PAIR(2005,"请输入正确的币对id"),
	
	// 3000-3100微信端错误
	JS_SIGN_NULL(3000, "未获取到JS授权验证"),
	OPENID_NULL(3001,"未获取到OPENID");

    private int code;
    private String msg;

    ErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

    public int getCode() {
        return code;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("ErrorCode{");
        sb.append("code=").append(code);
        sb.append(", msg='").append(msg).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
