Browse Source

房间密码可以设置为空

lizhen_gitee 1 year ago
parent
commit
5735c09804
1 changed files with 9 additions and 3 deletions
  1. 9 3
      application/api/controller/Party.php

+ 9 - 3
application/api/controller/Party.php

@@ -1157,7 +1157,8 @@ class Party extends Api
      */
     public function setParty() {
         $party_id = input('party_id',0,"intval"); // 直播间ID
-        $room_type = input('room_type',1); // 房间类型:1=派对,2=直播
+        $room_type = input('room_type',1); // 房间类型:1=工会,2=个人k歌
+      
         if (!$party_id || !$room_type) {
             $this->error(__('Invalid parameters'));
         }
@@ -1187,8 +1188,13 @@ class Party extends Api
             $data[$field] = $newone;
         }
 
-        if(isset($data['party_pass']) && strlen($data['party_pass']) != 4) {
-            $this->error("房间密码必须为四位!");
+        if(isset($data['party_pass'])){
+            if(empty($data['party_pass'])){
+                $data['party_pass'] = '';
+            }
+            if(!empty($data['party_pass']) && strlen($data['party_pass']) != 4) {
+                $this->error("房间密码必须为四位!");
+            }
         }
 
         $partyModel = new \app\common\model\Party();