From 103c3c8084f782ebaa4e216feac9e9afaa52321a Mon Sep 17 00:00:00 2001
From: wanggaofeng <15601716045@163.com>
Date: Sun, 7 Jan 2024 14:11:31 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
HttpClientStudy.Service/AccountService.cs | 40 +++++++++++++++++++
HttpClientStudy.Service/Class1.cs | 7 ----
.../NormalHttpClientTest.cs | 27 +++++++++++++
.../Controllers/NormalController.cs | 34 ++++++++++++++++
4 files changed, 101 insertions(+), 7 deletions(-)
create mode 100644 HttpClientStudy.Service/AccountService.cs
delete mode 100644 HttpClientStudy.Service/Class1.cs
create mode 100644 HttpClientStudy.UnitTest/NormalHttpClientTest.cs
create mode 100644 HttpClientStudy.WebApp/Controllers/NormalController.cs
diff --git a/HttpClientStudy.Service/AccountService.cs b/HttpClientStudy.Service/AccountService.cs
new file mode 100644
index 0000000..edd69aa
--- /dev/null
+++ b/HttpClientStudy.Service/AccountService.cs
@@ -0,0 +1,40 @@
+using HttpClientStudy.Model;
+
+namespace HttpClientStudy.Service
+{
+ ///
+ /// 账号 服务类
+ ///
+ public class AccountService
+ {
+ public List GetAllAccounts()
+ {
+ List accounts = new List()
+ {
+ new Account() { Id=1, Name="管理员01", Password="123456", Role="Admin"},
+ new Account() { Id=2, Name="管理员02", Password="123456", Role="Admin"},
+ new Account() { Id=3, Name="管理员03", Password="123456", Role="Admin"},
+ new Account() { Id=4, Name="管理员04", Password="123456", Role="Admin"},
+ new Account() { Id=5, Name="管理员05", Password="123456", Role="Admin"},
+ new Account() { Id=6, Name="管理员06", Password="123456", Role="Admin"},
+ new Account() { Id=7, Name="管理员07", Password="123456", Role="Admin"},
+ new Account() { Id=8, Name="管理员08", Password="123456", Role="Admin"},
+ new Account() { Id=9, Name="管理员09", Password="123456", Role="Admin"},
+ new Account() { Id=10, Name="管理员10", Password="123456", Role="Admin"},
+
+ new Account() { Id=11, Name="开发01", Password="123456", Role="Dev"},
+ new Account() { Id=12, Name="管理员01", Password="123456", Role="Dev"},
+ new Account() { Id=13, Name="开发03", Password="123456", Role="Dev"},
+ new Account() { Id=14, Name="开发04", Password="123456", Role="Dev"},
+ new Account() { Id=15, Name="开发05", Password="123456", Role="Dev"},
+ new Account() { Id=16, Name="开发06", Password="123456", Role="Dev"},
+ new Account() { Id=17, Name="开发07", Password="123456", Role="Dev"},
+ new Account() { Id=18, Name="开发08", Password="123456", Role="Dev"},
+ new Account() { Id=19, Name="开发09", Password="123456", Role="Dev"},
+ new Account() { Id=20, Name="开发10", Password="123456", Role="Dev"},
+ };
+
+ return accounts;
+ }
+ }
+}
diff --git a/HttpClientStudy.Service/Class1.cs b/HttpClientStudy.Service/Class1.cs
deleted file mode 100644
index 2ad76ce..0000000
--- a/HttpClientStudy.Service/Class1.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace HttpClientStudy.Service
-{
- public class Class1
- {
-
- }
-}
diff --git a/HttpClientStudy.UnitTest/NormalHttpClientTest.cs b/HttpClientStudy.UnitTest/NormalHttpClientTest.cs
new file mode 100644
index 0000000..e6c5140
--- /dev/null
+++ b/HttpClientStudy.UnitTest/NormalHttpClientTest.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HttpClientStudy.UnitTest
+{
+ ///
+ /// 基础HttpClient 测试
+ ///
+ public class NormalHttpClientTest
+ {
+ private readonly ITestOutputHelper _logger;
+
+ public NormalHttpClientTest(ITestOutputHelper outputHelper)
+ {
+ _logger = outputHelper;
+ }
+
+ [Fact]
+ public void Test()
+ {
+
+ }
+ }
+}
diff --git a/HttpClientStudy.WebApp/Controllers/NormalController.cs b/HttpClientStudy.WebApp/Controllers/NormalController.cs
new file mode 100644
index 0000000..29f6cef
--- /dev/null
+++ b/HttpClientStudy.WebApp/Controllers/NormalController.cs
@@ -0,0 +1,34 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace HttpClientStudy.WebApp.Controllers
+{
+ ///
+ /// 普通(简单) 控制器
+ ///
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ public class NormalController : ControllerBase
+ {
+ private ILogger _logger;
+
+ ///
+ /// 构造
+ ///
+ public NormalController(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ ///
+ /// 获取账号
+ ///
+ ///
+ [HttpGet]
+ public IActionResult GetAccount()
+ {
+ var reslut = BaseResultUtil.Success("操作成功");
+ return Ok(reslut);
+ }
+ }
+}