/// <summary> /// 上传实名认证信息 /// </summary> /// <param name="uploadIdCard"></param> /// <returns></returns> public IHttpActionResult UploadIdCardCertificationInfo(UploadIdCardCertificationInfoModelGet uploadIdCard) { string urlFrontImage; string urlReverseImage; try { if (string.IsNullOrEmpty(uploadIdCard.FrontImage) || string.IsNullOrEmpty(uploadIdCard.ReverseImage)) { throw new Exception(); } object userId = _idCardCertificationDal.CheckIdCardExisit(uploadIdCard.IdCard); if (userId != null) { if (Convert.ToInt32(userId) != uploadIdCard.UserId) { return(Json(new ResultDataModel <IdCardCertificationModelResult> { Code = 4202, Messages = "身份证已被其他账号绑定" })); } return(Json(new ResultDataModel <IdCardCertificationModelResult> { Code = 4203, Messages = "身份证已提交申请,请勿重复提交" })); } Bitmap frontImage = ImageConvertHelper.ConvertBase64ToBitmap(uploadIdCard.FrontImage); urlFrontImage = Md5Helper.Md5Encrypt16(uploadIdCard.IdCard, Encoding.UTF8) + Guid.NewGuid() + ".jpg"; Bitmap reverseImage = ImageConvertHelper.ConvertBase64ToBitmap(uploadIdCard.ReverseImage); urlReverseImage = Md5Helper.Md5Encrypt16(uploadIdCard.IdCard, Encoding.UTF8) + Guid.NewGuid() + ".jpg"; string tempImages = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _tempImages); if (!Directory.Exists(tempImages)) { Directory.CreateDirectory(tempImages); } frontImage.Save(tempImages + urlFrontImage, ImageFormat.Jpeg); frontImage.Dispose(); urlFrontImage = _tempImages + urlFrontImage; reverseImage.Save(tempImages + urlReverseImage, ImageFormat.Jpeg); reverseImage.Dispose(); urlReverseImage = _tempImages + urlReverseImage; } catch (Exception e) { LogHelper.error("上传实名认证信息" + e); return(Json(new ResultDataModel <IdCardCertificationModelResult> { Code = 4201, Messages = "上传图片有误" })); } int rows = _idCardCertificationDal.InsertIdCardCertificationInfo(uploadIdCard.UserId, uploadIdCard.Name, uploadIdCard.IdCard, urlFrontImage, urlReverseImage); return(Json(new ResultDataModel <IdCardCertificationModelResult> { Code = rows == 1 ? 0 : -1 })); }
/// <summary> /// 上传第三方收款信息 /// </summary> /// <param name="modelGet"></param> /// <returns></returns> public IHttpActionResult UploadThirdCollectionInfo(UploadThirdCollectionInfoModelGet modelGet) { if (string.IsNullOrEmpty(modelGet.PayPassowrd)) { return(Json(new ResultDataModel <BankCodeInfoModelResult> { Code = 4010, Messages = "数据不完整或存在空数据" })); } if (!_userInfoDal.CheckPayPassowrd(modelGet.UserId, modelGet.PayPassowrd)) { return(Json(new ResultDataModel <BankCodeInfoModelResult> { Code = 4106, Messages = "支付密码错误" })); } string urlCollectionCodeImage; try { Bitmap collectionCodeImage = ImageConvertHelper.ConvertBase64ToBitmap(modelGet.CollectionCodeImage); urlCollectionCodeImage = Path.Combine(_tempImages, Md5Helper.Md5Encrypt16(modelGet.Account, Encoding.UTF8) + Guid.NewGuid() + ".jpg"); string tempImages = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _tempImages); if (!Directory.Exists(tempImages)) { Directory.CreateDirectory(tempImages); } collectionCodeImage.Save(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, urlCollectionCodeImage)); } catch (Exception) { return(Json(new ResultDataModel <BankCodeInfoModelResult> { Code = -1, Messages = "图片有误" })); } int rows = _receivablesInformationDal.InsertThirdCollectionInfo(modelGet.UserId, modelGet.Name, modelGet.Account, urlCollectionCodeImage, modelGet.AccountType); return(Json(new ResultDataModel <UploadThirdCollectionInfoModelGet> { Code = rows == 1 ? 0 : -1 })); }