|  | @@ -177,6 +177,105 @@ class Index extends Api
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  | 
 |  | +     * 获取收礼排行
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    public function getUserGiftRank() {
 | 
											
												
													
														|  | 
 |  | +        $time = $this->request->request("time",0,"intval"); //时间筛选 1=小时榜,2=今日榜,3=本周榜,4=月榜
 | 
											
												
													
														|  | 
 |  | +        if(!in_array($time,[1,2,3,4])) {
 | 
											
												
													
														|  | 
 |  | +            $this->error("参数传入错误!");
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $hour = strtotime(date("Y-m-d H:00:00"));
 | 
											
												
													
														|  | 
 |  | +        $today = strtotime(date("Y-m-d 00:00:00"));
 | 
											
												
													
														|  | 
 |  | +        $weekend = strtotime('monday this week');
 | 
											
												
													
														|  | 
 |  | +        $month = strtotime(date("Y-m-01 00:00:00"));
 | 
											
												
													
														|  | 
 |  | +        // 剩余时间
 | 
											
												
													
														|  | 
 |  | +        $thistime = time();
 | 
											
												
													
														|  | 
 |  | +        switch ($time) {
 | 
											
												
													
														|  | 
 |  | +            case 1:
 | 
											
												
													
														|  | 
 |  | +                $redtime = 3600-($thistime - $hour);
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 2:
 | 
											
												
													
														|  | 
 |  | +                $redtime = 3600*24-($thistime - $today);
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 3:
 | 
											
												
													
														|  | 
 |  | +                $redtime = 3600*24*7-($thistime - $weekend);
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 4:
 | 
											
												
													
														|  | 
 |  | +                $monthend = mktime(23,59,59,date("m"),date("t"),date("Y"));
 | 
											
												
													
														|  | 
 |  | +                $redtime = ($monthend - $month)-($thistime - $month);
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $timeArr = [1=>$hour,2=>$today,3=>$weekend,4=>$month];
 | 
											
												
													
														|  | 
 |  | +        $where = [];
 | 
											
												
													
														|  | 
 |  | +        $where["a.createtime"] = ["gt",$timeArr[$time]];
 | 
											
												
													
														|  | 
 |  | +        $list = model('GiftUserParty')->alias("a")
 | 
											
												
													
														|  | 
 |  | +            ->field("sum(a.value) as total_price,u.avatar,u.nickname")
 | 
											
												
													
														|  | 
 |  | +            ->where($where)
 | 
											
												
													
														|  | 
 |  | +            ->join("hx_user u","u.id = a.user_id")
 | 
											
												
													
														|  | 
 |  | +            ->group("a.user_to_id")
 | 
											
												
													
														|  | 
 |  | +            ->order("total_price","desc")
 | 
											
												
													
														|  | 
 |  | +            ->limit(100)
 | 
											
												
													
														|  | 
 |  | +            ->select();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $data = [];
 | 
											
												
													
														|  | 
 |  | +        $data["redtime"] = $redtime;
 | 
											
												
													
														|  | 
 |  | +        $data["data"] = $list;
 | 
											
												
													
														|  | 
 |  | +        $this->success("获取成功!",$data);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 获取消费排行
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    public function getUserPayRank() {
 | 
											
												
													
														|  | 
 |  | +        $time = $this->request->request("time",0,"intval"); //时间筛选 1=小时榜,2=今日榜,3=本周榜,4=月榜
 | 
											
												
													
														|  | 
 |  | +        if(!in_array($time,[1,2,3,4])) {
 | 
											
												
													
														|  | 
 |  | +            $this->error("参数传入错误!");
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $hour = strtotime(date("Y-m-d H:00:00"));
 | 
											
												
													
														|  | 
 |  | +        $today = strtotime(date("Y-m-d 00:00:00"));
 | 
											
												
													
														|  | 
 |  | +        $weekend = strtotime('monday this week');
 | 
											
												
													
														|  | 
 |  | +        $month = strtotime(date("Y-m-01 00:00:00"));
 | 
											
												
													
														|  | 
 |  | +        // 剩余时间
 | 
											
												
													
														|  | 
 |  | +        $thistime = time();
 | 
											
												
													
														|  | 
 |  | +        switch ($time) {
 | 
											
												
													
														|  | 
 |  | +            case 1:
 | 
											
												
													
														|  | 
 |  | +                $redtime = 3600-($thistime - $hour);
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 2:
 | 
											
												
													
														|  | 
 |  | +                $redtime = 3600*24-($thistime - $today);
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 3:
 | 
											
												
													
														|  | 
 |  | +                $redtime = 3600*24*7-($thistime - $weekend);
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 4:
 | 
											
												
													
														|  | 
 |  | +                $monthend = mktime(23,59,59,date("m"),date("t"),date("Y"));
 | 
											
												
													
														|  | 
 |  | +                $redtime = ($monthend - $month)-($thistime - $month);
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $timeArr = [1=>$hour,2=>$today,3=>$weekend,4=>$month];
 | 
											
												
													
														|  | 
 |  | +        $where = [];
 | 
											
												
													
														|  | 
 |  | +        $where["a.type"] = ["in",[2,3,5,6]];//type:1=充值,2=买锤子,3=送礼物,4=声币换钻石,5=开贵族,6=买装扮,7=拒绝订单返还,8=完成订单收益
 | 
											
												
													
														|  | 
 |  | +        $where["a.createtime"] = ["gt",$timeArr[$time]];
 | 
											
												
													
														|  | 
 |  | +        $list = model('UserJewelLog')->alias("a")
 | 
											
												
													
														|  | 
 |  | +            ->field("sum(a.value) as total_price,u.avatar,u.nickname")
 | 
											
												
													
														|  | 
 |  | +            ->where($where)
 | 
											
												
													
														|  | 
 |  | +            ->join("hx_user u","u.id = a.user_id")
 | 
											
												
													
														|  | 
 |  | +            ->group("a.user_id")
 | 
											
												
													
														|  | 
 |  | +            ->order("total_price","desc")
 | 
											
												
													
														|  | 
 |  | +            ->limit(100)
 | 
											
												
													
														|  | 
 |  | +            ->select();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        $data = [];
 | 
											
												
													
														|  | 
 |  | +        $data["redtime"] = $redtime;
 | 
											
												
													
														|  | 
 |  | +        $data["data"] = $list;
 | 
											
												
													
														|  | 
 |  | +        $this->success("获取成功!",$data);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  |       * 获取派对热度排序
 |  |       * 获取派对热度排序
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      public function getPartyHotList() {
 |  |      public function getPartyHotList() {
 |