我有一个邀请应用程序,我想当当前用户接受成员时,数组“waiting_guest”已被删除。
但问题是当前用户接受(或拒绝)成员时,该成员保持两个数组:“waiting_guest”和“confirmed_guest”(或“rejected_guest”)。
这是一个问题,因为在前视图中,“接受或拒绝”的卡在同一时间停留在“您已接受会员,联系他”(或当前用户拒绝会员时没有任何内容)
当前用户选择“接受”或“拒绝”时,如何删除此“waiting_guest”?
Html:
<div class="card" style="height: 100%">
<div style="border-bottom:none !important; background-image: url({{ guest.picture }});background-repeat:no-repeat;background-position:50%; background-size:cover; text-align:center;position : absolute;height: 50%;-webkit-filter: blur(5px);width:100%;">
</div>
<h2 class="text stable" style="position:relative; font-size:36px !important"> {{ guest.name }} </h2>
<img class="imgProfilEventGuest" ng-src="{{ guest.picture }}">
<div class="row">
<div class="col">
<span ng-click="acceptGuest(guest)" class="fa-stack fa-lg" style="font-size: 30px;">
<i class="fa fa-circle fa-stack-2x" style="color:#6BFF72"></i>
<i class="fa fa-check fa-stack-1x fa-inverse"></i>
</span>
<br>
Accepter
</div>
<div class="col">
<span ng-click="refuseGuest(guest)" class="fa-stack fa-lg" style="font-size: 30px;">
<i class="fa fa-circle fa-stack-2x" style="color:#FF5252"></i>
<i class="fa fa-times fa-stack-1x fa-inverse"></i>
</span>
<br>
Refuser
</div>
</div>
</div>
JS:
$scope.acceptGuest = function(guest) {
confirmedGuestRef.child(eventID).child(guest.user_id).set({
user_id: guest.user_id,
name: guest.name,
picture: guest.picture,
email: guest.email,
phone: guest.phone
})
userRef.child(guest.user_id).child("confirmed_events").child(eventID).set({
adressid: $scope.event.addressid,
nameid: $scope.event.nameid,
user: $scope.event.user,
priceid: $scope.event.priceid,
nbguestid: $scope.event.nbguestid,
startdateid: $scope.event.startdateid,
starthourid: $scope.event.starthourid
})
waitingGuests.child(eventID).child(guest.user_id).remove()
userRef.child(guest.user_id).child("waiting_events").child(eventID).remove()
}
$scope.refuseGuest = function(guest) {
refusedGuestRef.child(eventID).child(guest.user_id).set({
user_id: guest.user_id,
name: guest.name,
picture: guest.picture,
email: guest.email,
phone: guest.phone
})
userRef.child(guest.user_id).child('refused_events').child(eventID).set({
adressid: $scope.event.addressid,
nameid: $scope.event.nameid,
user: $scope.event.user,
priceid: $scope.event.priceid,
nbguestid: $scope.event.nbguestid,
startdateid: $scope.event.startdateid,
starthourid: $scope.event.starthourid
})
waitingGuests.child(eventID).child(guest.user_id).remove()
userRef.child(guest.user_id).child("waiting_events").child(eventID).remove()
}
请保存我的一天(如果你愿意,我可以添加代码)!!
感谢所有人阅读和询问!