From 090de92d953813871e9215677d72a4a84525875a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 5 Jul 2024 22:16:53 +0800 Subject: [PATCH] 1 --- .../controller/TempToolsController.class.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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"; + } + } + }