lizhen_gitee 1 éve
szülő
commit
c05f50bc9b

+ 38 - 0
application/api/controller/Party.php

@@ -1707,6 +1707,7 @@ class Party extends Common
 
                 $data["createtime"] = time();
                 $res5 = $giftuserpartyModel->allowField(true)->save($data);
+                //$this->bigGiftNotice($giftuserpartyModel);
 
                 // 添加赠送用户余额
                 if($getValue > 0){
@@ -1870,6 +1871,43 @@ class Party extends Common
         }
     }
 
+    //送礼完成之后,大礼物飘屏
+    private function bigGiftNotice($giftUserParty){
+        if ($giftUserParty->party_id > 0) {
+
+            $bigGiftNotice = config("site.bigGiftNotice");
+            $partyInfo = $giftUserParty->party;
+            $money = $giftUserParty->value;
+
+
+            if ($money >= $bigGiftNotice) {
+
+                $messageData = [
+                    'type'    => 'bigGiftNotice',
+                    'data' => [
+                        'party_info'  => [
+                            'party_id'   => $partyInfo['id'],
+                            'room_type'  => $partyInfo['room_type'],
+                            'party_name' => $partyInfo['party_name']
+                        ],
+                        'notice_info' => [
+                            'sender'         => $giftUserParty->user->nickname,
+                            'receiver'       => $giftUserParty->toUser->nickname,
+                            'gift_num'       => $giftUserParty['number'],
+                            'gift_name'      => $giftUserParty['gift_name'],
+                            'gift_image'     => $giftUserParty['gift_gif_image'],
+                            'value'          => $giftUserParty['value'],
+                        ]
+                    ]
+                ];
+
+
+
+
+            }
+        }
+    }
+
     //某房间内礼物列表
     public function getPartyGiftLog(){
         $party_id = input('party_id',0);

+ 2 - 1
application/common/model/GiftUserParty.php

@@ -16,6 +16,7 @@ class GiftUserParty extends Model
     // 定义时间戳字段名
     protected $createTime = 'createtime';
 
+    /*
     protected static function init()
     {
         GiftUserParty::afterInsert(function ($giftUserParty) {
@@ -36,7 +37,7 @@ class GiftUserParty extends Model
             }
         });
     }
-
+*/
     public function user()
     {
         return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);