<?php header("Content-type: application/json"); $request = json_decode($GLOBALS['HTTP_RAW_POST_DATA'], true); //引用用户功能 require_once "../event/game.php"; // 初始化 $game = new game(); $key = $request['key']; if (isset($request['_'])) { $key = $request['_']; } if ($key == 'get_select') { $info = $game->selectStatus(); $start = $info['start_time']; $end = $info['end_time']; $time = $end - $start; $value = array('status' => $info['status'], 'time' => $info['end_time'], 'interval' => $end - time(), 'go' => array(), 'res' => array()); for ($i = 0; $i <= 9; $i++) { $value['res'][$i] = $game->selectTotal($i, $time); } $total = $game->selectTotal($info['selected'], $time); $number = 0; if ($total) { $number = ceil($game->getTotal($time) / $total); } $value['go'] = array('selected' => $info['selected'], 'right' => $game->selectTotal($info['selected'], $time, $request['uid']), 'income' => $number); echo json_encode($value); } // 添加选择 if ($key == 'set_user_select') {