|
@@ -121,6 +121,7 @@ class Grabgift extends Api
|
|
$winer_nickname = '';
|
|
$winer_nickname = '';
|
|
$new_seatnum = $seat_number;//因为开奖之后,要用新一期的座位数
|
|
$new_seatnum = $seat_number;//因为开奖之后,要用新一期的座位数
|
|
|
|
|
|
|
|
+ //座位满了,开奖
|
|
if($count == $seat_number){
|
|
if($count == $seat_number){
|
|
|
|
|
|
$rand_data_new = [];
|
|
$rand_data_new = [];
|
|
@@ -190,6 +191,7 @@ class Grabgift extends Api
|
|
}
|
|
}
|
|
Db::commit();
|
|
Db::commit();
|
|
|
|
|
|
|
|
+ //推送内容
|
|
$user_list = Db::name('grabgift_log')->alias('log')->field('log.myseatnum,user.nickname,user.id as user_id,user.avatar')
|
|
$user_list = Db::name('grabgift_log')->alias('log')->field('log.myseatnum,user.nickname,user.id as user_id,user.avatar')
|
|
->join('user','log.user_id = user.id','LEFT')
|
|
->join('user','log.user_id = user.id','LEFT')
|
|
->where('log.grab_id',$grab_id)->order('log.myseatnum asc')->select();
|
|
->where('log.grab_id',$grab_id)->order('log.myseatnum asc')->select();
|
|
@@ -209,8 +211,18 @@ class Grabgift extends Api
|
|
'user_list' => $user_list
|
|
'user_list' => $user_list
|
|
];
|
|
];
|
|
|
|
|
|
- //socket推送
|
|
|
|
- $this->grabgift_notice($result);
|
|
|
|
|
|
+ //坐上座位socket推送
|
|
|
|
+ $this->grabgift_notice('grabgift',$result);
|
|
|
|
+
|
|
|
|
+ //开奖倒计时socket推送
|
|
|
|
+ if($count == $seat_number){
|
|
|
|
+
|
|
|
|
+ $data = [
|
|
|
|
+ 'grab_id' => $grab_id,
|
|
|
|
+ 'nowtime' => time(),
|
|
|
|
+ ];
|
|
|
|
+ $this->grabgift_notice('daojishi',$data);
|
|
|
|
+ }
|
|
|
|
|
|
$this->success(1,$result);
|
|
$this->success(1,$result);
|
|
}
|
|
}
|
|
@@ -224,29 +236,21 @@ class Grabgift extends Api
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- //送礼完成之后,大礼物飘屏
|
|
|
|
- private function grabgift_notice($result){
|
|
|
|
|
|
+ //socket,通知所有人
|
|
|
|
+ private function grabgift_notice($type,$result){
|
|
$notice = new GatewayworkerTools();
|
|
$notice = new GatewayworkerTools();
|
|
- $notice->sendGrabgift($result);
|
|
|
|
|
|
+ $notice->sendGrabgift($type,$result);
|
|
}
|
|
}
|
|
|
|
|
|
public function test(){
|
|
public function test(){
|
|
- $result = [
|
|
|
|
- 'grab_id' => 1,
|
|
|
|
- 'count' => 4,
|
|
|
|
- 'is_finish' => 0,
|
|
|
|
- 'seat_number' => 5,
|
|
|
|
- 'nickname' => '加入者昵称',
|
|
|
|
- 'user_id' => 1,
|
|
|
|
- 'avatar' => '/1.jpg',
|
|
|
|
- 'gift_name' => '礼物名',
|
|
|
|
- 'winer_nickname' => '中奖者昵称',
|
|
|
|
|
|
+ $data = [
|
|
|
|
+ 'grab_id' => 1,
|
|
|
|
+ 'nowtime' => time(),
|
|
];
|
|
];
|
|
- $this->grabgift_notice($result);
|
|
|
|
|
|
+ $this->grabgift_notice('daojishi',$data);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
}
|
|
}
|