diff --git a/webapp/controller/TempToolsController.class.php b/webapp/controller/TempToolsController.class.php index d0a51f01..12b60f87 100644 --- a/webapp/controller/TempToolsController.class.php +++ b/webapp/controller/TempToolsController.class.php @@ -348,4 +348,34 @@ class TempToolsController extends BaseController { } } + public function exportLock() + { + $type = getReqVal('type', '0'); + $mysql_conf = getMysqlConfig(crc32('')); + if (SERVER_ENV == _ONLINE) { + $mysql_conf['database'] = 'bcevent_prod_1'; + } else { + $mysql_conf['database'] = 'bcevent_dev'; + } + $conn = new phpcommon\Mysql(array( + 'host' => $mysql_conf['host'], + 'port' => $mysql_conf['port'], + 'user' => $mysql_conf['user'], + 'passwd' => $mysql_conf['passwd'], + 'dbname' => $mysql_conf['database'], + )); + if ($type == 0) { + $sql = 'select lock_to, count(idx) as lock_count from t_nft_lock_event group by lock_to;'; + } else { + $nowDayseconds = myself()->_getNowDaySeconds(); + $beginTime = $nowDayseconds; + $endTime = $nowDayseconds + 3600 *24; + $sql = "select lock_to, count(idx) as lock_count from t_nft_lock_event where createtime>=$beginTime and createtime<=$endTime group by lock_to;"; + } + $rows = $conn->execQuery($sql); + foreach ($rows as $row) { + echo $row['lock_to'] . ',' . $row['lock_count'] . "\n"; + } + } + }