|
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
|
using System.Transactions;
|
|
using System.Transactions;
|
|
using GxPress.Common.Exceptions;
|
|
using GxPress.Common.Exceptions;
|
|
using GxPress.Common.Tools;
|
|
using GxPress.Common.Tools;
|
|
|
|
+using GxPress.EnumConst;
|
|
using GxPress.Request.App.Topic;
|
|
using GxPress.Request.App.Topic;
|
|
using GxPress.Result;
|
|
using GxPress.Result;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json;
|
|
@@ -27,6 +28,7 @@ namespace GxPress.Service.Implement.Topic
|
|
{
|
|
{
|
|
using (TransactionScope transactionScope = new TransactionScope())
|
|
using (TransactionScope transactionScope = new TransactionScope())
|
|
{
|
|
{
|
|
|
|
+
|
|
//创建话题
|
|
//创建话题
|
|
var topic = new Entity.Topic.Topic
|
|
var topic = new Entity.Topic.Topic
|
|
{
|
|
{
|
|
@@ -45,15 +47,22 @@ namespace GxPress.Service.Implement.Topic
|
|
foreach (var item in contentJsonData)
|
|
foreach (var item in contentJsonData)
|
|
{
|
|
{
|
|
item.File = StringUtils.RemoveDomain(item.File);
|
|
item.File = StringUtils.RemoveDomain(item.File);
|
|
|
|
+ if (item.Type == AllTypeConst.Text.GetHashCode())
|
|
|
|
+ topic.TextContent += item.Text;
|
|
}
|
|
}
|
|
topic.Content = JsonConvert.SerializeObject(contentJsonData);
|
|
topic.Content = JsonConvert.SerializeObject(contentJsonData);
|
|
}
|
|
}
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ topic.TextContent = "[]";
|
|
|
|
+ topic.Content = "[]";
|
|
|
|
+ }
|
|
var topicId = await _topicRepository.InsertAsync(topic);
|
|
var topicId = await _topicRepository.InsertAsync(topic);
|
|
//修改话题访问量
|
|
//修改话题访问量
|
|
await _visitService.AddVisit(request.UserId, GxPress.EnumConst.AllTypeConst.Topic.GetHashCode(), topicId);
|
|
await _visitService.AddVisit(request.UserId, GxPress.EnumConst.AllTypeConst.Topic.GetHashCode(), topicId);
|
|
result = new AppResultJson<Entity.Topic.Topic>
|
|
result = new AppResultJson<Entity.Topic.Topic>
|
|
{
|
|
{
|
|
- Code = 100,
|
|
|
|
|
|
+ Code = StatusCodeConst.SucceedCode.GetHashCode(),
|
|
Msg = "",
|
|
Msg = "",
|
|
Success = false,
|
|
Success = false,
|
|
Data = await _topicRepository.GetAsync(topicId)
|
|
Data = await _topicRepository.GetAsync(topicId)
|
|
@@ -65,8 +74,8 @@ namespace GxPress.Service.Implement.Topic
|
|
{
|
|
{
|
|
return result = new AppResultJson<Entity.Topic.Topic>
|
|
return result = new AppResultJson<Entity.Topic.Topic>
|
|
{
|
|
{
|
|
- Code = 100,
|
|
|
|
- Msg = "",
|
|
|
|
|
|
+ Code = StatusCodeConst.ErrorCode.GetHashCode(),
|
|
|
|
+ Msg = StatusCodeConst.ErrorMsg.GetDescriptionOriginal(),
|
|
Success = false,
|
|
Success = false,
|
|
Data = new Entity.Topic.Topic()
|
|
Data = new Entity.Topic.Topic()
|
|
};
|
|
};
|