game2001api/webapp/controller/TempController.class.php
wangwei01 3c4bc6852a 1
2019-09-02 10:42:08 +08:00

43 lines
1.2 KiB
PHP

<?php
require 'classes/Quest.php';
require 'classes/AddReward.php';
class TempController{
protected function getRedMysql()
{
$mysql_conf = getMysqlConfig(crc32(''));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => 'gamedb2001_' . 1
));
return $conn;
}
public function getRedSum()
{
$type = $_REQUEST['type'];
$red_conn = $this->getRedMysql();
$row = $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())
));
var_dump($row);
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'sum' => $row['red_sum']
));
}
}
?>