浏览代码

Loading users by name, not case sensitive

Visman 5 年之前
父节点
当前提交
837750c86a
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      app/Models/User/Load.php

+ 5 - 1
app/Models/User/Load.php

@@ -23,7 +23,11 @@ class Load extends Action
             $where = 'u.id IN (?ai:field)';
         } elseif ($value instanceof User) {
             if ('' != $value->username) {
-                $where = 'u.username=?s:field';
+                if (true === $value->ciNameSearch) {
+                    $where = 'LOWER(u.username)=LOWER(?s:field)';
+                } else {
+                    $where = 'u.username=?s:field';
+                }
                 $value = $value->username;
             } elseif ('' != $value->email && '' != $value->email_normal) {
                 $where = 'u.email_normal=?s:field';