Ai
1 Star 0 Fork 10

SyncGithub/OAuthApp

forked from uncle wang/OAuthApp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ReportController.cs 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
uncle wang 提交于 2022-06-14 17:44 +08:00 . 1,添加了服务器在线编辑功能
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Annotations;
using OAuthApp.Data;
using System.Linq;
using OAuthApp.ApiModels.ReportController;
using OAuthApp.Filters;
using OAuthApp.Services;
namespace OAuthApp.Apis
{
[SwaggerTag("报表")]
[ServiceFilter(typeof(ApiRequestLoggingAttribute))]
public class ReportController : BaseController
{
private readonly AppDbContext _appContext;
public ReportController(AppDbContext appContext)
{
_appContext = appContext;
}
[HttpGet("{id}/Users")]
[SwaggerOperation(OperationId = "ReportUsers")]
[EncryptResultFilter]
public IActionResult Users(long id)
{
var result = _appContext.AppUsers
.Where(x => x.AppID == id).CountAsync().Result;
return OK(result);
}
[HttpGet("{id}/UserByDays")]
[SwaggerOperation(OperationId = "ReportUserByDays")]
[EncryptResultFilter]
public IActionResult UserByDays(long id,int take)
{
var result = _appContext.Query<AppUsers30DaysResponse>(@"SELECT LastUpdate, COUNT(1) Total " +
" FROM AppUsers WHERE AppID = " + id + " GROUP BY date(LastUpdate) ORDER BY LastUpdate DESC" +
" LIMIT " + take);
return OK(result);
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/sync-github/OAuthApp.git
git@gitee.com:sync-github/OAuthApp.git
sync-github
OAuthApp
OAuthApp
master

搜索帮助