username@email.com
2024-05-17 2586fc8f8313691bf079438ba7f780aac44c3f0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/***********************************************************************
 *            Project: baifenBinfa
 *        ProjectName: 百分兵法管理系统                               
 *                Web: http://chuanyin.com                     
 *             Author:                                        
 *              Email:                               
 *         CreateTime: 202403/02   
 *        Description: 暂无
 ***********************************************************************/
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
 
namespace CoreCms.Net.Web.WebApi.Controllers
{
    /// <summary>
    /// 公告控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class NoticeController : ControllerBase
    {
        private IHttpContextUser _user;
        private ICoreCmsNoticeServices _noticeServices;
 
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="user"></param>
        /// <param name="noticeServices"></param>
        public NoticeController(IHttpContextUser user, ICoreCmsNoticeServices noticeServices)
        {
            _user = user;
            _noticeServices = noticeServices;
        }
 
 
        #region 列表
        /// <summary>
        /// 列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<WebApiCallBack> NoticeList([FromBody] FMPageByIntId entity)
        {
            var jm = new WebApiCallBack();
 
            var list = await _noticeServices.QueryPageAsync(p => p.isDel == false, p => p.createTime, OrderByType.Desc, entity.page, entity.limit);
            jm.status = true;
            jm.data = list;
 
            return jm;
 
        }
 
        #endregion
 
        /// <summary>
        /// 获取单个公告内容
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<WebApiCallBack> NoticeInfo([FromBody] FMIntId entity)
        {
            var jm = new WebApiCallBack();
 
            var model = await _noticeServices.QueryByIdAsync(entity.id);
            if (model == null)
            {
                jm.msg = "数据获取失败";
                return jm;
            }
            jm.status = true;
            jm.data = model;
            return jm;
        }
 
    }
}