コード例 #1
0
ファイル: Hook.cs プロジェクト: KeKangShui/Utils
        public static object TmdGetMain(string url, string body = null, string cookies = null, object hook = null, string script = null, int[] position = null, string hookUrl = null, string title = "", string ua = null)
        {
            if (hookUrl == null || hookUrl == "")
            {
                hookUrl = url;
            }
            if (position == null)
            {
                position = new int[] { 0, 0, 450, 500 };
            }
            var shttp = new SHttp();
            var lib   = Streams.libScript;

            try
            {
                JObject jobject = JObject.Parse(lib);
                lib = jobject["result"].ToString();
            }
            catch
            {
                lib = "";
            }
            if (string.IsNullOrEmpty(body) && !string.IsNullOrEmpty(script))
            {
                hookUrl = hookUrl + (hookUrl.Contains("?") ? "&hook=1" : "?hook=1");
                string iframe = "<script>" + script + lib + "</script>";
                var    html   = string.Concat(new string[]
                {
                    "<iframe id='ifr1' style='border:0' width=100% height=100% onload='typeof(onloads)==\"undefined\"? console.log(12306) : onloads();' src=\"", url, "\"></iframe>",
                });
                body = "<html><head><meta charset=\"utf-8\" /></head>" + iframe + html + "</html>";
            }
            if (!string.IsNullOrEmpty(body) && body.Contains("{getScriptLib}"))
            {
                body = body.Replace("{getScriptLib}", lib);
            }
            var obj = new
            {
                domain    = hookUrl,
                cookie    = cookies,
                body      = body,
                title     = title,
                position  = position,
                hook      = hook,
                useragent = ua
            };

            return(obj);
        }
コード例 #2
0
        public ActionResult StackSearchExport(string input)
        {
            Stream rst = new SHttp().SApiDownload("WMS", "WMS/BC_TPM/StackExport", input);

            return(File(rst, "application/vnd.ms-excel", "托盘组合码查询导出.xls"));
        }
コード例 #3
0
        public ActionResult ExportEntryReport(string input)
        {
            Stream rst = new SHttp().SApiDownload("WMS", "WMS/CG_SHNO/REPORT_ITEM", input);

            return(File(rst, "application/vnd.ms-excel", "入库送检单(包材类)查询报表.xls"));
        }
コード例 #4
0
        public ActionResult SSOLoginLogci(string name)
        {
            string url = SHttp.UrlQueryAdd(Request.Url.ToString(), new Dictionary <string, string>()
            {
                { "subFolder", Url.Action("SSOLoginLogci", "Access", new { area = "" }).Replace("/Access/SSOLoginLogci", "") }
            });
            AccountInfo account = models.Access.SignInSS0(name.ToUpper(), "", url);

            //List<Sonluk.UI.Model.SSO.UserTokenService.MenuInfo> menulist = new List<UI.Model.SSO.UserTokenService.MenuInfo>();

            //string url = Request.Url.ToString();
            //string xiugaiurl = "";
            //if (url.IndexOf("192.168") != -1 || url.IndexOf("localhost") != -1)
            //{
            //    xiugaiurl = ConfigurationManager.AppSettings["SSOURLDROPOUTIN"];
            //}
            //else
            //{
            //    xiugaiurl = ConfigurationManager.AppSettings["SSOURLDROPOUTOUT"];
            //}
            //for (int i = 0; i < menuArr.Length; i++)
            //{
            //    if (menuArr[i].Node.Equals("修改密码"))
            //    {
            //        menuArr[i].Uri = xiugaiurl;
            //    }
            //    menulist.Add(menuArr[i]);
            //}
            //JsonSerializerSettings jsonSetting = new JsonSerializerSettings();
            //jsonSetting.NullValueHandling = NullValueHandling.Ignore;
            //account.Menu = JsonConvert.SerializeObject(menulist, jsonSetting);


            Session["Account"]             = account;
            Session["Authorization"]       = account.Authorization;
            Session["ErrorMessage"]        = account.Message;
            Session["ErrorMessageDetails"] = account.MessageDetails;
            HttpCookie cookie = new HttpCookie("AccountName");

            cookie.Value   = name;
            cookie.Path    = "/";
            cookie.Expires = DateTime.Now.AddDays(7);
            Response.Cookies.Add(cookie);

            ActionResult target;
            string       index = "";

            if (account.Route.Auth == null || account.Route.Auth.Equals(""))
            {
                index  = Url.Action(account.Route.Action, account.Route.Controller, new { area = account.Route.Area });
                target = RedirectToAction(account.Route.Action, account.Route.Controller, new { area = account.Route.Area });
            }
            else
            {
                index  = Url.Action(account.Route.Action, account.Route.Controller, new { area = account.Route.Area, Auth = account.Route.Auth });
                target = RedirectToAction(account.Route.Action, account.Route.Controller, new { area = account.Route.Area, Auth = account.Route.Auth });
            }


            HttpCookie indexCookie = new HttpCookie("navBar");

            indexCookie.Value = Regex.Replace(index, @"[^a-zA-Z0-9]*", "");
            indexCookie.Path  = "/";
            Response.Cookies.Add(indexCookie);

            return(target);
        }