Skip to content

Commit

Permalink
Merge branch 'master' into mysql-version
Browse files Browse the repository at this point in the history
  • Loading branch information
lzw5399 committed Apr 27, 2020
2 parents bd140dd + d750c93 commit 137eb73
Show file tree
Hide file tree
Showing 160 changed files with 4,788 additions and 4,453 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 状态
| 应用 | 状态 |
|-|-|
|Vue|[![Build Status](https://dev.azure.com/Zhiwen-Lin/Codepie/_apis/build/status/dl-admin-vue?branchName=master)](https://dev.azure.com/Zhiwen-Lin/Codepie/_build/latest?definitionId=25&branchName=master)|
|API|[![Build Status](https://dev.azure.com/Zhiwen-Lin/Codepie/_apis/build/status/dl-admin-api?branchName=master)](https://dev.azure.com/Zhiwen-Lin/Codepie/_build/latest?definitionId=24&branchName=master)|

## 前言
- gl-admin是一个基于[ASP.NET Core 3.1](https://dotnet.microsoft.com/apps/aspnet)[Vue.js](https://cn.vuejs.org)的后台管理系统, 其中前台的实现基于[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)搭建的
- 目标是具备后台管理类系统的通用的基础功能
Expand All @@ -9,13 +15,13 @@
## 技术选型
- 核心框架:ASP.NET Core 3.1
- 数据访问层:EntityFramework Core 3
- 数据库:MySQL
- 数据库:SQLite(master分支) & MySQL(mysql-version分支)
- 缓存:Redis
- 前端:基于vue-element-admin

## 路线图
- [ ] 部门管理
- [ ] 用户管理
- [x] 用户管理
- [ ] 角色管理
- [ ] 菜单管理:配置菜单功能
- [ ] 权限分配:为指定的角色配置特定的功能菜单
Expand Down
30 changes: 30 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 进入docker-compose.yml文件的文件夹,$1代表外部传入的参数
echo -e "\033[36m start deploying... \033[0m"
cd $1

# pull newest image
echo -e "\033[36m step1: pull newest image \033[0m"
sudo docker-compose pull >> /dev/null 2>&1
if [[ $? != 0 ]]; then
exit 0
fi

# beaucuse we doesn't need build image in server, so doesn't need "--build"
echo -e "\033[36m step2: recreating container \033[0m"
sudo docker-compose up --force-recreate -d >> /dev/null 2>&1
if [[ $? != 0 ]]; then
exit 0
fi

# remove dangling images
echo -e "\033[36m step3: remove dangling images \033[0m"
danglings=$(sudo docker images -f "dangling=true" -q)
if test -n "$danglings"; then
sudo docker rmi $(sudo docker images -f "dangling=true" -q) >>/dev/null 2>&1
if [[ $? != 0 ]]; then
echo 'failed to remove danglings container...'
exit $?
fi
fi

echo -e "\033[36m done! \033[0m"
28 changes: 5 additions & 23 deletions dl-api-csharp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["Doublelives.Api/Doublelives.Api.csproj", "Doublelives.Api/"]
COPY ["Doublelives.Core/Doublelives.Core.csproj", "Doublelives.Core/"]
COPY ["Doublelives.Infrastructure/Doublelives.Infrastructure.csproj", "Doublelives.Infrastructure/"]
COPY ["Doublelives.Cos/Doublelives.Cos.csproj", "Doublelives.Cos/"]
COPY ["Doublelives.Domain/Doublelives.Domain.csproj", "Doublelives.Domain/"]
COPY ["Doublelives.Shared/Doublelives.Shared.csproj", "Doublelives.Shared/"]
COPY ["Doublelives.Service/Doublelives.Service.csproj", "Doublelives.Service/"]
COPY ["Doublelives.Data/Doublelives.Data.csproj", "Doublelives.Data/"]
COPY ["Doublelives.Migrations/Doublelives.Migrations.csproj", "Doublelives.Migrations/"]
RUN dotnet restore "Doublelives.Api/Doublelives.Api.csproj"
COPY . .
WORKDIR /src/Doublelives.Api
RUN dotnet build "Doublelives.Api.csproj" -c Release -o /app
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base

FROM build AS publish
RUN dotnet publish "Doublelives.Api.csproj" -c Release -o /app
COPY ./publish ./app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .

EXPOSE 80

ENTRYPOINT ["dotnet", "Doublelives.Api.dll"]
17 changes: 0 additions & 17 deletions dl-api-csharp/Doublelives-Api.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Doublelives.Domain", "Doubl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Doublelives.Migrations", "Doublelives.Migrations\Doublelives.Migrations.csproj", "{C6EEC5FB-72FF-470B-80C1-74043DA3533B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Doublelives.Cos", "Doublelives.Cos\Doublelives.Cos.csproj", "{BDA149EE-05FD-4958-A0C1-83ECCFF8DAE3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{63DBA218-4075-453B-A6E3-DB26CC67C7DB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications", "Applications", "{F91267E5-EA4E-4695-A52F-0A4D88F60B99}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{0D6A0283-13ED-4ED7-A222-CE899C76AA95}"
Expand All @@ -27,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Doublelives.Shared", "Doubl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Doublelives.Infrastructure", "Doublelives.Infrastructure\Doublelives.Infrastructure.csproj", "{A50AC59D-8513-4563-83AD-3081526B3722}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Doublelives.Query", "Doublelives.Query\Doublelives.Query.csproj", "{BAFE542D-B370-4DB9-BADA-CFC453C748B3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -59,10 +53,6 @@ Global
{C6EEC5FB-72FF-470B-80C1-74043DA3533B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6EEC5FB-72FF-470B-80C1-74043DA3533B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6EEC5FB-72FF-470B-80C1-74043DA3533B}.Release|Any CPU.Build.0 = Release|Any CPU
{BDA149EE-05FD-4958-A0C1-83ECCFF8DAE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BDA149EE-05FD-4958-A0C1-83ECCFF8DAE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BDA149EE-05FD-4958-A0C1-83ECCFF8DAE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BDA149EE-05FD-4958-A0C1-83ECCFF8DAE3}.Release|Any CPU.Build.0 = Release|Any CPU
{5633A978-1313-41F9-880D-900B242EE611}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5633A978-1313-41F9-880D-900B242EE611}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5633A978-1313-41F9-880D-900B242EE611}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -71,22 +61,15 @@ Global
{A50AC59D-8513-4563-83AD-3081526B3722}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A50AC59D-8513-4563-83AD-3081526B3722}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A50AC59D-8513-4563-83AD-3081526B3722}.Release|Any CPU.Build.0 = Release|Any CPU
{BAFE542D-B370-4DB9-BADA-CFC453C748B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BAFE542D-B370-4DB9-BADA-CFC453C748B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BAFE542D-B370-4DB9-BADA-CFC453C748B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BAFE542D-B370-4DB9-BADA-CFC453C748B3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7E4FE7F2-31A1-422D-965D-3466E24B30F8} = {F91267E5-EA4E-4695-A52F-0A4D88F60B99}
{07EA7EE6-E1DC-4922-A474-4A01FF3DC4A9} = {F91267E5-EA4E-4695-A52F-0A4D88F60B99}
{D8241B5D-8F29-4B84-9CBD-6901ACDDD970} = {63DBA218-4075-453B-A6E3-DB26CC67C7DB}
{BDA149EE-05FD-4958-A0C1-83ECCFF8DAE3} = {63DBA218-4075-453B-A6E3-DB26CC67C7DB}
{5633A978-1313-41F9-880D-900B242EE611} = {0D6A0283-13ED-4ED7-A222-CE899C76AA95}
{A50AC59D-8513-4563-83AD-3081526B3722} = {0D6A0283-13ED-4ED7-A222-CE899C76AA95}
{BAFE542D-B370-4DB9-BADA-CFC453C748B3} = {63DBA218-4075-453B-A6E3-DB26CC67C7DB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1688CB2B-C0AB-4682-AA07-E2A096F98B20}
Expand Down
8 changes: 8 additions & 0 deletions dl-api-csharp/Doublelives.Api/AutoMapper/ViewModelProfile.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using AutoMapper;
using Doublelives.Api.Models.Account;
using Doublelives.Api.Models.Album;
using Doublelives.Api.Models.Dept;
using Doublelives.Api.Models.Menu;
using Doublelives.Api.Models.Notice;
using Doublelives.Api.Models.Users;
using Doublelives.Domain.Pictures;
using Doublelives.Domain.Sys.Dto;
Expand All @@ -27,6 +29,12 @@ public ViewModelProfile()
// menu router
CreateMap<RouterDto, RouterViewModel>();
CreateMap<MetaDto, MetaViewModel>();

// notice
CreateMap<NoticeDto, NoticeViewModel>();

// dept
CreateMap<DeptDto, DeptViewModel>();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using AutoMapper;
using Doublelives.Api.Infrastructure;
using Doublelives.Api.Models.Account;
using Doublelives.Api.Models.Account.Requests;
using Doublelives.Api.Validators.Account;
Expand Down Expand Up @@ -48,18 +47,17 @@ public IActionResult Login(AccountLoginRequest request)
public IActionResult Info()
{
// todo kankan cache?

var result = _userService.GetInfo(WorkContext.CurrentUser.Id);
var info = _mapper.Map<AccountInfoDto>(result);

return Ok(info);
}

/// <summary>注销</summary>
[AllowAnonymous]
[HttpPost("logout")]
public IActionResult Logout()
{
// api端针对logout没有什么需要做的
return Ok("注销成功");
}

Expand All @@ -68,9 +66,6 @@ public IActionResult Logout()
public IActionResult UpdatePassword(AccountUpdatePasswordRequest request)
{
return Ok();
// var token = _userService.GenerateToken(request);
//
// return Ok(token);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Doublelives.Api.Infrastructure;
using Doublelives.Api.Models.Album;
using Doublelives.Domain.Pictures;
using Doublelives.Service.Pictures;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;

namespace Doublelives.Api.Infrastructure
namespace Doublelives.Api.Controllers
{
[Authorize]
[ApiController]
Expand All @@ -28,5 +28,15 @@ public override OkObjectResult Ok([ActionResultObjectValue] object value)

return base.Ok(response);
}

//public new OkObjectResult Ok()
//{
// var response = new ResponseBase
// {
// Data = string.Empty
// };

// return base.Ok(response);
//}
}
}
36 changes: 36 additions & 0 deletions dl-api-csharp/Doublelives.Api/Controllers/DeptController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using AutoMapper;
using Doublelives.Api.Models.Dept;
using Doublelives.Service.Depts;
using Doublelives.Service.WorkContextAccess;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Diagnostics;

namespace Doublelives.Api.Controllers
{
public class DeptController : AuthControllerBase
{
private readonly IDeptService _deptService;
private readonly IMapper _mapper;

public DeptController(
IWorkContextAccessor workContextAccessor,
IDeptService deptService,
IMapper mapper)
: base(workContextAccessor)
{
_deptService = deptService;
_mapper = mapper;
}

/// <summary>获取部门层级</summary>
[HttpGet("list")]
public IActionResult List()
{
var dtos = _deptService.List();
var model = _mapper.Map<List<DeptViewModel>>(dtos);

return Ok(model);
}
}
}
5 changes: 0 additions & 5 deletions dl-api-csharp/Doublelives.Api/Controllers/MenuController.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using AutoMapper;
using Doublelives.Api.Infrastructure;
using Doublelives.Api.MockResponse;
using Doublelives.Api.Models.Menu;
using Doublelives.Service.Menus;
using Doublelives.Service.WorkContextAccess;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using System.Collections.Generic;

namespace Doublelives.Api.Controllers
Expand Down Expand Up @@ -33,8 +30,6 @@ public IActionResult ListForRouter()
var routers = _mapper.Map<List<RouterViewModel>>(list);

return Ok(routers);
//var model = MockResponseHelper.GetMockModel<List<RouterViewModel>>("listForRouter");
//return Ok(model);
}
}
}
22 changes: 16 additions & 6 deletions dl-api-csharp/Doublelives.Api/Controllers/NoticeController.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
using Doublelives.Api.Infrastructure;
using Doublelives.Api.MockResponse;
using AutoMapper;
using Doublelives.Api.Models.Notice;
using Doublelives.Service.Notices;
using Doublelives.Service.WorkContextAccess;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace Doublelives.Api.Controllers
{
public class NoticeController : AuthControllerBase
{
public NoticeController(IWorkContextAccessor workContextAccessor)
private readonly INoticeService _noticeService;
private readonly IMapper _mapper;

public NoticeController(
IWorkContextAccessor workContextAccessor,
INoticeService noticeService,
IMapper mapper)
: base(workContextAccessor)
{
_noticeService = noticeService;
_mapper = mapper;
}

[HttpGet("list")]
public IActionResult List()
public IActionResult List(string title)
{
var model = MockResponseHelper.GetMockModel<NoticeViewModel>("noticelist");
var result = _noticeService.List(title);
var list = _mapper.Map<List<NoticeViewModel>>(result);

return Ok(model);
return Ok(list);
}
}
}
Loading

0 comments on commit 137eb73

Please sign in to comment.