Procházet zdrojové kódy

我加入的家族,我创建的家族

lizhen_gitee před 1 rokem
rodič
revize
1d3b8bfd1b

+ 39 - 18
application/api/controller/Family.php

@@ -38,6 +38,37 @@ class Family extends Api
         $this->success("获取成功!",$res);
     }
 
+    //我创建的家族列表
+    public function getGuildList_mycreate(){
+        $where = ['user_id'=> $this->auth->id];
+
+        $res = Db::name('family')->field("id,g_id,user_id,group_id,name,image,desc,notice,member")
+            ->where($where)
+            ->autopage()
+            ->select();
+        $res = list_domain_image($res,['image']);
+
+        $this->success("获取成功!",$res);
+    }
+
+    //我已经加入的家族列表
+    public function getGuildList_myjoinin(){
+        $where = [
+            'fm.user_id'=> $this->auth->id,
+            'fm.status' => 1,
+        ];
+
+        $res = Db::name('family_member')->alias('fm')
+            ->field("f.id,f.g_id,f.user_id,f.group_id,f.name,f.image,f.desc,f.notice,f.member")
+            ->join('family f','fm.guild_id = f.id','LEFT')
+            ->where($where)
+            ->autopage()
+            ->select();
+        $res = list_domain_image($res,['image']);
+
+        $this->success("获取成功!",$res);
+    }
+
 
     /**
      * 获取公会信息-新
@@ -208,10 +239,6 @@ class Family extends Api
         }
     }
 
-
-
-
-
     /**
      * 公会签约申请
      */
@@ -345,8 +372,6 @@ class Family extends Api
         }
     }
 
-
-
     /**
      * 公会申请加入列表
      */
@@ -659,19 +684,15 @@ class Family extends Api
      */
     public function getStatus()
     {
-        try {
-            $id = input('guild_id',0);
-            if (!empty($id)) {
-                $where['id'] = $id;
-            } else {
-                $where['user_id'] = $this->auth->id;
-            }
-            $field = 'id,status';
-            $guild = model('Family')->field($field)->where($where)->find();
-            $this->success('获取成功', $guild);
-        } catch (Exception $e) {
-            $this->error($e->getMessage());
+        $id = input('guild_id',0);
+        if (!empty($id)) {
+            $where['id'] = $id;
+        } else {
+            $where['user_id'] = $this->auth->id;
         }
+        $field = 'id,status';
+        $guild = model('Family')->field($field)->where($where)->find();
+        $this->success('获取成功', $guild);
     }
 
 }

+ 0 - 34
application/api/controller/Guild.php

@@ -872,39 +872,5 @@ class Guild extends Api
         $this->success("获取成功!",$guildInfo);
     }
 
-    /**
-     * 公会助手列表
-     */
-    public function guildAssistantList() {
-        $user_id = $this->auth->id;
-        // 获取公会信息
-        $guildInfo = \app\common\model\Guild::where(["user_id"=>$user_id])->find();
-        if(!$guildInfo) $this->error("公会信息获取失败!");
-        // 先获取申请列表
-        $where = [];
-        $where["guild_id"] = $guildInfo->id;
-        $where["status"] = 0;
-        $joinList = \app\common\model\GuildJoinin::field("id,user_avatar,user_nickname,guild_name,createtime")->where($where)->order("createtime","desc")->select();
-        if($joinList) foreach($joinList as $k => $v) {
-            $joinList[$k]["createtime"] = date("Y-m-d H:i",$v["createtime"]);
-        }
 
-        // 再获取审核记录
-        $where = [];
-        $where["a.guild_id"] = $guildInfo->id;
-        $where["a.user_id"] = $user_id;
-        $joinlogList = \app\common\model\GuildJoininLog::alias("a")
-            ->field("a.id,a.user_nickname,a.user_u_id,a.guild_name,a.guild_g_id,a.sign_time_slot,a.status,u.nickname as operator,a.createtime")
-            ->join("hx_user u","a.operator = u.id")
-            ->whereOr($where)
-            ->order("a.createtime","desc")
-            ->select();
-        if($joinlogList) foreach($joinlogList as $k => $v) {
-            $joinlogList[$k]["createtime"] = date("Y-m-d H:i",$v["createtime"]);
-        }
-        $res = [];
-        $res["joinList"] = $joinList;
-        $res["joinlogList"] = $joinlogList;
-        $this->success("获取成功!",$res);
-    }
 }