public async Task Put(Guid id, [FromBody] AccountContactDto contactDto) { var contact = Mapper.Map <AccountContact>(contactDto); contact.Id = id; await _reportingService.ReportAccountChanged(contactDto.AccountId.ToString()); await _dbContext.Update(contact); }
public async Task <CreatedResult> Post([FromBody] AccountContactDto contactDto) { var contact = Mapper.Map <AccountContact>(contactDto); var contactId = Guid.NewGuid(); contact.Id = contactId; await _dbContext.Add(contact); await _reportingService.ReportAccountChanged(contactDto.AccountId.ToString()); return(Created(new Uri($"/api/Contact/{contactId}", UriKind.Relative), new { id = contactId })); }
public static string DesensitizeContact(AccountContactDto contactDto) { var defaultUserAuthorize = HttpContext.Current.GetDefaultUserAuthorize(); if (!contactDto.IsForbidden && DesensitizationUtil.IsPhoneNumber(contactDto.Contact)) { //屏蔽手机号 if (!defaultUserAuthorize.DisplayPhone) { contactDto.DesensitizeContact = DesensitizationUtil.FormatePhoneNumber(contactDto.Contact); } } //银行检查状态下所有的资料全部屏蔽,脱敏规则统一为中间4位以*号替换进行脱敏(需求1099) if (!defaultUserAuthorize.DisplayOtherContact && !DesensitizationUtil.IsPhoneNumber(contactDto.Contact)) { contactDto.DesensitizeContact = DesensitizationUtil.TxtReplace(contactDto.Contact, 4, '*'); } return(contactDto.DesensitizeContact); }