Light12306/ChatRoomServer.Www/Controllers/AnnouncementController.cs
2015-07-08 17:24:45 +08:00

32 lines
891 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace ChatRoomServer.Www.Controllers
{
using System.Data.Entity;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web.Http.Cors;
using System.Web.Mvc.Filters;
using ChatRoomServer.Db;
using FSLib.MvcWeb;
using FSLib.Network.Http;
[EnableCors("http://12306.liebao.cn,http://test.fishlee.net", "*", "*", "")]
public class AnnouncementController : Controller
{
[AllowAnonymous]
[HttpGet, OutputCache(Duration = 1200, VaryByHeader = "Origin")]
public async Task<ContentResult> List()
{
var client = new HttpClient();
var ctx = client.Create<string>(HttpMethod.Get, $"http://{Request.Url.Host}:{Request.Url.Port}/api/announcement/list");
await ctx.SendTask();
return Content(ctx.Result, "application/json");
}
}
}