Yuebon.WebApi/Areas/CMS/Controllers/V2/ArticlenewsController.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Threading.Tasks;
using Yuebon.AspNetCore.Controllers;
using Yuebon.AspNetCore.Models;
using Yuebon.AspNetCore.Mvc;
using Yuebon.CMS.Dtos;
using Yuebon.CMS.IServices;
using Yuebon.CMS.Models;
using Yuebon.Commons.Attributes;
using Yuebon.Commons.Helpers;
using Yuebon.Commons.Models;

namespace Yuebon.WebApi.Areas.CMS.Controllers.V2;

/// <summary>
/// 文章,通知公告接口
/// </summary>
[ApiController]
[ApiVersion("2.0")]
[Route("api/CMS/[controller]")]
public class ArticlenewsController : AreaApiController<Articlenews, ArticlenewsOutputDto,ArticlenewsInputDto,IArticlenewsService>
{
    private IArticlecategoryService articlecategoryService;
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="_iService"></param>
    /// <param name="_articlecategoryService"></param>
    public ArticlenewsController(IArticlenewsService _iService,IArticlecategoryService _articlecategoryService) : base(_iService)
    {
        iService = _iService;
        articlecategoryService = _articlecategoryService;
    }
    /// <summary>
    /// 新增前处理数据
    /// </summary>
    /// <param name="info"></param>
    protected override void OnBeforeInsert(Articlenews info)
    {
        info.Id = IdGeneratorHelper.IdSnowflake();
        info.CategoryName = articlecategoryService.GetById(info.CategoryId).Title;
        info.CreatorTime = DateTime.Now;
        info.CreatorUserId = CurrentUser.UserId;
        info.CompanyId = CurrentUser.OrganizeId;
        info.DeptId = CurrentUser.DeptId;
        info.DeleteMark = false;
        if (info.SortCode == null)
        {
            info.SortCode = 99;
        }
    }
    
    /// <summary>
    /// 在更新数据前对数据的修改操作
    /// </summary>
    /// <param name="info"></param>
    /// <returns></returns>
后面还有 74 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。