zhaolei
2020-11-20 921de2254ff5712a44ed8575ee8efe34252f6603
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using Bootstrap.Admin.Query;
using Bootstrap.DataAccess;
using Prow.Web;
using Prow.Web.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
 
namespace Bootstrap.Admin.Controllers.Api
{
    /// <summary>
    /// 在线用户跟踪控制器
    /// </summary>
    [Route("api/[controller]")]
    [Authorize]
    [ApiController]
    public class TracesController : ControllerBase
    {
        /// <summary>
        /// 客户端脚本获取在线用户数据
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        [HttpGet]
        public QueryData<Trace> Get([FromQuery]QueryTraceOptions value)
        {
            return value.RetrieveData();
        }
 
        /// <summary>
        /// 在线用户访问保存方法,前台系统调用
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        [HttpPost]
        public bool Post([FromBody]OnlineUser user)
        {
            TraceHelper.Save(HttpContext, user);
            return true;
        }
    }
}