diff --git a/webapp/controller/TempToolsController.class.php b/webapp/controller/TempToolsController.class.php index d0c50d09..87cbf733 100644 --- a/webapp/controller/TempToolsController.class.php +++ b/webapp/controller/TempToolsController.class.php @@ -578,4 +578,68 @@ EOD; )); } + public function reward() + { + $gameDbConn = myself()->_getMysql(''); + $rows = SqlHelper::ormSelect( + $gameDbConn, + 't_test_punish070901', + array( + ) + ); + foreach ($rows as $row) { + if ($row['user_exists'] && $row['gold'] > 0 && $row['pre_send'] == 0) { + $itemNum = $row['gold']; + $srcGold = $this->getUserGold($gameDbConn, $row['account_id']); + echo $row['account_id'], $srcGold,1; + SqlHelper::update( + $gameDbConn, + 't_test_punish070901', + array( + 'account_id' => $row['account_id'], + ), + array( + 'pre_send' => 1, + 'src_gold' => $srcGold, + ) + ); + SqlHelper::update( + $gameDbConn, + 't_user', + array( + 'account_id' => $row['account_id'], + ), + array( + 'gold' => function () use($itemNum) { + return "gold - ${itemNum}"; + }, + ) + ); + SqlHelper::update( + $gameDbConn, + 't_test_punish070901', + array( + 'account_id' => $row['account_id'], + ), + array( + 'post_send' => 1 + ) + ); + } + } + echo 'ok'; + } + + private function getUserGold($gameDbConn, $accountId) + { + $row = SqlHelper::ormSelectOne( + $gameDbConn, + 't_user', + array( + 'account_id' => $accountId, + ) + ); + return empty($row) ? 0 : $row['gold']; + } + }