Browse Source

调通接口

lizhen_gitee 3 years ago
parent
commit
612c684e67

+ 14 - 50
application/api/controller/Party.php

@@ -214,12 +214,12 @@ class Party extends Common
      */
     public function savePartyStatus() {
         $party_id = $this->request->request('party_id'); // 派对ID
-        $room_type = $this->request->request('room_type',1); // 房间类型:1=派对,2=直播
+        $room_type = 1; // 房间类型:1=派对,2=直播
         if (!$party_id || !in_array($room_type,[1,2])) $this->error(__('Invalid parameters'));
         $user_id = $this->auth->id;
         $partyInfo = \app\common\model\Party::get($party_id);
         if($partyInfo->status < 0) $this->error("当前状态不支持变更!");
-        if($partyInfo->user_id !== $user_id) $this->error("当前账号异常,非工会长禁止操作!");
+        if($partyInfo->user_id !== $user_id) $this->error("当前账号异常,非房主禁止操作!");
         $partyInfo->status = 1;
         $res = $partyInfo->save();
 
@@ -237,7 +237,7 @@ class Party extends Common
                 $redPartyInfo["status"] = 1;
                 $redis->set($this->roomTypeArr[$room_type]."_".$partyInfo["id"],json_encode($redPartyInfo));
             }
-            $this->success("更新公会状态成功!");
+            $this->success("更新房间状态成功!");
         } else {
             $this->error("网络错误,请稍后重试!");
         }
@@ -411,7 +411,7 @@ class Party extends Common
         $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
         $user_id = $this->request->request('user_id',0,"intval"); // 用户ID
         $upOrdown = $this->request->request('upordown'); // 上下麦:1=上麦-1=下麦
-        $room_type = $this->request->request('room_type',1); // 房间类型
+        $room_type = 1; // 房间类型
         $avatar   = $this->request->request('avatar'); // 用户头像 (upOrdown参数为-1时可以不传)
         $position   = $this->request->request('position'); // 麦位置:0=支持人,1=1号麦,2=2号麦,3=3号麦,4=4号麦
         if (!$party_id || !$user_id || !in_array($position,[0,1,2,3,4,5,6,7,8]) || !in_array($upOrdown,[1,-1])) {
@@ -1267,8 +1267,8 @@ class Party extends Common
      */
     public function getPatyIspass() {
         $party_id = $this->request->request("party_id");// 派对ID
-        $room_type = $this->request->request("room_type",1);//
-        $is_miniprogram = $this->request->request("is_miniprogram",0);//
+        $room_type = 1;
+        $is_miniprogram = 0;//
         if (!$party_id) $this->error(__('Invalid parameters'));
 
         $user_id = $this->auth->id;
@@ -1290,43 +1290,7 @@ class Party extends Common
         $data = [];
         $data["status"] = 0;
         $data["is_pass"] = $partyInfo["party_pass"]?1:0;
-        if($partyInfo["user_id"] == $user_id || $this->auth->mobile == '17353993050') $data["is_pass"] = 0;
-
-        if($is_miniprogram == 1) { // 小程序单独处理
-            // 判断当前用户是否被该房间设置限制 //项目:1=房管,2=禁言,3=拉黑,4=踢出
-            $lsetList = [];
-            for($i=1;$i<=4;$i++) {
-                $hgetlist = $redis->hGet("party_manage_".$party_id,$user_id."-".$i);
-
-                $hgetlist = unserialize($hgetlist);
-                $restime = time() - intval($hgetlist["createtime"]);
-
-                // 房管
-                if($hgetlist && $i == 1) $lsetList["manage_restime"] = "";
-                // 禁言
-                if($hgetlist && $i == 2 && $restime < $hgetlist["time"]) $lsetList["manage_notalk"] = $restime;
-                // 拉黑
-                if($hgetlist && $i == 3 && $restime < $hgetlist["time"]) {
-                    $restime = date("Y-m-d H:i:s",($hgetlist["time"]+$hgetlist["createtime"]));
-                    $lsetList["manage_black"] = $restime;
-                    $lsetList["tips"] = '您已被该房间拉黑,解除时间:'.$restime;
-//                    $this->error(__('您已被该房间拉黑,解除时间:'.$restime));
-                    break;
-                }
-                // 踢出
-                if($hgetlist && $i == 4 && $restime < $hgetlist["time"]) {
-                    $restime = date("Y-m-d H:i:s",($hgetlist["time"]+$hgetlist["createtime"]));
-                    $lsetList["manage_takeout"] = $restime;
-                    $lsetList["tips"] = '您已被该房间踢出,解除时间:'.$restime;
-//                    $this->error(__('您已被该房间踢出,解除时间:'.$restime));
-                    break;
-                }
-            }
-            if($lsetList) {
-                $data["status"] = 1;
-                $data["hgetlist"] = $lsetList;
-            }
-        }
+        if($partyInfo["user_id"] == $user_id || $this->auth->mobile == '18560505277') $data["is_pass"] = 0;
 
         $this->success("获取成功!",$data);
     }
@@ -1345,8 +1309,8 @@ class Party extends Common
      */
     public function getPartGifList()
     {
-        $type_id = $this->request->request("type_id", 1);// 类型ID
-        $list = \app\common\model\PartyGif::field("id,gif_image")->where('party_gif_type_id', $type_id)->order("weight", "asc")->select();
+//        $type_id = $this->request->request("type_id", 1);// 类型ID
+        $list = \app\common\model\PartyGif::field("id,gif_image")->order("weight", "asc")->select();
         $this->success("获取成功!", $list);
     }
 
@@ -1360,7 +1324,7 @@ class Party extends Common
     /**
      * 随机获取礼物盒礼物
      */
-    private function getBoxGift($gift_box_type) {
+    /*private function getBoxGift($gift_box_type) {
         // 查询本奖池内礼物是否还有可抽礼物
         $where = [];
         $where["Jackpot_id"] = $gift_box_type;
@@ -1384,7 +1348,7 @@ class Party extends Common
         $giftInfo = $giftArr[$giftids];
 
         return $giftInfo;
-    }
+    }*/
 
 
     /**
@@ -1398,7 +1362,7 @@ class Party extends Common
         $user_ids = $this->request->request("user_id");// 赠送对象
         $gift_id = $this->request->request("gift_id");// 礼物ID
         $party_id = $this->request->request("party_id",0);// 派对ID
-        $room_type = $this->request->request('room_type',1); // 房间类型
+        $room_type = 1; // 房间类型
         $number = $this->request->request("number");// 赠送数量
         $is_back = $this->request->request("is_back",0);// 是否背包赠送: 1=是,0=否
         if (!$user_ids || !in_array($is_back,[0,1]) || !$gift_id || !$number || !in_array($room_type,[1,2])) $this->error(__('Invalid parameters'));
@@ -1446,10 +1410,10 @@ class Party extends Common
             $giftCountValue = $giftInfo["value"] * $number * $userCount;
             $getValue = $giftValue;
             // 判断如果是礼物盒则随机开礼物盒礼物
-            if($giftInfo->box_type > 0) {
+            /*if($giftInfo->box_type > 0) {
                 $boxgiftInfo = $this->getBoxGift($giftInfo->box_type);
                 $getValue = $boxgiftInfo["price"];
-            }
+            }*/
 
             // 判断当前用户余额
             $where = [];

+ 3 - 3
application/api/controller/Tenim.php

@@ -125,7 +125,7 @@ exit;
         print_r($groupInfo);exit;
     }
 
-    public function substr(string $string, int $start, int $length = null): string
+    public function substr(string $string, int $start, int $length = null)
     {
         return mb_substr($string, $start, $length, 'UTF-8');
     }
@@ -419,7 +419,7 @@ exit;
 
         // 更新用户在线状态为离线
         \app\common\model\User::update(["is_online"=>0],["id"=>$user_id]);
-        \app\common\model\User::update(["is_live"=>0],["id"=>$user_id]);
+//        \app\common\model\User::update(["is_live"=>0],["id"=>$user_id]);
         \app\common\model\Party::update(["is_online"=>0],["user_id"=>$user_id]);
 
         // 获取用户所在群信息
@@ -437,7 +437,7 @@ exit;
                 // 踢出用户在线组
                 $redis = new Redis();
                 $redisconfig = config("redis");
-                $redis->connect($redisconfig["host"], $redisconfig["port"]);
+                $redis->connect($redisconfig["host"], $redisconfig["port"]);$redis->auth(123456);
                 $redis->HDel("online_".$v["GroupId"],$user_id);
             }
             // 强制下麦

+ 16 - 1
application/api/controller/Usercenter.php

@@ -5,6 +5,8 @@ namespace app\api\controller;
 use app\common\controller\Api;
 use think\Db;
 use app\common\model\wallet;
+use Redis;
+
 /**
  * 会员中心,不是个人中心
  */
@@ -624,7 +626,20 @@ class Usercenter extends Api
         }*/
     }
 
-
+    /**
+     * 获取当前用户信息
+     */
+    public function getMyUserInfo() {
+        $userInfo = $this->auth->getUserinfo();
+        //当月消费金额
+        $redis = new Redis();
+        $redisconfig = config("redis");
+        $redis->connect($redisconfig["host"], $redisconfig["port"]);$redis->auth(123456);
+        $user_renew2 = $redis->get('user_renew2_'.$this->auth->id);
+        $userInfo['user_renew2'] = empty($user_renew2)?0:intval($user_renew2);
+
+        $this->success("获取成功!",$userInfo);
+    }
 
 
     /**

+ 2 - 0
application/common/model/UserOnsiteTime.php

@@ -12,4 +12,6 @@ class UserOnsiteTime extends Model
 
     // 开启自动写入时间戳字段
     protected $autoWriteTimestamp = 'int';
+    // 定义时间戳字段名
+    protected $updateTime = 'updatetime';
 }