diff --git a/application/api/model/GiftNew.php b/application/api/model/GiftNew.php index 64040443..4cde5deb 100644 --- a/application/api/model/GiftNew.php +++ b/application/api/model/GiftNew.php @@ -127,11 +127,6 @@ class GiftNew extends Model if(!$gift_info){ return ['code' => 0, 'msg' => '礼物不存在','data' =>null]; } - if(empty($gift_remark_name)){ - $type = 0;//删除 - }else{ - $type = 1; - } $user_custom_gift = db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_id'=>$gift_id])->find(); if($user_custom_gift){ @@ -147,6 +142,14 @@ class GiftNew extends Model return ['code' => 0, 'msg' => '设置失败','data' =>null]; } } + + $user_custom_gift_count = db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_remark_name' => ['<>', '']])->count(); + + if($user_custom_gift_count == 0){ + $type = 0;//删除 + }else{ + $type = 1; + } $user_on_pit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $user_id])->value('pit_number'); if($user_on_pit){ $text['text'] = '设置自定义礼物';