lrf402788946 4 年之前
父节点
当前提交
6f04cd5df1
共有 1 个文件被更改,包括 3 次插入1 次删除
  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 = {