alias("a") ->field("a.id,a.user_id,a.fans_id,u.nickname,u.avatar,v.voice,v.voice_time,t.name as type_name") ->join("hx_user u","u.id = a.user_id","left") ->join("hx_match_voice v","v.user_id = a.user_id","left") ->join("hx_match_type t","t.id = v.type_id","left") ->where($where) ->limit($pageStart,$pageNum) ->select(); if(!$list) return []; foreach($list as $k => &$v) { $v["voice"] || $v["voice"] = ""; $v["voice_time"] || $v["voice_time"] = 0; $v["type_name"] || $v["type_name"] = ""; } return $list; } /** * 获取喜欢列表 */ public function getVoiceFansList($user_id,$pageStart=1,$pageNum=10) { $where = []; $where["a.user_id"] = $user_id; $list = $this->alias("a") ->field("a.id,a.fans_id as user_id,u.nickname,u.avatar,v.voice,v.voice_time,t.name as type_name") ->join("hx_user u","u.id = a.fans_id","left") ->join("hx_match_voice v","v.user_id = a.fans_id","left") ->join("hx_match_type t","t.id = v.type_id","left") ->where($where) ->limit($pageStart,$pageNum) ->select(); if(!$list) return []; foreach($list as $k => &$v) { $v["voice"] || $v["voice"] = ""; $v["voice_time"] || $v["voice_time"] = 0; $v["type_name"] || $v["type_name"] = ""; } return $list; } }