Selaa lähdekoodia

删除无用方法

lizhen_gitee 1 vuosi sitten
vanhempi
commit
c6b1d5225c

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

@@ -1227,40 +1227,6 @@ class Party extends Api
         $this->success("已关注");
     }
 
-    /**
-     * 派对收藏列表
-     */
-    public function cellectionPartyList() {
-        $page = input('page',1); // 分页
-        $pageNum = input('pageNum',10); // 分页
-        // 分页搜索构建
-        $pageStart = ($page-1)*$pageNum;
-        $partycellectionModel = new \app\common\model\PartyCellection();
-        $where = [];
-        $where["a.user_id"] = $this->auth->id;
-        $where["r.room_type"] = 1;
-        $list = $partycellectionModel->alias("a")
-            ->field("a.party_id,r.party_logo,r.party_hot,r.party_id as r_id,r.party_name,t.id as party_type_id,t.name as party_type")
-            ->where($where)
-            ->join("hx_party r","a.party_id = r.id")
-            ->join("hx_party_type t","t.id = r.party_type","left")
-            ->limit($pageStart,$pageNum)
-            ->select();
-
-        if($list) {
-
-
-            $users = [];
-            foreach($list as $k => $v) {
-                $users[$v["party_id"]] = $v["party_hot"];
-            }
-            $partyModel = new \app\common\model\Party();
-            $resultInfo = $partyModel->getPatyInfoByPartyId($users,"party",0,0,1,0,20,0);
-            $this->success("获取成功!",$resultInfo);
-        }
-
-        return $this->success("获取成功!",$list);
-    }
 
     /**
      * 获取派对信息

+ 1 - 81
application/common/model/Live.php

@@ -15,85 +15,5 @@ class Live extends Model
     // 定义时间戳字段名
     protected $createTime = 'createtime';
 
-    /**
-     * 根据liveid 获取 live 信息
-     */
-    public function getLiveInfoByLiveId($live_id,$type_id,$is_recommend,$all) {
-        if(!$live_id) return false;
-        // 判断派对是否存在
-        $redis = new Redis();
-        $redisconfig = config("redis");
-        $redis->connect($redisconfig["host"], $redisconfig["port"]);
-        if ($redisconfig['redis_pwd']) {
-            $redis->auth($redisconfig['redis_pwd']);
-        }
-        if($redisconfig['redis_selectdb'] > 0){
-            $redis->select($redisconfig['redis_selectdb']);
-        }
-
-        if(is_array($live_id)) {
-            $redisLiveInfo = [];
-            foreach($live_id as $k => $v) {
-                $getredisLiveInfo = $redis->get('live_'.$v);
-                if(!$getredisLiveInfo) {
-                    // redis 中数据丢失 (每天凌晨四点更新数据到数据库做备份用)
-                    $where = [];
-                    $where["a.id"] = $v;
-                    if($all != 1) {
-                        $type_id > 0 && $where["live_type"] = $type_id;
-                        $is_recommend == 1 && $where["is_recommend"] = 1;
-                    }
-                    $getredisLiveInfo = $this->alias("a")
-                        ->field("a.*,b.id as live_type,b.name as live_type_name,u.nickname,u.avatar,at.name as anchor_type_name")
-                        ->join("hx_live_type b","a.live_type = b.id","left")
-                        ->join("hx_user u","a.user_id = u.id","left")
-                        ->join("hx_user_anchor an","a.user_id = an.user_id","left")
-                        ->join("hx_user_anchor_type at","an.type_id = an.type_id")
-                        ->where($where)->find();
-                    $getredisLiveInfo && $redis->set('live_'.$live_id,json_encode($getredisLiveInfo));
-//                    $redisLiveInfo[] = $getredisLiveInfo;
-                    $foreachData = $getredisLiveInfo;
-                } else {
-                    $foreachData = json_decode($getredisLiveInfo,true);
-                }
-                if(!$foreachData) {
-                    return [];
-                }
-                if(($is_recommend == 1 && $foreachData["is_recommend"] == 1) || ($type_id == $foreachData["live_type"]) || ($all == 1)) {
-                    $redisLiveInfo[] = [
-                        "id" => $foreachData["id"],
-                        "live_id" => $foreachData["live_id"],
-                        "live_notice" => $foreachData["live_notice"],
-                        "avatar" => $foreachData["avatar"],
-                        "live_hot" => $foreachData["live_hot"],
-                        "live_type_name" => $foreachData["live_type_name"],
-                    ];
-                }
-
-
-            }
-        } else {
-            $data = $redis->get('live_'.$live_id);
-            if(!$data) {
-                // redis 中数据丢失 (每天凌晨四点更新数据到数据库做备份用)
-                $data = $this->where(["live_id"=>$live_id])->find();
-                $redis->set('live_'.$live_id,json_encode($data));
-            } else {
-                $data = json_decode($data,true);
-            }
-
-            if(($is_recommend == 1 && $data["is_recommend"] == 1) || ($type_id == $data["live_type"]) ||  ($all == 1)) {
-                $redisLiveInfo = [
-                    "id" => $data["id"],
-                    "live_id" => $data["live_id"],
-                    "live_notice" => $data["live_notice"],
-                    "avatar" => $data["avatar"],
-                    "live_hot" => $data["live_hot"],
-                    "live_type_name" => $data["live_type_name"],
-                ];
-            }
-        }
-
-        return $redisLiveInfo;
-    }
+    
 }

+ 0 - 79
application/common/model/Party.php

@@ -17,86 +17,7 @@ class Party extends Model
     protected $updateTime = 'updatetime';
 
 
-    /**
-     * 根据partyid 获取 party 信息
-     */
-    public function getPatyInfoByPartyId($party_id,$room_type,$type_id,$is_recommend,$all,$start = 0,$end = 9,$index) {
-        if(!$party_id) return false;
-        // 判断派对是否存在
-        $redis = new Redis();
-        $redisconfig = config("redis");
-        $redis->connect($redisconfig["host"], $redisconfig["port"]);
-        if ($redisconfig['redis_pwd']) {
-            $redis->auth($redisconfig['redis_pwd']);
-        }
-        if($redisconfig['redis_selectdb'] > 0){
-            $redis->select($redisconfig['redis_selectdb']);
-        }
-        if(!is_array($party_id)) {
-            return [];
-        }
-      
-        $redisPartyInfo = [];
-        foreach($party_id as $k => $v) {
-            //rediskey:派对详情
-            $getredisPartyInfo = $redis->get($room_type.'_'.$k);
 
-            $foreachData = json_decode($getredisPartyInfo,true);
-
-            if(!$foreachData || $foreachData["is_close"] == 1) continue;
-            if(!$foreachData || $foreachData["is_online"] == 0) continue;
-            if(!$foreachData || $foreachData["party_pass"] != '') continue;
-            $mod = isset($foreachData["party_type"])?intval($foreachData["party_type"])%5:1;
-            if(isset($foreachData["type_name"]) && $foreachData["type_name"]) {
-                $type_name = $foreachData["type_name"];
-            } else {
-                $type_name = "普通房";
-            }
-
-            $hasdata = false;
-            if($all == 1) {
-                if($is_recommend == 1) {
-                    if($foreachData["is_recommend"] == 1) $hasdata = true;
-                } else {
-                    $hasdata = true;
-                }
-            } elseif($type_id > 0) {
-                if($type_id == $foreachData["party_type"]) $hasdata = true;
-            }
-            if($foreachData["status"] != 1) $hasdata = false;
-            $hasdata && $redisPartyInfo[] = [
-                "id" => $foreachData["id"],
-                "party_id" => $foreachData["party_id"],
-                "r_id" => $foreachData["party_id"],
-                "party_name" => $foreachData["party_name"],
-                "party_pass" => $foreachData["party_pass"]?$foreachData["party_pass"]:"",
-                "party_hot" => $v,
-                "party_logo" => localpath_to_netpath($foreachData["party_logo"]),
-                "party_type" => $type_name,
-                "avatar" => $room_type == 2 ? $foreachData["avatar"]:"",
-                "party_type_color" => $mod == 0?5:$mod,
-                "party_user" => isset($foreachData["party_user"]) ? array_values($foreachData["party_user"]) : [] // 当前麦位人头像
-            ];
-
-        }
-
-        $resdata = [];
-        if($index == 1) {
-            $num = $end - $start + 1;
-            $countData = count($redisPartyInfo);
-            if($num > $countData) $num = $countData;
-            if($redisPartyInfo) {
-                $dataRand = array_rand($redisPartyInfo,$num);
-                $dataRand = is_array($dataRand)?$dataRand:[$dataRand];
-                if($redisPartyInfo) foreach($redisPartyInfo as $k => $v) if(in_array($k,$dataRand)) $resdata[] = $v;
-            }
-
-        } else {
-            if($redisPartyInfo) foreach($redisPartyInfo as $k => $v) if($k >= $start && $k <= $end) $resdata[] = $v;
-        }
-
-        return $resdata;
-    }
 
 
 }

+ 0 - 127
application/common/service/RoomService.php

@@ -80,133 +80,6 @@ class RoomService
         return $result;
     }
 
-    /**
-     * 获取房间信息。没有地方使用
-     */
-    public function getRoomList($params=[])
-    {
-        $result = [
-            'status' => 1,
-            'msg' => '',
-            'data' => [],
-        ];
-        try {
-            $partyIds    = isset($params['ids']) ? $params['ids'] : [];
-            $typeId      = isset($params['type_id']) ? $params['type_id'] : 0;
-            $isRecommend = isset($params['is_recommend']) ? $params['is_recommend'] : 0;
-            $all         = isset($params['is_recommend']) ? $params['all'] : 0;
-            $start       = isset($params['start']) ? $params['start'] : 1;
-            $end         = isset($params['end']) ? $params['end'] : 1;
-            $index       = isset($params['index']) ? $params['index'] : 0;
-            if(!$partyIds) throw new Exception('未获取到房间ID');;
-
-            $redisPartyInfo = $resdata = [];
-            $where['status'] = 1;
-            //$where['is_online'] = 1;
-            $where['is_close'] = 0;
-            $where['id'] = ['in',$partyIds];
-            $field = 'id,room_type,party_hot';
-            $partyData = $this->model->field($field)->where($where)->order('party_hot desc')->select();
-            if (!empty($partyData)) {
-                //获取房间用户信息
-                /*$tenimService = new TenimService();
-                $userParams = ['party_ids' => $partyIds];
-                $userImRes = $tenimService->getRoomUser($userParams);*/
-                foreach($partyData as $k => $v) {
-                    $roomType = $v['room_type'];
-                    $roomTypeStr = isset($this->roomTypeArr[$roomType]) ? $this->roomTypeArr[$roomType] : '';
-                    $getredisPartyInfo = $this->redis->get($roomTypeStr.'_'.$v['id']);
-
-                    $foreachData = json_decode($getredisPartyInfo,true);
-                    $isClose = isset($foreachData["is_close"]) ? $foreachData["is_close"] : 0;
-                    $partyPass = isset($foreachData["party_pass"]) ? $foreachData["party_pass"] : '';
-                    if(!$foreachData || $isClose == 1) continue;
-                    if(!$foreachData || $foreachData["is_online"] == 0) continue;
-                    //if(!$foreachData || $partyPass != '') continue;//设置密码的也显示
-                    $mod = isset($foreachData["party_type"])?intval($foreachData["party_type"])%5:1;
-                    if(isset($foreachData["type_name"]) && $foreachData["type_name"]) {
-                        $type_name = $foreachData["type_name"];
-                    } else {
-                        $type_name = "普通房";
-                    }
-
-                    $hasdata = false;
-                    if($all == 1) {
-                        if($isRecommend == 1) {
-                            if($foreachData["is_recommend"] == 1) $hasdata = true;
-                        } else {
-                            $hasdata = true;
-                        }
-                    } elseif($typeId > 0) {
-                        if($typeId == $foreachData["party_type"]) $hasdata = true;
-                    }
-                    if($foreachData["status"] != 1) $hasdata = false;
-                    $foreachData = info_domain_image($foreachData,['party_logo']);
-                    //$userIds = $this->redis->zRange("party_user_".$foreachData["id"],0,-1);
-                    if ($hasdata) {
-                        /*$field = 'user_id,avatar';
-                        $fieldArr = explode(',',$field);*/
-                        /*$userWhere['id'] = ['in', $userIds];
-                        $userModel = new \app\common\model\User();
-                        $userData = $userModel->field($field)->where($userWhere)->select();*/
-                        $userDataResult = $this->getPartyUserList(['party_id'=>$v['id']]);
-                        $userDataRes = isset($userDataResult['data']) ? $userDataResult['data'] : [];
-                        $userData = isset($userDataRes['member_list']) ? $userDataRes['member_list'] : [];
-                        $userDatas = [];
-                        if (!empty($userData)) {
-                            $userDatas = $userData;
-                            $userDatas = list_domain_image($userDatas,['avatar']);
-                        }
-                        $partyUserList = [
-                            'user_list' => $userDatas,
-                            'online_num' => count($userData),
-                        ];
-                        $redisPartyInfo[] = [
-                            "id" => $foreachData["id"],
-                            "room_type" => $v['room_type'],
-                            "party_id" => $foreachData["party_id"],
-                            "r_id" => $foreachData["party_id"],
-                            "party_name" => $foreachData["party_name"],
-                            "party_pass" => $foreachData["party_pass"] ? $foreachData["party_pass"]:"",
-                            "party_hot" => $v['party_hot'],
-                            "party_logo" => $foreachData["party_logo"],
-                            "party_type" => $type_name,
-                            "avatar" => $roomType == 2 ? $foreachData["avatar"]:"",
-                            "party_type_color" => $mod == 0?5:$mod,
-                            "party_user" => $partyUserList,
-                        ];
-                    }
-                }
-
-                if($index == 1) {
-                    $num = $end - $start + 1;
-                    $countData = count($redisPartyInfo);
-                    if($num > $countData) $num = $countData;
-                    if($redisPartyInfo) {
-                        $dataRand = array_rand($redisPartyInfo,$num);
-                        $dataRand = is_array($dataRand)?$dataRand:[$dataRand];
-                        if($redisPartyInfo) {
-                            foreach($redisPartyInfo as $k => $v) {
-                                if(in_array($k,$dataRand)) $resdata[] = $v;
-                            }
-                        }
-                    }
-                } else {
-                    if($redisPartyInfo) {
-                        foreach($redisPartyInfo as $k => $v){
-                            if($k >= $start && $k <= $end) $resdata[] = $v;
-                        }
-                    }
-                }
-            }
-
-            $result['data'] = $resdata;
-        } catch (Exception $e) {
-            $result['status'] = 0;
-            $result['msg'] = $e->getMessage();
-        }
-        return $result;
-    }
 
     /**
      * 房间用户信息