public BaseResult <string> UploadEvaluateImage(IFormFileCollection files) { int result_number = 0; //var return_result = FileUtil.UploadQiniuImage(files, FileUtil.localhost_image, hostingEnv.WebRootPath, Settings.ShopImagePrefix, out result_number); //阿里云 var return_result = OssOptionUtil.UploadAliYunImage(files, FileUtil.localhost_image, hostingEnv.WebRootPath, out result_number); if (string.IsNullOrEmpty(return_result)) { return(new BaseResult <string>(result_number)); } return(new BaseResult <string>(return_result)); }
public BaseResult <DropDownList> UploadShopImage(IFormFileCollection files, string shop_id, string shopsku_id) { //首先上传图片读取到上传的图片的路径,然后根据传递过来的参数进行添加数据库,添加完成之后返回信息 if (string.IsNullOrEmpty(shop_id) || string.IsNullOrEmpty(shopsku_id)) { return(new BaseResult <DropDownList>(808, null)); } //插入之前判断这个模板下面的图片未禁用的数量是否已经是4个了,如果是4个,则不允许添加 var count = shopImageRepository.Count(c => c.shop_id.Equals(shop_id) && c.shopsku_id.Equals(shopsku_id) && c.disable == 0); if (count >= 4) { return(new BaseResult <DropDownList>(3004, null)); } int result_number = 0; //var return_result = FileUtil.UploadQiniuImage(files, FileUtil.localhost_image, hostingEnv.WebRootPath, Settings.ShopImagePrefix, out result_number); //阿里云 var return_result = OssOptionUtil.UploadAliYunImage(files, FileUtil.localhost_image, hostingEnv.WebRootPath, out result_number); if (string.IsNullOrEmpty(return_result)) { return(new BaseResult <DropDownList>(result_number, null)); } ShopImageEntity shopImageEntity = new ShopImageEntity { shop_id = shop_id, shopsku_id = shopsku_id, shopimage_address = return_result, shopimage_default = false }; var isTrue = shopImageRepository.Add(shopImageEntity); if (!isTrue) { return(new BaseResult <DropDownList>(201, null)); } return(new BaseResult <DropDownList>(200, new DropDownList { name = shopsku_id + "," + shopImageEntity.shopimage_id, value = return_result })); }