コード例 #1
0
        public MyResult <object> PubMessage([FromBody] MessageDto model)
        {
            if (string.IsNullOrEmpty(base.TokenModel.Id.ToString()) || base.TokenModel.Id < 0)
            {
                return(new MyResult <object>(-1, "请检查是否登录"));
            }
            //判断是否禁用
            var flag = SetingService.UserStatus(base.TokenModel.Id);

            if (flag)
            {
                return(new MyResult <object>(-1, "用户已被禁用"));
            }
            List <string> urlList = new List <string>();

            if (model.BasePics.Count > 0)
            {
                model.BasePics.ForEach(pic =>
                {
                    var fileName = DateTime.Now.GetTicket().ToString();
                    var url      = ImageHandlerUtil.SaveBase64Image(pic, $"{fileName}.png", $"{Constants.Message_Path}/{base.TokenModel.Id}");
                    urlList.Add(url);
                });
            }
            model.Pics   = urlList.GetJson();
            model.UserId = base.TokenModel.Id;
            return(SetingService.AddMessage(model));
        }
コード例 #2
0
 public MyResult <object> BannerAdd_Updata([FromBody] BannerDto model)
 {
     if (!string.IsNullOrEmpty(model.Pic) && model.Pic.Length > 1000)
     {
         var fileName = DateTime.Now.GetTicket().ToString();
         model.Pic = ImageHandlerUtil.SaveBase64Image(model.Pic, $"{fileName}.png", Constants.BANNER_PATH);
     }
     return(SetingService.AddBanner(model));
 }
コード例 #3
0
 public MyResult <object> SaveMessageType([FromBody] MessageTypeDto model)
 {
     if (!string.IsNullOrEmpty(model.Pic) && model.Pic.Length > 1000)
     {
         var fileName = DateTime.Now.GetTicket().ToString();
         model.Pic = ImageHandlerUtil.SaveBase64Image(model.Pic, $"{fileName}.png", Constants.MessageType_PATH);
     }
     if (model.Id.HasValue)
     {
         return(SetingService.UpdateMessageType(model));
     }
     return(SetingService.AddMessageType(model));
 }
コード例 #4
0
 public MyResult <object> PubShopDetail([FromBody] ShopDetailDto model)
 {
     if (string.IsNullOrEmpty(base.TokenModel.Id.ToString()) || base.TokenModel.Id < 0)
     {
         return(new MyResult <object>(-1, "请检查是否登录"));
     }
     if (!string.IsNullOrEmpty(model.Pic))
     {
         var fileName = DateTime.Now.GetTicket().ToString();
         var url      = ImageHandlerUtil.SaveBase64Image(model.Pic, $"{fileName}.png", $"{Constants.Shop_Detail_Path}/{base.TokenModel.Id}");
         model.Pic = url;
     }
     return(SetingService.AddShopDetail(model));
 }