瀏覽代碼

家族搜索列表

zhangxiaobin 1 年之前
父節點
當前提交
5595b89e45
共有 1 個文件被更改,包括 5 次插入3 次删除
  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) {