|  | @@ -571,6 +571,41 @@ class Party extends Common
 | 
	
		
			
				|  |  |          $this->success("获取成功!",$userList);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /** 连续进房提示
 | 
	
		
			
				|  |  | +     * @param $user_id
 | 
	
		
			
				|  |  | +     * @param $party_id
 | 
	
		
			
				|  |  | +     * @param $redis
 | 
	
		
			
				|  |  | +     * @return int
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private function getUserJoinPartyDays($user_id, $party_id,$redis)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        $days = 1;
 | 
	
		
			
				|  |  | +        $joinPartyDays = $redis->hGet("joinParty_days",$user_id."-".$party_id);
 | 
	
		
			
				|  |  | +        if ($joinPartyDays){
 | 
	
		
			
				|  |  | +            $joinPartyDaysArr = explode('-',$joinPartyDays);
 | 
	
		
			
				|  |  | +            $oldTime = (int)$joinPartyDaysArr[0];
 | 
	
		
			
				|  |  | +            $todayStartTime = strtotime(date('Y-m-d'));//今天0点
 | 
	
		
			
				|  |  | +            $yesterdayStartTime = strtotime(date("Y-m-d",strtotime("-1 day")));//昨天开始时间戳
 | 
	
		
			
				|  |  | +            $todayEndTime = $todayStartTime+24 * 60 * 60-1;//今天结束时间戳
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //昨天登录过,+1
 | 
	
		
			
				|  |  | +            if ($yesterdayStartTime <= $oldTime &&  $oldTime < $todayStartTime){
 | 
	
		
			
				|  |  | +                $days = (int)$joinPartyDaysArr[1];
 | 
	
		
			
				|  |  | +                $days++;
 | 
	
		
			
				|  |  | +                $redis->hSet("joinParty_days", $user_id . "-" . $party_id, time().'-'. $days);
 | 
	
		
			
				|  |  | +            }elseif($todayStartTime <= $oldTime && $oldTime <= $todayEndTime){
 | 
	
		
			
				|  |  | +            //今天登录过 days
 | 
	
		
			
				|  |  | +            $days = (int)$joinPartyDaysArr[1];
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            $redis->hSet("joinParty_days", $user_id . "-" . $party_id, time().'-1');
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +                }else{
 | 
	
		
			
				|  |  | +            $redis->hSet("joinParty_days", $user_id . "-" . $party_id, time().'-1');
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return $days;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 加入派对
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -643,7 +678,7 @@ class Party extends Common
 | 
	
		
			
				|  |  |              $partyInfo = json_decode($partyInfo,true);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if($partyInfo["is_close"] == 1) $this->error("该房间已被关闭!");
 | 
	
		
			
				|  |  | -            if($partyInfo["status"] != 1) $this->error("该房间为预创建房间,请联系管理员正式开通!");
 | 
	
		
			
				|  |  | +            //if($partyInfo["status"] != 1) $this->error("该房间为预创建房间,请联系管理员正式开通!");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if(isset($partyInfo["party_pass"]) && $partyInfo["party_pass"] && $partyInfo["user_id"] != $user_id) {
 | 
	
		
			
				|  |  |                  if(($party_pass != $partyInfo["party_pass"] || strlen($party_pass) != 4) && $this->auth->id != 4) {
 | 
	
	
		
			
				|  | @@ -694,6 +729,8 @@ class Party extends Common
 | 
	
		
			
				|  |  |              $partyInfo["type_name"] = "普通房";
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          $partyInfo["party_hot"] = $this->changeW($partyInfo["party_hot"]);
 | 
	
		
			
				|  |  | +        $partyInfo['is_new'] = $partyInfo["status"] == 0 ? 1 : 0;
 | 
	
		
			
				|  |  | +        $partyInfo['join_days'] = $this->getUserJoinPartyDays($user_id,$party_id,$redis);
 | 
	
		
			
				|  |  |          $lsetList["partyInfo"] = $partyInfo;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return $this->success("加入成功!",$lsetList);
 | 
	
	
		
			
				|  | @@ -1087,6 +1124,13 @@ class Party extends Common
 | 
	
		
			
				|  |  |          $this->success("获取成功!",\app\common\model\PartyBackground::where(["room_type"=>$room_type])->select());
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    //腾讯im设置管理员
 | 
	
		
			
				|  |  | +    private function setGroupAdmin($user_id,$party_id,$status)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        $tenIm = new Tenim();
 | 
	
		
			
				|  |  | +        return $tenIm->setUpIMAdmin($user_id, $party_id,$status);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 派对管理设置
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -1451,6 +1495,15 @@ class Party extends Common
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     * 获取房间gif表情分类
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    public function getPartyGifType()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        $list = \app\common\model\PartyGifType::field("id,name,image")->order("weigh", "asc")->select();
 | 
	
		
			
				|  |  | +        $this->success("获取成功!", $list);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * 获取房间gif表情列表
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      public function getPartGifList() {
 | 
	
	
		
			
				|  | @@ -1493,22 +1546,6 @@ class Party extends Common
 | 
	
		
			
				|  |  |          return $giftInfo;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 单独赠送礼物,一键清空背包
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    public function giveAllbackGiftToYou(){
 | 
	
		
			
				|  |  | -        // 接口防并发
 | 
	
		
			
				|  |  | -        if (!$this->apiLimit(1, 1000)) {
 | 
	
		
			
				|  |  | -            $this->error(__('Operation frequently'));
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        $user_ids = $this->request->request("user_id");// 赠送对象
 | 
	
		
			
				|  |  | -        $party_id = $this->request->request("party_id",0);// 派对ID
 | 
	
		
			
				|  |  | -        $room_type = $this->request->request('room_type',1); // 房间类型
 | 
	
		
			
				|  |  | -        $is_back = 1; // 是否背包赠送: 1=是,0=否
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        if (!$user_ids || !in_array($room_type,[1,2])) $this->error(__('Invalid parameters'));
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 全麦/单独赠送礼物
 |