From 273e7ce61166408df2c3d42f19a1b842899cdbc8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 31 May 2022 23:06:52 +0800 Subject: [PATCH 1/7] 1 --- webapp/controller/RankingController.class.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/webapp/controller/RankingController.class.php b/webapp/controller/RankingController.class.php index 5878590d..6f877bc2 100644 --- a/webapp/controller/RankingController.class.php +++ b/webapp/controller/RankingController.class.php @@ -101,7 +101,7 @@ class RankingController extends BaseAuthedController { ); $rankingList = array(); $meta = mt\RankActivity::get($type); - if ($meta && mt\RankActivity::isActivityPeriod($meta)) { + if ($meta) { $row = myself()->_getSelfMysql()->execQueryOne( 'SELECT COUNT(*) AS row_count FROM t_rank_activity ' . 'WHERE type=:type AND channel=:channel AND value>:value;', @@ -125,6 +125,22 @@ class RankingController extends BaseAuthedController { ) ); $ranked = 1; + foreach ($rows as $row) { + $user = User::find($row['account_id']); + if ($user) { + if ($user['account_id'] == $myRanked['user']['account_id']) { + $myRanked['ranked'] = $ranked; + $myRanked['value'] = $row['value']; + $myRanked['modifytime'] = $row['modifytime']; + } + array_push($rankingList, array( + 'ranked' => $ranked++, + 'user' => User::toSimple($user), + 'value' => $row['value'], + 'modifytime' => $row['modifytime'], + )); + } + } } } { From 1cf277742bc86ccc09cb19b4c768cbb631b03629 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 1 Jun 2022 09:54:09 +0800 Subject: [PATCH 2/7] 1 --- .../controller/TempToolsController.class.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 webapp/controller/TempToolsController.class.php diff --git a/webapp/controller/TempToolsController.class.php b/webapp/controller/TempToolsController.class.php new file mode 100644 index 00000000..064cab90 --- /dev/null +++ b/webapp/controller/TempToolsController.class.php @@ -0,0 +1,44 @@ +_getMysql($targetId); + $data = array(); + $survivalTime = 0; + { + $rows = SqlHelper::ormSelect( + $conn, + 't_battle_record', + array( + 'account_id' => $targetId + ) + ); + foreach ($rows as $row) { + $reqObj = json_decode($row['request'], true); + $reqObj['start_time'] = $reqObj['game_time'] - + $reqObj['alive_time']/1000; + $survivalTime += $reqObj['alive_time']/1000; + array_push($data, $reqObj); + } + } + usort($data, function ($a, $b) { + return $a['start_time'] < $b['start_time']; + }); + myself()->_rspData(array( + 'battle_times' => count($data), + 'survival_time' => $survivalTime, + 'data' => $data + )); + } + +} From ae9893d4f746c3a396d3de5f585f13af75f14bc7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 1 Jun 2022 10:25:24 +0800 Subject: [PATCH 3/7] 1 --- webapp/controller/TempToolsController.class.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/webapp/controller/TempToolsController.class.php b/webapp/controller/TempToolsController.class.php index 064cab90..24f64bbf 100644 --- a/webapp/controller/TempToolsController.class.php +++ b/webapp/controller/TempToolsController.class.php @@ -12,9 +12,11 @@ class TempToolsController extends BaseController { public function getBattleData() { $targetId = getReqVal('target_id', ''); + $time = getReqVal('time', ''); $conn = myself()->_getMysql($targetId); $data = array(); $survivalTime = 0; + $sameTimes = 0; { $rows = SqlHelper::ormSelect( $conn, @@ -32,10 +34,22 @@ class TempToolsController extends BaseController { } } usort($data, function ($a, $b) { - return $a['start_time'] < $b['start_time']; + return $a['start_time'] < $b['start_time'] ? -1 : 1; }); + { + for ($i = 0; $i < count($data); ++$i){ + if ($i + 1 >= count($data)) { + break; + } + if ($data[$i]['start_time'] + $time < $data[$i + 1]['start_time']) { + ++$i; + ++$sameTimes; + } + } + } myself()->_rspData(array( 'battle_times' => count($data), + 'same_times' => $sameTimes, 'survival_time' => $survivalTime, 'data' => $data )); From 85917b36875a5798b91f4334f58d779cd801ecf5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 1 Jun 2022 11:00:29 +0800 Subject: [PATCH 4/7] 1 --- webapp/controller/TempToolsController.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/webapp/controller/TempToolsController.class.php b/webapp/controller/TempToolsController.class.php index 24f64bbf..471d0a7f 100644 --- a/webapp/controller/TempToolsController.class.php +++ b/webapp/controller/TempToolsController.class.php @@ -17,6 +17,7 @@ class TempToolsController extends BaseController { $data = array(); $survivalTime = 0; $sameTimes = 0; + $sessionChgTimes = 0; { $rows = SqlHelper::ormSelect( $conn, @@ -36,6 +37,7 @@ class TempToolsController extends BaseController { usort($data, function ($a, $b) { return $a['start_time'] < $b['start_time'] ? -1 : 1; }); + $lastSessionId = ''; { for ($i = 0; $i < count($data); ++$i){ if ($i + 1 >= count($data)) { @@ -45,11 +47,20 @@ class TempToolsController extends BaseController { ++$i; ++$sameTimes; } + if ($lastSessionId) { + if ($lastSessionId != $data[$i]['session_id']) { + ++$sessionChgTimes; + $lastSessionId = $data[$i]['session_id']; + } + } else { + $lastSessionId = $data[$i]['session_id']; + } } } myself()->_rspData(array( 'battle_times' => count($data), 'same_times' => $sameTimes, + 'session_chg_times' => $sessionChgTimes, 'survival_time' => $survivalTime, 'data' => $data )); From aa3075703a95b7601ff4dffbd4d9331af049a0d4 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 1 Jun 2022 11:59:04 +0800 Subject: [PATCH 5/7] 1 --- .../controller/TempToolsController.class.php | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/webapp/controller/TempToolsController.class.php b/webapp/controller/TempToolsController.class.php index 471d0a7f..7c122f49 100644 --- a/webapp/controller/TempToolsController.class.php +++ b/webapp/controller/TempToolsController.class.php @@ -43,7 +43,7 @@ class TempToolsController extends BaseController { if ($i + 1 >= count($data)) { break; } - if ($data[$i]['start_time'] + $time < $data[$i + 1]['start_time']) { + if ($data[$i]['start_time'] + $time > $data[$i + 1]['start_time']) { ++$i; ++$sameTimes; } @@ -66,4 +66,64 @@ class TempToolsController extends BaseController { )); } + public function getRiskAccounts() + { + $accounts = array(); + $conn = myself()->_getMysql(''); + { + $count = 1000; + $rows = $conn->execQuery( + 'SELECT * FROM t_rank_activity ' . + 'WHERE type=:type AND channel=:channel AND value>=:value ' . + 'ORDER BY value DESC, modifytime ASC ' . + "LIMIT ${count}", + array( + ':type' => 1, + ':channel' => 6516, + ':value' => 600 + ) + ); + $ranked = 1; + foreach ($rows as $row) { + array_push($accounts, array( + 'account_id' => $row['account_id'], + 'ranked' => $ranked + )); + ++$ranked; + } + } + $riskAccountHash = array(); + foreach ($accounts as $account) { + $rows = SqlHelper::ormSelect( + $conn, + 't_battle_record', + array( + 'account_id' => $account['account_id'] + ) + ); + $sessionChgTimes = 0; + $lastSessionId = ''; + foreach ($rows as $row) { + $reqObj = json_decode($row['request'], true); + if ($lastSessionId) { + if ($lastSessionId != $reqObj['session_id']) { + ++$sessionChgTimes; + $lastSessionId = $reqObj['session_id']; + } + } else { + $lastSessionId = $reqObj['session_id']; + } + } + $account['session_changed_times'] = $sessionChgTimes; + array_push($riskAccountHash, $account); + } + usort($riskAccountHash, function ($a, $b) { + return $a['session_changed_times'] < $b['session_changed_times'] ? -1 : 1; + }); + echo 'account_id,rank,session_changed_times' . "\n"; + foreach ($riskAccountHash as $account) { + echo $account['account_id'] . ',' . $account['ranked'] . ',' . $account['session_changed_times'] . "\n"; + } + } + } From 0a05ab2e631b861e2532f430326590bbec1fa72f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 1 Jun 2022 14:13:27 +0800 Subject: [PATCH 6/7] 1 --- webapp/controller/TempToolsController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/TempToolsController.class.php b/webapp/controller/TempToolsController.class.php index 7c122f49..b593cc37 100644 --- a/webapp/controller/TempToolsController.class.php +++ b/webapp/controller/TempToolsController.class.php @@ -118,7 +118,7 @@ class TempToolsController extends BaseController { array_push($riskAccountHash, $account); } usort($riskAccountHash, function ($a, $b) { - return $a['session_changed_times'] < $b['session_changed_times'] ? -1 : 1; + return $a['session_changed_times'] > $b['session_changed_times'] ? -1 : 1; }); echo 'account_id,rank,session_changed_times' . "\n"; foreach ($riskAccountHash as $account) { From c12a6126a46cb504296413d2bbde5364462357ff Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 2 Jun 2022 08:35:02 +0800 Subject: [PATCH 7/7] 1 --- webapp/models/Gun.php | 2 +- webapp/models/Hero.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/models/Gun.php b/webapp/models/Gun.php index 629e6f2a..b0a3d934 100644 --- a/webapp/models/Gun.php +++ b/webapp/models/Gun.php @@ -135,7 +135,7 @@ class Gun extends BaseModel { } $todayGetGold = $row['today_get_gold']; $lastGetGoldTime = $row['last_get_gold_time']; - if (myself()->_getDaySeconds($lastGetGoldTime) > myself()->_getNowDaySeconds()) { + if (myself()->_getDaySeconds($lastGetGoldTime) < myself()->_getNowDaySeconds()) { $todayGetGold = 0; } $dto = array( diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index e81acdd7..4302d2f4 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -123,7 +123,7 @@ class Hero extends BaseModel { } $todayGetGold = $row['today_get_gold']; $lastGetGoldTime = $row['last_get_gold_time']; - if (myself()->_getDaySeconds($lastGetGoldTime) > myself()->_getNowDaySeconds()) { + if (myself()->_getDaySeconds($lastGetGoldTime) < myself()->_getNowDaySeconds()) { $todayGetGold = 0; } $dto = array(