$mysql_conf['host'], 'port' => $mysql_conf['port'], 'user' => $mysql_conf['user'], 'passwd' => $mysql_conf['passwd'], 'dbname' => 'gamedb2004_' . 1 )); return $conn; } public function getRedSum() { $type = $_REQUEST['type']; $red_conn = $this->getRedMysql(); $rows = $red_conn->execQueryOne('SELECT * FROM redpack ' . ' WHERE red_type=:red_type AND red_date=:red_date;', array( ':red_type' => $type, ':red_date' => phpcommon\getdayseconds(time()) )); error_log(json_encode($rows)); if ($rows['red_sum'] + 0.3 > 100) { phpcommon\sendError(ERR_USER_BASE + 3, '今日红包已领完'); return; } echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'sum' => $rows['red_sum'] )); } } ?>