60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Data;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Web;
|
|
using KART_API.Services;
|
|
using KART_API.Dto;
|
|
using KART_API.Utils;
|
|
using System.Net.Http;
|
|
|
|
namespace KART_API.Controllers
|
|
{
|
|
[Route("api/v2/log")]
|
|
[ApiController]
|
|
public class LogController : ControllerBase
|
|
{
|
|
[Route("visit")] //확인
|
|
[HttpPost]
|
|
public IActionResult visitLog([FromHeader] string token ,[FromBody] VisitLogParam visitLog, [FromHeader] string skey)
|
|
{
|
|
UserInfo userInfo = Security.ValidateToken(token);
|
|
if(userInfo != null)
|
|
{
|
|
projectCodeInfo projectCodeInfo = new projectCodeInfo();
|
|
if (String.IsNullOrEmpty(skey) == false)
|
|
{
|
|
projectCodeInfo = new projectCodeInfo(skey);
|
|
}
|
|
LogService.InsertVisitLog(userInfo.ID, projectCodeInfo.projectCode, visitLog.LogContent);
|
|
Response.StatusCode = (int)HttpStatusCode.OK;
|
|
return Content("PASS");
|
|
}
|
|
|
|
Response.StatusCode = (int)HttpStatusCode.Unauthorized;
|
|
return Content(null);
|
|
}
|
|
|
|
[Route("site")] //확인
|
|
[HttpPost]
|
|
public IActionResult siteLog([FromHeader] string token, [FromBody] SiteLogParam siteLog, [FromHeader] string skey)
|
|
{
|
|
UserInfo userInfo = Security.ValidateToken(token);
|
|
if (userInfo != null)
|
|
{
|
|
projectCodeInfo projectCodeInfo = new projectCodeInfo(skey);
|
|
LogService.InsertSiteLog(userInfo.ID, projectCodeInfo.projectCode, siteLog.LogTitle, siteLog.LogContent);
|
|
|
|
Response.StatusCode = (int)HttpStatusCode.OK;
|
|
return Content("PASS");
|
|
}
|
|
|
|
Response.StatusCode = (int)HttpStatusCode.Unauthorized;
|
|
return Content(null);
|
|
}
|
|
}
|
|
}
|