public async Task <ReturnMessage <string> > ValidateAppSetting(CodeRequest request)
        {
            var application = await Task.Run(() =>
            {
                var app = applicationDal.GetApplicationByAppId(request.appid);
                return(app);
            });

            if (application == null)
            {
                return(ReturnMessage <string> .ErrorMsg("不合法的AppID"));
            }
            if (HttpContext.Request.UrlReferrer == null || string.IsNullOrEmpty(HttpContext.Request.UrlReferrer.Host))
            {
                return(ReturnMessage <string> .ErrorMsg("非法的请求"));
            }
            var host         = HttpContext.Request.UrlReferrer.Host.ToString();
            var regex        = "^(\\w+(\\.)){0,9}" + application.Host + "$";
            var hostValidate = Regex.IsMatch(host, regex);

            if (!hostValidate)
            {
                return(ReturnMessage <string> .ErrorMsg("请在APP设置的域名内使用OAuth"));
            }
            var redircturlValidate = Regex.IsMatch(request.redirecturl, regex);

            if (!redircturlValidate)
            {
                return(ReturnMessage <string> .ErrorMsg("redirect url不合法"));
            }
            return(ReturnMessage <string> .SuccessMsg(""));
        }