lrf402788946 4 years ago
parent
commit
6f04cd5df1
1 changed files with 3 additions and 1 deletions
  1. 3 1
      app/service/student.js

+ 3 - 1
app/service/student.js

@@ -26,7 +26,9 @@ class StudentService extends CrudService {
   }
 
   async create(data) {
-    const { name, phone: mobile, gender } = data;
+    const { name, phone: mobile, gender, id_number } = data;
+    const count = await this.model.count({ id_number });
+    if (count) throw new BusinessError(ErrorCode.DATA_EXISTED, '该身份证号已存在,若未发现错误,请联系开发人员查证');
     const res = await this.model.create(data);
     if (res) {
       const obj = {