Exemplo n.º 1
0
        /// <summary>
        /// 处理Restful请求
        /// </summary>
        void ProcessRestRequest(HttpListenerRequest req, HttpListenerResponse resp)
        {
            Contract.Assert(req.Url.Segments.Length > 2);

            var svcName = req.Url.Segments[2].Trim('/').ToLower();
            switch (svcName)
            {
                case "ticket":
                    {
                        var ticket = this.JsTicket();
                        resp.SendPlainText(ticket);
                    }
                    break;
                case "menu":
                    {
                        var menus = new WXMenu[]
                        {
                            new WXMenu() { Type="view", Url="http://www.ultragis.com:8001/mob/guide.html", Name="服务号" },
                            new WXMenu() { Type="view", Url="http://www.ultragis.com:8001/mob/employee_adviser.html", Name="企业号" }
                        };
                        this.SetMenu(menus);
                    }
                    break;
            }
        }