Browse Source

修改信息添加校验

lidongze 3 years ago
parent
commit
5a8bfa5226
1 changed files with 20 additions and 0 deletions
  1. 20 0
      src/main/java/com/izouma/nineth/web/UserDetailController.java

+ 20 - 0
src/main/java/com/izouma/nineth/web/UserDetailController.java

@@ -40,6 +40,26 @@ public class UserDetailController extends BaseController {
             if (!contentAuditService.auditText(record.getAutograph())) {
                 throw new BusinessException("简介包含非法内容");
             }
+        }if (StringUtils.isNotBlank(record.getNickname())) {
+            if (!contentAuditService.auditText(record.getNickname())) {
+                throw new BusinessException("昵称包含非法内容");
+            }
+        }if (StringUtils.isNotBlank(record.getMail())) {
+            if (!contentAuditService.auditText(record.getMail())) {
+                throw new BusinessException("邮箱包含非法内容");
+            }
+        }if (StringUtils.isNotBlank(record.getSchool())) {
+            if (!contentAuditService.auditText(record.getSchool())) {
+                throw new BusinessException("学校包含非法内容");
+            }
+        }if (StringUtils.isNotBlank(record.getCompany())) {
+            if (!contentAuditService.auditText(record.getCompany())) {
+                throw new BusinessException("公司包含非法内容");
+            }
+        }if (StringUtils.isNotBlank(record.getOccupation())) {
+            if (!contentAuditService.auditText(record.getOccupation())) {
+                throw new BusinessException("职业包含非法内容");
+            }
         }
         return userDetailRepo.save(record);
     }