QiFeng.ZWY.Api/Controllers/CollectionController.cs

(开头部分) 7KB

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

using log4net;
using QiFeng.LMSD.Api.Models;
using QiFeng.LMSD.Bll;
using QiFeng.LMSD.Model;
using QiFeng.LMSD.Model.ApiResultModel;
using QiFeng.LMSD.Model.EnumModel;
using QiFeng.LMSD.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace QiFeng.LMSD.Api.Controllers
{
    public class CollectionController : BaseApiController
    {
        private readonly ILog logger = LogManager.GetLogger(typeof(ConsumerController));

        /// <summary>
        /// 编辑收藏(取消/添加)
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Result<string> EditCollection([FromBody]EditCollectionModel model)
        {
            Result<string> result = new Result<string>() { Status = false, Message = "系统错误" };
            try
            {
                var strSign = model.random + model.collectionType + model.consumerId + model.collectedId;
                if (!model.sign.Equals(EncryptionLibCbc.Encrypt(strSign)))
                    throw new FormatException("请求参数错误");

                var resBool = CollectionBll.Instance.EditConsumerCollection(model.collectionType, model.consumerId, model.collectedId);

                result.Status = true;
                result.Message = resBool ? "收藏成功" : "取消收藏成功";
                result.Data = EncryptionLibCbc.Encrypt(JsonTool.ObjToJsonAllInfo(resBool));

            }
            catch (Exception ex)
            {
                result.Status = false;
#if DEBUG
                result.Message = ex.Message + ex.StackTrace;
#else
                result.Message = "系统错误";
#endif
                if (ex.GetType() == typeof(FormatException)) result.Message = ex.Message;
                logger.Error(" CollectionController | EditCollection | Faild:" + ex.Message);
            }
            return result;
        }

        /// <summary>
        /// 批量收藏
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
后面还有 111 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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