diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db
index df70988a..bf891620 100644
Binary files a/WebFirst/database/sqlite.db and b/WebFirst/database/sqlite.db differ
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
index 7c90e33d..822a145c 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
@@ -4,21 +4,6 @@
Yi.Framework.ApiMicroservice
-
-
- 动态条件分页查询
-
-
-
-
-
-
-
- 添加
-
-
-
-
Json To Sql 类比模式,通用模型
@@ -150,6 +135,33 @@
+
+
+ 点赞操作
+
+
+
+
+
+
+ 文章控制器
+
+
+
+
+ 动态条件分页查询
+
+
+
+
+
+
+
+ 添加
+
+
+
+
动态条件分页查询
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Community/AgreeController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Community/AgreeController.cs
new file mode 100644
index 00000000..721882b3
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Community/AgreeController.cs
@@ -0,0 +1,66 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+using Org.BouncyCastle.Asn1.IsisMtt.X509;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Yi.Framework.Common.Models;
+using Yi.Framework.DTOModel.Vo;
+using Yi.Framework.Interface;
+using Yi.Framework.Model.Models;
+using Yi.Framework.Repository;
+using Yi.Framework.Service;
+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 AgreeController : ControllerBase
+ {
+ [Autowired]
+ public IAgreeService _iAgreeService { get; set; }
+ [Autowired]
+ public IArticleService _iArticleService { get; set; }
+ [Autowired]
+ public ILogger _logger { get; set; }
+
+ ///
+ /// 点赞操作
+ ///
+ ///
+ ///
+ [HttpGet]
+ public async Task Operate(long articleId)
+ {
+ //long userId = HttpContext.GetUserIdInfo();
+ long userId = 1L;
+ var article = await _iArticleService._repository.GetByIdAsync(articleId);
+ if (await _iAgreeService._repository.IsAnyAsync(u => u.UserId == userId && u.ArticleId == articleId))
+ {
+ //已点赞,取消点赞
+ await _iAgreeService._repository.UseTranAsync(async () =>
+ {
+ await _iAgreeService._repository.DeleteAsync(u => u.UserId == userId && u.ArticleId == articleId);
+ await _iArticleService._repository.UpdateIgnoreNullAsync(new ArticleEntity { Id = articleId, AgreeNum = article.AgreeNum - 1 });
+
+ });
+ }
+ else
+ {
+ //未点赞,添加点赞记录
+ await _iAgreeService._repository.UseTranAsync(async () =>
+ {
+ await _iAgreeService._repository.InsertAsync(new AgreeEntity { UserId = userId, ArticleId = articleId });
+ await _iArticleService._repository.UpdateIgnoreNullAsync(new ArticleEntity { Id = articleId, AgreeNum = article.AgreeNum + 1 });
+ });
+
+ }
+ return Result.Success("这里业务全部拆开放service层去");
+ }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Article/ArticleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Community/ArticleController.cs
similarity index 95%
rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Article/ArticleController.cs
rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Community/ArticleController.cs
index 36ee1e7a..644e1e5c 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Article/ArticleController.cs
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Community/ArticleController.cs
@@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
-using Yi.Framework.DTOModel;
+using Yi.Framework.DTOModel.Vo;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
@@ -17,6 +17,9 @@ using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
+ ///
+ /// 文章控制器
+ ///
[ApiController]
[Route("api/[controller]/[action]")]
public class ArticleController : BaseSimpleCrudController
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs
index e218d8e4..c577da40 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs
@@ -1,6 +1,4 @@
-using Hangfire;
-using Hangfire.MemoryStorage.Database;
-using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Localization;
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs
index bd4402c8..403da255 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs
@@ -18,8 +18,6 @@ using Yi.Framework.WebCore.LogExtend;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Yi.Framework.WebCore.AutoFacExtend;
-using Hangfire;
-using Hangfire.MemoryStorage;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddCommandLine(args);
@@ -43,14 +41,14 @@ builder.Host.ConfigureContainer(containerBuilder =>
#region
//עģ
#endregion
- //containerBuilder.RegisterModule();
+ containerBuilder.RegisterModule();
#region
//ʹAppServiceŵĽԶע,ִʹøַʽԶע
#endregion
containerBuilder.AddAutoIocService("Yi.Framework.Repository", "Yi.Framework.Service");
});
////ע룬mvcģתӸioc
-//builder.Services.Replace(ServiceDescriptor.Transient());
+builder.Services.Replace(ServiceDescriptor.Transient());
builder.Host.ConfigureLogging(loggingBuilder =>
{
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db
index 8aa31d6c..25d6f215 100644
Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ
diff --git a/Yi.Framework.Net6/Yi.Framework.Core/Yi.Framework.Core.csproj b/Yi.Framework.Net6/Yi.Framework.Core/Yi.Framework.Core.csproj
index ecc2430b..52c81d84 100644
--- a/Yi.Framework.Net6/Yi.Framework.Core/Yi.Framework.Core.csproj
+++ b/Yi.Framework.Net6/Yi.Framework.Core/Yi.Framework.Core.csproj
@@ -8,8 +8,6 @@
-
-
diff --git a/Yi.Framework.Net6/Yi.Framework.DTOModel/ArticleVo.cs b/Yi.Framework.Net6/Yi.Framework.DTOModel/Vo/ArticleVo.cs
similarity index 89%
rename from Yi.Framework.Net6/Yi.Framework.DTOModel/ArticleVo.cs
rename to Yi.Framework.Net6/Yi.Framework.DTOModel/Vo/ArticleVo.cs
index c862535e..bbe8fd48 100644
--- a/Yi.Framework.Net6/Yi.Framework.DTOModel/ArticleVo.cs
+++ b/Yi.Framework.Net6/Yi.Framework.DTOModel/Vo/ArticleVo.cs
@@ -4,32 +4,32 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace Yi.Framework.DTOModel
+namespace Yi.Framework.DTOModel.Vo
{
public class ArticleVo
{
public long Id { get; set; }
-
+
public string Title { get; set; }
-
+
public string Content { get; set; }
-
+
public long? UserId { get; set; }
public long? CreateUser { get; set; }
-
+
public DateTime? CreateTime { get; set; }
-
+
public long? ModifyUser { get; set; }
-
+
public DateTime? ModifyTime { get; set; }
-
+
public bool? IsDeleted { get; set; }
-
+
public long? TenantId { get; set; }
-
+
public int? OrderNum { get; set; }
-
+
public string Remark { get; set; }
public List Images { get; set; }
diff --git a/Yi.Framework.Net6/Yi.Framework.DTOModel/UserVo.cs b/Yi.Framework.Net6/Yi.Framework.DTOModel/Vo/UserVo.cs
similarity index 95%
rename from Yi.Framework.Net6/Yi.Framework.DTOModel/UserVo.cs
rename to Yi.Framework.Net6/Yi.Framework.DTOModel/Vo/UserVo.cs
index fb183e36..3620f95d 100644
--- a/Yi.Framework.Net6/Yi.Framework.DTOModel/UserVo.cs
+++ b/Yi.Framework.Net6/Yi.Framework.DTOModel/Vo/UserVo.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace Yi.Framework.DTOModel
+namespace Yi.Framework.DTOModel.Vo
{
///
/// 前端只需要这些数据即可
diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IAgreeService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IAgreeService.cs
new file mode 100644
index 00000000..6d7ccb97
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IAgreeService.cs
@@ -0,0 +1,9 @@
+using Yi.Framework.Model.Models;
+using Yi.Framework.Repository;
+
+namespace Yi.Framework.Interface
+{
+ public partial interface IAgreeService:IBaseService
+ {
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/AgreeEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/AgreeEntity.cs
new file mode 100644
index 00000000..b66856e6
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/AgreeEntity.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.Json.Serialization;
+using SqlSugar;
+namespace Yi.Framework.Model.Models
+{
+ ///
+ /// 点赞表
+ ///
+ [SugarTable("Agree")]
+ public partial class AgreeEntity
+ {
+ public AgreeEntity()
+ {
+ this.CreateTime = DateTime.Now;
+ }
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
+ public long Id { get; set; }
+ ///
+ /// 用户id
+ ///
+ [SugarColumn(ColumnName="UserId" )]
+ public long? UserId { get; set; }
+ ///
+ /// 文章id
+ ///
+ [SugarColumn(ColumnName="ArticleId" )]
+ public long? ArticleId { get; set; }
+ ///
+ /// 创建者
+ ///
+ [SugarColumn(ColumnName="CreateUser" )]
+ public long? CreateUser { get; set; }
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName="CreateTime" )]
+ public DateTime? CreateTime { get; set; }
+ ///
+ /// 租户Id
+ ///
+ [SugarColumn(ColumnName="TenantId" )]
+ public long? TenantId { get; set; }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs
index c1dceebc..7151223a 100644
--- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs
@@ -22,12 +22,12 @@ namespace Yi.Framework.Model.Models
/// 文章标题
///
[SugarColumn(ColumnName="Title" )]
- public string? Title { get; set; }
+ public string Title { get; set; }
///
/// 文章内容
///
[SugarColumn(ColumnName="Content" )]
- public string? Content { get; set; }
+ public string Content { get; set; }
///
/// 用户id
///
@@ -72,11 +72,16 @@ namespace Yi.Framework.Model.Models
/// 描述
///
[SugarColumn(ColumnName="Remark" )]
- public string? Remark { get; set; }
+ public string Remark { get; set; }
///
/// 图片列表
///
- [SugarColumn(ColumnName="Images",IsJson = true)]
- public List? Images { get; set; }
+ [SugarColumn(ColumnName="Images" )]
+ public string Images { get; set; }
+ ///
+ /// 点赞数量
+ ///
+ [SugarColumn(ColumnName="AgreeNum" )]
+ public int? AgreeNum { get; set; }
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/AgreeService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/AgreeService.cs
new file mode 100644
index 00000000..27d48eee
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/AgreeService.cs
@@ -0,0 +1,14 @@
+using SqlSugar;
+using Yi.Framework.Interface;
+using Yi.Framework.Model.Models;
+using Yi.Framework.Repository;
+
+namespace Yi.Framework.Service
+{
+ public partial class AgreeService : BaseService, IAgreeService
+ {
+ public AgreeService(IRepository repository) : base(repository)
+ {
+ }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/Mapper/Profile/AutoMapperProfile.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/Mapper/Profile/AutoMapperProfile.cs
index da65a8c3..0f1929e4 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/Mapper/Profile/AutoMapperProfile.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/Mapper/Profile/AutoMapperProfile.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Yi.Framework.DTOModel;
+using Yi.Framework.DTOModel.Vo;
using Yi.Framework.Model.Models;
namespace Yi.Framework.WebCore.Mapper
diff --git a/Yi.Vue3.x.Vant/components.d.ts b/Yi.Vue3.x.Vant/components.d.ts
index 26d80cd0..a63a89cb 100644
--- a/Yi.Vue3.x.Vant/components.d.ts
+++ b/Yi.Vue3.x.Vant/components.d.ts
@@ -14,9 +14,6 @@ declare module '@vue/runtime-core' {
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
- VanActionBar: typeof import('vant/es')['ActionBar']
- VanActionBarButton: typeof import('vant/es')['ActionBarButton']
- VanActionBarIcon: typeof import('vant/es')['ActionBarIcon']
VanActionSheet: typeof import('vant/es')['ActionSheet']
VanButton: typeof import('vant/es')['Button']
VanCell: typeof import('vant/es')['Cell']
diff --git a/Yi.Vue3.x.Vant/index.html b/Yi.Vue3.x.Vant/index.html
index 5e7092b5..3372eb7f 100644
--- a/Yi.Vue3.x.Vant/index.html
+++ b/Yi.Vue3.x.Vant/index.html
@@ -4,7 +4,7 @@
- 大白荟
+ 意框架
diff --git a/Yi.Vue3.x.Vant/src/view/login.vue b/Yi.Vue3.x.Vant/src/view/login.vue
index 6b1b917a..0bd37a7e 100644
--- a/Yi.Vue3.x.Vant/src/view/login.vue
+++ b/Yi.Vue3.x.Vant/src/view/login.vue
@@ -1,6 +1,6 @@
- 大白荟
+ 意框架
有幸相遇、不负未来
@@ -19,7 +19,7 @@
type="password"
placeholder="请输入密码"
/>
- 进入大白荟
+ 进入意框架
其他方式登录
diff --git a/Yi.Vue3.x.Vant/src/view/main/recommend.vue b/Yi.Vue3.x.Vant/src/view/main/recommend.vue
index b0f1ae3c..2df5bb04 100644
--- a/Yi.Vue3.x.Vant/src/view/main/recommend.vue
+++ b/Yi.Vue3.x.Vant/src/view/main/recommend.vue
@@ -1,6 +1,5 @@
-
-
+
-
+
- {{item.user==null?"-":(item.user.nick??item.user.username)}}
+ {{
+ item.user == null ? "-" : item.user.nick ?? item.user.username
+ }}
@@ -25,29 +30,29 @@
{{ item.content }}
-
-
-
-
+
+
+
-
+
@@ -72,13 +77,23 @@
>
第{{ index + 1 }}页
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Yi.Vue3.x.Vant/src/view/send/imageText.vue b/Yi.Vue3.x.Vant/src/view/send/imageText.vue
index 6fbf7933..50026ea1 100644
--- a/Yi.Vue3.x.Vant/src/view/send/imageText.vue
+++ b/Yi.Vue3.x.Vant/src/view/send/imageText.vue
@@ -9,7 +9,12 @@
发图文
- 发布
+ 发布
@@ -39,28 +44,33 @@
-
+
\ No newline at end of file