<?php
/**
 * Created by PhpStorm.
 * User: 思维定制
 * Date: 2018/10/27
 * Time: 11:58
 */

namespace App\Library;


class ErrorCode
{
    const VERIFY_CODE_SEND_FAIL = 3000;
    const CLIENT_WRONG_PARAMS = 1000;
    const NO_AUTH = 1001;
    const SAVE_FALL = 1002;
    //错误常量枚举
    private static $_msg = [
        self::VERIFY_CODE_SEND_FAIL => '验证码发送失败',
        self::CLIENT_WRONG_PARAMS => '传入参数不正确',
        self::NO_AUTH => '用户未登录',
        self::SAVE_FALL => '数据保存失败',
    ];

    public static function message($code) {
        if (isset(self::$_msg[$code])) {
            return self::$_msg[$code];
        } else {
            return null;
        }
    }
}