// 获取唯一邀请码
    public static function getInviteCode(){
        $invite_code = self::nonceStr(6);
        $res = self::where('invite_code', $invite_code)->value('uid');
        if (!$res)return $invite_code;
        else self::getInviteCode();
    }

    //随机生成字符串
    protected static function nonceStr($length = 32){
        $randStr = null;
        $strPol = "123456789asdfghjkqwertyuipzxcvbnmASDFGHJKLQWERTYUIPZXCVBNM";
        $max = strlen($strPol) - 1;
        for ($i = 0; $i < $length; $i++) {
            $randStr .= $strPol[rand(0, $max)];
        }
        return $randStr;
    }