商城模块

This commit is contained in:
陈淳
2022-10-18 19:27:58 +08:00
parent ab8cdd88b9
commit 0a27cd7403
43 changed files with 861 additions and 122 deletions

View File

@@ -0,0 +1,55 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class LogController : ControllerBase
{
private ILogService _iLogService;
//大量日志将采用自动分表形式默认1年分一次表
public LogController(ILogger<LogEntity> logger, ILogService iLogService)
{
_iLogService = iLogService;
}
/// <summary>
/// 自动分表,日志添加
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<Result> Add()
{
Random random = new Random();
var logList = new List<LogEntity>() {
new LogEntity() { CreateTime = Convert.ToDateTime("2019-12-1"), Message = "jack"+random.Next() } ,
new LogEntity() { CreateTime = Convert.ToDateTime("2022-02-1"), Message = "jack"+random.Next() },
new LogEntity() { CreateTime = Convert.ToDateTime("2020-02-1"), Message = "jack"+random.Next() },
new LogEntity() { CreateTime = Convert.ToDateTime("2021-12-1"), Message = "jack"+random.Next() } };
return Result.Success().SetData(await _iLogService.AddListTest(logList));
}
/// <summary>
/// 查询近20年与21年的日志表
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> GetList()
{
return Result.Success().SetData(await _iLogService.GetListTest());
}
}
}