add feat(): hello DB API

This commit is contained in:
jiahao 2023-09-05 10:27:30 +08:00
parent bcb66a3463
commit 39ab492bdb

View File

@ -12,7 +12,9 @@ using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using Repository.BackendRepository.Interface;
using Repository.FrontendRepository.Interface;
using Serilog;
using Serilog.Core;
using Serilog.Data;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
@ -63,9 +65,20 @@ namespace FrontendWebApi.ApiControllers
[Consumes("application/x-www-form-urlencoded")]
public async Task<ActionResult<ApiResult<TnToken>>> hellodb()
{
var User = await backendRepository.GetOneAsync<User>("userinfo", @$" deleted = 0");
return Ok(System.DateTime.Now.ToString() + @$"{User.full_name} OK !");
ApiResult<TnToken> apiResult = new ApiResult<TnToken>(null);
ErrorCode errorCode = new ErrorCode();
try
{
var User = await backendRepository.GetOneAsync<User>("userinfo", @$" deleted = 0");
return Ok(System.DateTime.Now.ToString() + @$" get user test: {User.full_name} OK !");
}
catch (Exception ex )
{
logger.LogError(ex.Message);
apiResult.Msg = ex.Message;
apiResult.Code = "9999";
return BadRequest(apiResult);
}
}
#endregion
@ -101,6 +114,7 @@ namespace FrontendWebApi.ApiControllers
}
catch( Exception ex)
{
logger.LogError(ex.Message);
apiResult.Msg = ex.Message;
apiResult.Code = "9999";
return BadRequest(apiResult);