|
@@ -1,12 +1,15 @@
|
|
|
-using Microsoft.AspNetCore.Mvc;
|
|
|
+using Lazy.SlideCaptcha.Core.Resources;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
using NPOI.SS.Formula.PTG;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
using System.Threading.Tasks;
|
|
|
using ZhonTai.Admin.Core.Attributes;
|
|
|
using ZhonTai.Admin.Core.Consts;
|
|
|
+using ZhonTai.Admin.Core.Dto;
|
|
|
using ZhonTai.Admin.Repositories.Notice;
|
|
|
using ZhonTai.Admin.Services.DiTuiAPI.Dto;
|
|
|
using ZhonTai.DynamicApi;
|
|
@@ -29,6 +32,9 @@ using ZhonTai.DynamicApi.Attributes;
|
|
|
|
|
|
namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// 通知公告
|
|
|
+ /// </summary>
|
|
|
[DynamicApi(Area = AdminConsts.DiTuiName)]
|
|
|
public class NoticeService : BaseService, INoticeService, IDynamicApi
|
|
|
{
|
|
@@ -40,88 +46,104 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
}
|
|
|
|
|
|
|
|
|
- ///// <summary>
|
|
|
- ///// 首页信息
|
|
|
- ///// </summary>
|
|
|
- ///// <returns></returns>
|
|
|
- //[HttpGet]
|
|
|
- //[NoOprationLog]
|
|
|
- //public async Task<IndexOutput> IndexAsync()
|
|
|
- //{
|
|
|
- // var uId = User?.Id;
|
|
|
- // var tenantId = User.TenantId;
|
|
|
-
|
|
|
-
|
|
|
- // IndexOutput indexOutPut = await _orgRepository.Select.DisableGlobalFilter()
|
|
|
- // .Where(a => a.TenantId == User.TenantId)
|
|
|
- // .FirstAsync(a => new IndexOutput(a.Id, a.Name));
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // //IndexOutput indexOutPut = new IndexOutput();
|
|
|
- // //indexOutPut.Name = "99地推";
|
|
|
- // indexOutPut.Tips = "推广要求:杜绝任何虚假、作弊、违法行为!";
|
|
|
-
|
|
|
- // List<Imgs> imgsList = new List<Imgs>();
|
|
|
- // imgsList.Add(new Imgs(
|
|
|
- // "https://test-dt.zhongjie51.com/assetsImg/lunbo1.png",
|
|
|
- // "1",
|
|
|
- // "11",
|
|
|
- // "2023-01-11 11:11:11",
|
|
|
- // "2023-11-11 11:11:11",
|
|
|
- // "99"
|
|
|
- // ));
|
|
|
- // imgsList.Add(new Imgs(
|
|
|
- // "https://test-dt.zhongjie51.com/assetsImg/lunbo2.png",
|
|
|
- // "2",
|
|
|
- // "222",
|
|
|
- // "2023-02-02 12:12:12",
|
|
|
- // "2023-12-22 14:59:49",
|
|
|
- // "99"
|
|
|
- // ));
|
|
|
- // imgsList.Add(new Imgs(
|
|
|
- // "https://test-dt.zhongjie51.com/assetsImg/lunbo3.png",
|
|
|
- // "3",
|
|
|
- // "333",
|
|
|
- // "2023-03-03 12:12:12",
|
|
|
- // "2023-12-30 14:59:49",
|
|
|
- // "99"
|
|
|
- // ));
|
|
|
-
|
|
|
- // indexOutPut.Imgs = imgsList;
|
|
|
-
|
|
|
-
|
|
|
- // //List<Notices> notices = new List<Notices>();
|
|
|
- // // 公告
|
|
|
- // //notices.Add(new Notices("最新","平台悬赏任务、游戏试玩任务上线通知…","11"));
|
|
|
- // //notices.Add(new Notices("重要", "快手极速版直推版价格政策调整通知", "22"));
|
|
|
- // //notices.Add(new Notices("最新", "12月平台项目重要通知请注意查看!12月平台项目重要通知请注意查看!", "33"));
|
|
|
- // var notices = _noticeRepository.Select.DisableGlobalFilter(FilterNames.Tenant)
|
|
|
- // .OrderByDescending(m => m.Rank)
|
|
|
- // .ToList(m => new Notices()
|
|
|
- // {
|
|
|
- // Id = m.Id.ToString(),
|
|
|
- // Title = m.Title,
|
|
|
- // Tags = m.Tags
|
|
|
- // });
|
|
|
-
|
|
|
- // indexOutPut.Notices = notices;
|
|
|
-
|
|
|
- // List<Settlement> settlements = new List<Settlement>();
|
|
|
- // settlements.Add(new Settlement("抖音电商1分购-高价版", "未结算"));
|
|
|
- // settlements.Add(new Settlement("京喜特价-发货版", "已结算至03月20日"));
|
|
|
- // settlements.Add(new Settlement("抖音电商1分购-稳定版", "已结算至03月20日"));
|
|
|
- // settlements.Add(new Settlement("兴业数字人民币", "已结算至03月20日"));
|
|
|
- // settlements.Add(new Settlement("抖音极速地推版", "已结算至03月20日"));
|
|
|
- // settlements.Add(new Settlement("易行通ETC(自助发货)", "已结算至03月20日"));
|
|
|
- // settlements.Add(new Settlement("抖美团外卖-关注公众号", "已结算至03月20日"));
|
|
|
- // settlements.Add(new Settlement("抖音电商1分购-高价版", "已结算至03月20日"));
|
|
|
- // settlements.Add(new Settlement("抖音电商1分购-高价版", "已结算至03月20日"));
|
|
|
- // ;
|
|
|
- // indexOutPut.settlement = settlements;
|
|
|
-
|
|
|
- // return indexOutPut;
|
|
|
- //}
|
|
|
+ /// <summary>
|
|
|
+ /// 公告列表
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet]
|
|
|
+ [NoOprationLog]
|
|
|
+ public async Task<PageOutput<NoticeOutput>> IndexAsync(PageInput input)
|
|
|
+ {
|
|
|
+ var uId = User?.Id;
|
|
|
+ var tenantId = User.TenantId;
|
|
|
+
|
|
|
+
|
|
|
+ //List<Notices> notices = new List<Notices>();
|
|
|
+ // 公告
|
|
|
+ //notices.Add(new Notices("最新","平台悬赏任务、游戏试玩任务上线通知…","11"));
|
|
|
+ //notices.Add(new Notices("重要", "快手极速版直推版价格政策调整通知", "22"));
|
|
|
+ //notices.Add(new Notices("最新", "12月平台项目重要通知请注意查看!12月平台项目重要通知请注意查看!", "33"));
|
|
|
+ var notices = _noticeRepository.Select.DisableGlobalFilter(FilterNames.Tenant)
|
|
|
+ .Where(a => a.IsAlter == 0)
|
|
|
+ .OrderByDescending(m => m.Rank)
|
|
|
+ .Page(input.CurrentPage, input.PageSize)
|
|
|
+ .ToList(m => new NoticeOutput()
|
|
|
+ {
|
|
|
+ Id = m.Id,
|
|
|
+ Title = m.Title,
|
|
|
+ Desc = m.Desc,
|
|
|
+ //Desc = System.Text.RegularExpressions.Regex.Replace(System.Text.RegularExpressions.Regex.Replace(m.Content, "<[^>]+>", ""), "&[^;]+;", ""),
|
|
|
+ //Desc = Regex.Replace(m.Content, "<.*?>", string.Empty),
|
|
|
+ CreateTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", m.CreatedTime),
|
|
|
+ Unread = "1"
|
|
|
+ });
|
|
|
+
|
|
|
+ foreach(var item in notices)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var data = new PageOutput<NoticeOutput>()
|
|
|
+ {
|
|
|
+ List = notices,
|
|
|
+ Total = notices.Count()
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Remove HTML from string with Regex.
|
|
|
+ /// </summary>
|
|
|
+ private static string StripTagsRegex(string source)
|
|
|
+ {
|
|
|
+ return Regex.Replace(source, "<.*?>", string.Empty);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Compiled regular expression for performance.
|
|
|
+ /// </summary>
|
|
|
+ static Regex _htmlRegex = new Regex("<.*?>", RegexOptions.Compiled);
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Remove HTML from string with compiled Regex.
|
|
|
+ /// </summary>
|
|
|
+ private static string StripTagsRegexCompiled(string source)
|
|
|
+ {
|
|
|
+ return _htmlRegex.Replace(source, string.Empty);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Remove HTML tags from string using char array.
|
|
|
+ /// </summary>
|
|
|
+ private static string StripTagsCharArray(string source)
|
|
|
+ {
|
|
|
+ char[] array = new char[source.Length];
|
|
|
+ int arrayIndex = 0;
|
|
|
+ bool inside = false;
|
|
|
+
|
|
|
+ for (int i = 0; i < source.Length; i++)
|
|
|
+ {
|
|
|
+ char let = source[i];
|
|
|
+ if (let == '<')
|
|
|
+ {
|
|
|
+ inside = true;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (let == '>')
|
|
|
+ {
|
|
|
+ inside = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!inside)
|
|
|
+ {
|
|
|
+ array[arrayIndex] = let;
|
|
|
+ arrayIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new string(array, 0, arrayIndex);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|