Explorar el Código

家族搜索列表

zhangxiaobin hace 1 año
padre
commit
5595b89e45
Se han modificado 1 ficheros con 5 adiciones y 3 borrados
  1. 5 3
      application/api/controller/Guild.php

+ 5 - 3
application/api/controller/Guild.php

@@ -169,12 +169,14 @@ class Guild extends Api
      */
     public function getGuildList() {
         $search = $this->request->request("search","","string"); //搜索的字段 公会名称/公会ID
-        if(!$search) $this->error("请输入要搜索的公会名称或公会ID");
+        //if(!$search) $this->error("请输入要搜索的公会名称或公会ID");
         global $whereOr;
         $where = [];$whereOr = [];
         $where['status'] = 1;
-        $whereOr['name'] = array('like', '%' . $search . '%');
-        $whereOr['g_id'] = $search;
+        if (!empty($search)) {
+            $whereOr['name'] = array('like', '%' . $search . '%');
+            $whereOr['g_id'] = $search;
+        }
         $res = \app\common\model\Guild::field("id,g_id,user_id,party_id,name,image,desc,member")
             ->where($where)
             ->where(function ($query) {