mRoomType = 'shake_bonus'; parent::__construct($cinfos, $participants); } public function shakeOp($input) { $this->clear(); $user = $input['user']; $userinfo = $this->find($user); if($userinfo == false) { return false; } if(!isset($input['amount'])) return false; if($input['amount'] > 0) { $amount = intval($input['amount'] * 100 + 0.5); } else { $amount = intval($input['amount'] * 100 - 0.5); } if($amount === 0) return false; Log::record("amount = {$amount}",Log::DEBUG); $type = proto_type::msg_type_shakebonus; $content = $amount / 100; $msgid = $this->record_message($userinfo['userid'],$type,$content); if($msgid > 0) { $this->relay_broadcast('shake',['msgid' => $msgid, 'from' => $userinfo,'content' => "{$content}",'send_time' => time(),'seq' => $input['seq']]); return ['act' => 'room','op' => 'shake','room' => $this->room_id()]; } else { return false; } } }