544782275@qq.com 4 年之前
父節點
當前提交
b799afb675
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      app/admin/controller/School.php

+ 7 - 1
app/admin/controller/School.php

@@ -64,7 +64,13 @@ class School extends Controller
         if($this->request->isGet()) {
 
         }elseif ($this->request->isPost()){
-
+            if (isset($data['id']) && $data['id'] > 0) {
+                $is_set = $this->app->db->name('school2')->where('username',$data['username'])->where('id','<>',$data['id'])->find();
+                if($is_set){
+                    $this->error('不能设置重复的账号');
+                }
+                $data['password'] = md5($data['username']);
+            }
         }
     }
     /**