public ActionResult Verify(Guid id) { MerchantInformations merchantInfo = FiiiPayDB.MerchantInformationDb.GetById(id); var country = FoundationDB.CountryDb.GetById(merchantInfo.CountryId); var fiiipayAccount = FiiiPayDB.UserAccountDb.GetById(merchantInfo.MerchantAccountId); ViewBag.CountryName = country.Code.ToUpper() == "CN" ? country.Name_CN : country.Name; ViewBag.FiiiPayAccountName = fiiipayAccount.PhoneCode + " " + fiiipayAccount.Cellphone; ViewBag.StoreTypeList = FiiiPayDB.StoreTypeDb.GetList(); ViewBag.MerchantStoreTypeList = FiiiPayDB.MerchantCategoryDb.GetList(t => t.MerchantInformationId == merchantInfo.Id); ViewBag.MerchantSupportCryptoList = FiiiPayDB.MerchantSupportCryptoDb.GetList(t => t.MerchantInfoId == merchantInfo.Id); FiiipayMerchantProfiles profile = null; if (merchantInfo.VerifyStatus != Entities.Enums.VerifyStatus.Certified) { var recorde = FiiiPayDB.FiiipayMerchantVerifyRecordDb.GetList(t => t.MerchantInfoId == merchantInfo.Id).OrderByDescending(t => t.CreateTime).FirstOrDefault(); if (recorde != null) { profile = new FiiipayMerchantProfiles { MerchantInfoId = merchantInfo.Id, LicenseNo = recorde.LicenseNo, BusinessLicenseImage = recorde.BusinessLicenseImage } } ; } else { profile = FiiiPayDB.FiiipayMerchantProfileDb.GetSingle(t => t.MerchantInfoId == merchantInfo.Id); } ViewBag.FiiipayMerchantProfile = profile; ViewBag.OwnersFigure = FiiiPayDB.MerchantOwnersFigureDb.GetList(t => t.MerchantInformationId == merchantInfo.Id); ViewBag.InviteCode = FiiiPayDB.InviteRecordDb.GetSingle(t => t.AccountId == fiiipayAccount.Id && t.Type == InviteType.FiiipayMerchant)?.InviterCode; return(View(merchantInfo)); }
public JsonResult SaveSetting(MerchantInformations info) { info.FeeRate = Math.Truncate(info.FeeRate * 100) / 10000; info.Markup = Math.Truncate(info.Markup * 100) / 10000; var sr = new FiiiPayMerchantBLL().SaveSetting(info.Id, info.Status, info.IsAllowExpense, info.FeeRate, info.Markup); return(Json(sr.toJson())); }
public SaveResult SaveProfileVerify(MerchantInformations info, int AdminId, string AdminName) { var oldInfo = FiiiPayDB.MerchantInformationDb.GetById(info.Id); //oldInfo.VerifyStatus = info.VerifyStatus; //oldInfo.Remark = info.Remark; //oldInfo.VerifyDate = DateTime.Now; var result = FiiiPayDB.MerchantInformationDb.Update(c => new MerchantInformations { VerifyStatus = info.VerifyStatus, Remark = info.Remark, VerifyDate = DateTime.UtcNow }, w => w.Id == info.Id); if (result && (info.VerifyStatus == VerifyStatus.Certified || info.VerifyStatus == VerifyStatus.Disapproval)) { var recordId = FiiiPayDB.VerifyRecordDb.InsertReturnIdentity(new VerifyRecords() { AccountId = info.MerchantAccountId, Username = "", Body = info.Remark, Type = info.VerifyStatus == VerifyStatus.Certified ? VerifyRecordType.StoreVerified : VerifyRecordType.StoreReject, CreateTime = DateTime.UtcNow }); if (info.VerifyStatus == VerifyStatus.Certified) { RabbitMQSender.SendMessage("STORE_VERIFIED", oldInfo.Id); } else if (info.VerifyStatus == VerifyStatus.Disapproval) { RabbitMQSender.SendMessage("STORE_REJECT", oldInfo.Id); } } ActionLog actionLog = new ActionLog(); actionLog.IPAddress = GetClientIPAddress(); actionLog.AccountId = AdminId; actionLog.CreateTime = DateTime.UtcNow; actionLog.ModuleCode = typeof(StoreManageBLL).FullName + ".SaveProfileVerify"; actionLog.Username = AdminName; actionLog.LogContent = string.Format("verify store merchantId:{0},verifystatus:{1}", info.MerchantAccountId, info.VerifyStatus.ToString()); new ActionLogBLL().Create(actionLog); return(new SaveResult(result)); }
public SaveResult SetUser(MerchantInformations model, int userId, string userName) { var info = FiiiPayDB.MerchantInformationDb.GetById(model.Id); info.Status = model.Status; // Create ActionLog ActionLog actionLog = new ActionLog(); actionLog.IPAddress = GetClientIPAddress(); actionLog.AccountId = userId; actionLog.CreateTime = DateTime.UtcNow; actionLog.ModuleCode = typeof(StoreManageBLL).FullName + ".SetUser"; actionLog.Username = userName; actionLog.LogContent = string.Format("Set MerchantInformations Status,Id:{0}", model.Id); ActionLogBLL ab = new ActionLogBLL(); ab.Create(actionLog); return(new SaveResult(FiiiPayDB.MerchantInformationDb.Update(info))); }
public ActionResult Edit(Guid id) { MerchantInformations merchantInfo = FiiiPayDB.MerchantInformationDb.GetById(id); var fiiipayAccount = FiiiPayDB.UserAccountDb.GetById(merchantInfo.MerchantAccountId); ViewBag.FiiiPayAccountName = fiiipayAccount.PhoneCode + " " + fiiipayAccount.Cellphone; var countryList = FoundationDB.CountryDb.GetList(); countryList.Add(new Countries { Code = "", Name_CN = "请选择", IsSupportStore = true }); ViewBag.CountryCodeList = new SelectList(countryList.Where(t => t.IsSupportStore), "Code", "Name_CN", countryList.Find(t => t.Id == merchantInfo.CountryId)?.Code); var cryptoList = GetCrptoCodeList(); ViewBag.StoreTypeList = FiiiPayDB.StoreTypeDb.GetList(); ViewBag.MerchantStoreTypeList = FiiiPayDB.MerchantCategoryDb.GetList(t => t.MerchantInformationId == merchantInfo.Id); ViewBag.CryptoList = FoundationDB.CryptocurrencyDb.GetList(t => t.IsWhiteLabel == 0 && cryptoList.Contains(t.Code)); ViewBag.MerchantSupportCryptoList = FiiiPayDB.MerchantSupportCryptoDb.GetList(t => t.MerchantInfoId == merchantInfo.Id); ViewBag.FiiipayMerchantProfile = FiiiPayDB.FiiipayMerchantProfileDb.GetSingle(t => t.MerchantInfoId == merchantInfo.Id); ViewBag.OwnersFigure = FiiiPayDB.MerchantOwnersFigureDb.GetList(t => t.MerchantInformationId == merchantInfo.Id); ViewBag.InviteCode = FiiiPayDB.InviteRecordDb.GetSingle(t => t.AccountId == fiiipayAccount.Id && t.Type == InviteType.FiiipayMerchant)?.InviterCode; return(View(merchantInfo)); }
public JsonResult SaveVerify(MerchantInformations info) { var sr = new StoreManageBLL().SaveProfileVerify(info, UserId, UserName); return(Json(sr.toJson())); }
public ActionResult SaveSet(MerchantInformations oModel) { StoreManageBLL upb = new StoreManageBLL(); return(Json(upb.SetUser(oModel, UserId, UserName).toJson())); }
public SaveResult SaveAdd(string boUsername, MerchantEditInfoModel model, string inviteCode) { var fiiipayAccount = FiiiPayDB.UserAccountDb.GetSingle(t => t.CountryId == model.CountryId && t.Cellphone == model.FiiiPayAccount); if (fiiipayAccount == null) { return(new SaveResult(false, "FiiiPay用户不存在")); } if (fiiipayAccount.Status != (byte)Entities.Enums.AccountStatus.Active) { return(new SaveResult(false, "FiiiPay用户异常")); } if (fiiipayAccount.L1VerifyStatus != Entities.Enums.VerifyStatus.Certified) { return(new SaveResult(false, "该账号未通过KYC LV1认证")); } UserAccounts inviteAccount = null; bool needInsertInviteRecord = false; if (!string.IsNullOrEmpty(inviteCode)) { inviteAccount = FiiiPayDB.UserAccountDb.GetSingle(t => t.InvitationCode == inviteCode); if (inviteAccount == null) { return(new SaveResult(false, "无效的邀请码")); } if (inviteAccount.InvitationCode == fiiipayAccount.InvitationCode) { return(new SaveResult(false, "不能填写商家自己的邀请码")); } needInsertInviteRecord = true; } var existRecord = FiiiPayDB.DB.Queryable <InviteRecords>().First(t => t.AccountId == fiiipayAccount.Id && t.Type == InviteType.FiiipayMerchant); if (existRecord == null) { needInsertInviteRecord = needInsertInviteRecord && true; } else { if (existRecord.InviterCode != inviteCode) { return(new SaveResult(false, "已经设置了其他账号为邀请人")); } needInsertInviteRecord = false; } var country = FoundationDB.CountryDb.GetSingle(t => t.Code == model.CountryCode); if (country == null) { return(new SaveResult(false, "无效的国家")); } #region entities Guid merchantInfoId = Guid.NewGuid(); DateTime dtNow = DateTime.UtcNow; MerchantInformations merchantInfo = new MerchantInformations { Id = merchantInfoId, CreateTime = dtNow, FromType = InputFromType.BOInput, MerchantName = model.MerchantName, WeekTxt = model.WeekTxt, Tags = model.TagList == null ? "" : string.Join(",", model.TagList), Introduce = model.Introduce, CountryId = country.Id, PhoneCode = country.PhoneCode, Address = model.Address, Lng = model.Lng, Lat = model.Lat, Status = Status.Enabled, VerifyStatus = Entities.Enums.VerifyStatus.Certified, MerchantAccountId = fiiipayAccount.Id, Phone = model.Phone, IsPublic = Status.Enabled, FileId = model.FileId, ThumbnailId = model.FileId,//new BlobBLL().UploadWithCompress(model.FileId), AccountType = Entities.Enums.AccountType.User, Markup = 0, FeeRate = 0, IsAllowExpense = true, Week = Week.Monday, ApplicantName = model.ApplicantName }; InviteRecords inviteRecord = new InviteRecords { AccountId = fiiipayAccount.Id, InviterCode = inviteCode, Type = InviteType.FiiipayMerchant, InviterAccountId = inviteAccount?.Id ?? Guid.Empty, Timestamp = dtNow }; FiiipayMerchantProfiles profile = new FiiipayMerchantProfiles { MerchantInfoId = merchantInfoId, BusinessLicenseImage = model.BusinessLicenseImage, LicenseNo = model.LicenseNo }; FiiipayMerchantVerifyRecords record = new FiiipayMerchantVerifyRecords { CreateTime = dtNow, MerchantInfoId = merchantInfoId, BusinessLicenseImage = model.BusinessLicenseImage, LicenseNo = model.LicenseNo, VerifyStatus = Entities.Enums.VerifyStatus.Certified, VerifyTime = dtNow, Auditor = boUsername }; List <MerchantCategorys> categorys = model.MerchantCategorys.Select(t => new MerchantCategorys { MerchantInformationId = merchantInfoId, Category = t }).ToList(); List <MerchantOwnersFigures> figuresList = new List <MerchantOwnersFigures>(); if (model.FigureImgIdList != null) { var blobBLL = new BlobBLL(); for (int i = 0; i < model.FigureImgIdList.Length; i++) { figuresList.Add(new MerchantOwnersFigures { MerchantInformationId = merchantInfoId, FileId = model.FigureImgIdList[i], Sort = i, ThumbnailId = model.FigureImgIdList[i]//blobBLL.UploadWithCompress(model.FigureImgIdList[i]) }); } } var coinList = FoundationDB.CryptocurrencyDb.GetList(); List <MerchantSupportCryptos> supportCryptoList = model.SupportCoins.Select(t => new MerchantSupportCryptos { MerchantInfoId = merchantInfoId, CryptoId = t, CryptoCode = coinList == null ? "" : coinList.Find(c => c.Id == t).Code }).ToList(); #endregion var sr = FiiiPayDB.DB.Ado.UseTran(() => { FiiiPayDB.MerchantInformationDb.Insert(merchantInfo); FiiiPayDB.FiiipayMerchantProfileDb.Insert(profile); FiiiPayDB.FiiipayMerchantVerifyRecordDb.Insert(record); if (needInsertInviteRecord) { FiiiPayDB.InviteRecordDb.Insert(inviteRecord); } if (categorys.Count > 0) { FiiiPayDB.MerchantCategoryDb.InsertRange(categorys); } if (figuresList.Count > 0) { FiiiPayDB.MerchantOwnersFigureDb.InsertRange(figuresList); } if (supportCryptoList != null && supportCryptoList.Count > 0) { FiiiPayDB.MerchantSupportCryptoDb.InsertRange(supportCryptoList); } }); return(new SaveResult(sr.IsSuccess, sr.ErrorMessage)); }
public SaveResult SaveEdit(string boAccountName, MerchantEditInfoModel model) { MerchantInformations originMerchantInfo = FiiiPayDB.MerchantInformationDb.GetById(model.Id); if (originMerchantInfo == null) { return(new SaveResult(false)); } var country = FoundationDB.CountryDb.GetSingle(t => t.Code == model.CountryCode); if (country == null) { return(new SaveResult(false, "无效的国家")); } DateTime dtNow = DateTime.UtcNow; #region entities set value originMerchantInfo.LastModifyBy = boAccountName; originMerchantInfo.LastModifyTime = dtNow; originMerchantInfo.MerchantName = model.MerchantName; originMerchantInfo.WeekTxt = model.WeekTxt; originMerchantInfo.Tags = model.TagList == null ? "" : string.Join(",", model.TagList); originMerchantInfo.Introduce = model.Introduce; originMerchantInfo.CountryId = country.Id; originMerchantInfo.PhoneCode = country.PhoneCode; originMerchantInfo.Address = model.Address; originMerchantInfo.Lng = model.Lng; originMerchantInfo.Lat = model.Lat; originMerchantInfo.Phone = model.Phone; if (originMerchantInfo.FileId != model.FileId) { originMerchantInfo.FileId = model.FileId; originMerchantInfo.ThumbnailId = new BlobBLL().UploadWithCompress(model.FileId); } originMerchantInfo.ApplicantName = model.ApplicantName; bool profileChanged = false; var originProfile = FiiiPayDB.FiiipayMerchantProfileDb.GetSingle(t => t.MerchantInfoId == originMerchantInfo.Id); if (originMerchantInfo.VerifyStatus != Entities.Enums.VerifyStatus.Certified) { profileChanged = profileChanged || originProfile.BusinessLicenseImage != model.BusinessLicenseImage; profileChanged = profileChanged || originProfile.LicenseNo != model.LicenseNo; originProfile.LicenseNo = model.LicenseNo; originProfile.BusinessLicenseImage = model.BusinessLicenseImage; } FiiipayMerchantVerifyRecords record = new FiiipayMerchantVerifyRecords { CreateTime = dtNow, MerchantInfoId = originMerchantInfo.Id, BusinessLicenseImage = model.BusinessLicenseImage, LicenseNo = model.LicenseNo, VerifyStatus = Entities.Enums.VerifyStatus.Certified, VerifyTime = dtNow, Auditor = boAccountName }; List <MerchantCategorys> categorys = model.MerchantCategorys.Select(t => new MerchantCategorys { MerchantInformationId = originMerchantInfo.Id, Category = t }).ToList(); var coinList = FoundationDB.CryptocurrencyDb.GetList(); List <MerchantSupportCryptos> supportCryptoList = model.SupportCoins.Select(t => new MerchantSupportCryptos { MerchantInfoId = originMerchantInfo.Id, CryptoId = t, CryptoCode = coinList == null ? "" : coinList.Find(c => c.Id == t).Code }).ToList(); //下面写这么多,就是为了尽可能少调图片接口 List <MerchantOwnersFigures> toAddFiguresList = new List <MerchantOwnersFigures>(); List <MerchantOwnersFigures> toChangeSortFiguresList = new List <MerchantOwnersFigures>(); List <Guid> toDeleteFiguresIdList = new List <Guid>(); var originFigureList = FiiiPayDB.MerchantOwnersFigureDb.GetList(t => t.MerchantInformationId == originMerchantInfo.Id); if (model.FigureImgIdList != null) { var blobBLL = new BlobBLL(); for (int i = 0; i < model.FigureImgIdList.Length; i++) { var figureItem = originFigureList == null ? null : originFigureList.Find(t => t.FileId == model.FigureImgIdList[i]); if (figureItem == null) { toAddFiguresList.Add(new MerchantOwnersFigures { MerchantInformationId = originMerchantInfo.Id, FileId = model.FigureImgIdList[i], Sort = i, ThumbnailId = blobBLL.UploadWithCompress(model.FigureImgIdList[i]) }); } else { figureItem.Sort = i; toChangeSortFiguresList.Add(figureItem); } } } if (originFigureList != null) { foreach (var item in originFigureList) { if (!toChangeSortFiguresList.Any(t => t.FileId == item.FileId)) { toDeleteFiguresIdList.Add(item.FileId); } } } #endregion var sr = FiiiPayDB.DB.Ado.UseTran(() => { FiiiPayDB.MerchantInformationDb.Update(originMerchantInfo); if (profileChanged) { FiiiPayDB.FiiipayMerchantProfileDb.Update(originProfile); FiiiPayDB.FiiipayMerchantVerifyRecordDb.Insert(record); } FiiiPayDB.MerchantCategoryDb.Delete(t => t.MerchantInformationId == originMerchantInfo.Id); FiiiPayDB.MerchantCategoryDb.InsertRange(categorys); FiiiPayDB.MerchantSupportCryptoDb.Delete(t => t.MerchantInfoId == originMerchantInfo.Id); FiiiPayDB.MerchantSupportCryptoDb.InsertRange(supportCryptoList); if (toDeleteFiguresIdList != null && toDeleteFiguresIdList.Count > 0) { FiiiPayDB.MerchantOwnersFigureDb.Delete(t => t.MerchantInformationId == originMerchantInfo.Id && toDeleteFiguresIdList.Contains(t.FileId)); } if (toAddFiguresList != null && toAddFiguresList.Count > 0) { FiiiPayDB.MerchantOwnersFigureDb.InsertRange(toAddFiguresList); } if (toChangeSortFiguresList != null && toChangeSortFiguresList.Count > 0) { FiiiPayDB.MerchantOwnersFigureDb.UpdateRange(toChangeSortFiguresList); } }); return(new SaveResult(sr.IsSuccess, sr.ErrorMessage)); }