Merge pull request #498 from TheSerapher/manual-payout-cron
Adding manual payout cron
This commit is contained in:
commit
35d1f5fa92
91
cronjobs/manual_payout.php
Executable file
91
cronjobs/manual_payout.php
Executable file
@ -0,0 +1,91 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
|
||||
Copyright:: 2013, Sebastian Grewe
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
// Include all settings and classes
|
||||
require_once('shared.inc.php');
|
||||
|
||||
if ($setting->getValue('disable_mp') == 1) {
|
||||
$log->logInfo(" auto payout disabled via admin panel");
|
||||
$monitoring->setStatus($cron_name . "_active", "yesno", 0);
|
||||
$monitoring->setStatus($cron_name . "_message", "message", "Auto-Payout disabled");
|
||||
$monitoring->setStatus($cron_name . "_status", "okerror", 1);
|
||||
$monitoring->setStatus($cron_name . "_endtime", "date", time());
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($bitcoin->can_connect() !== true) {
|
||||
$log->logFatal(" unable to connect to RPC server, exiting");
|
||||
$monitoring->setStatus($cron_name . "_active", "yesno", 0);
|
||||
$monitoring->setStatus($cron_name . "_message", "message", "Unable to connect to RPC server");
|
||||
$monitoring->setStatus($cron_name . "_status", "okerror", 1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// var_dump($oPayout->createPayout(1.12, 1));
|
||||
$aPayouts = $oPayout->getUnprocessedPayouts();
|
||||
|
||||
if (count($aPayouts) > 0) {
|
||||
$log->logInfo("\tAccount ID\tUsername\tBalance\t\tCoin Address");
|
||||
foreach ($aPayouts as $aData) {
|
||||
$aBalance = $transaction->getBalance($aData['account_id']);
|
||||
$dBalance = $aBalance['confirmed'];
|
||||
$aData['coin_address'] = $user->getCoinAddress($aData['account_id']);
|
||||
$aData['username'] = $user->getUserName($aData['account_id']);
|
||||
if ($dBalance > $config['txfee']) {
|
||||
$log->logInfo("\t" . $aData['account_id'] . "\t\t" . $aData['username'] . "\t" . $dBalance . "\t\t" . $aData['coin_address']);
|
||||
try {
|
||||
$bitcoin->validateaddress($aData['coin_address']);
|
||||
} catch (BitcoinClientException $e) {
|
||||
$log->logError('Failed to verify this users coin address, skipping payout');
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
$bitcoin->sendtoaddress($aData['coin_address'], $dBalance);
|
||||
} catch (BitcoinClientException $e) {
|
||||
$log->logError('Failed to send requested balance to coin address, please check payout process');
|
||||
continue;
|
||||
}
|
||||
// To ensure we don't run this transaction again, lets mark it completed
|
||||
if (!$oPayout->setProcessed($aData['id'])) {
|
||||
$log->logFatal('unable to mark transactions ' . $aData['id'] . ' as processed.');
|
||||
$monitoring->setStatus($cron_name . "_active", "yesno", 0);
|
||||
$monitoring->setStatus($cron_name . "_message", "message", "Unable set payout as processed");
|
||||
$monitoring->setStatus($cron_name . "_status", "okerror", 1);
|
||||
exit(1);
|
||||
}
|
||||
if ($transaction->addTransaction($aData['account_id'], $dBalance - $config['txfee'], 'Debit_MP', NULL, $aData['coin_address']) && $transaction->addTransaction($aData['account_id'], $config['txfee'], 'TXFee', NULL, $aData['coin_address'])) {
|
||||
// Notify user via mail
|
||||
$aMailData['email'] = $user->getUserEmail($user->getUserName($aData['account_id']));
|
||||
$aMailData['subject'] = 'Manual Payout Completed';
|
||||
$aMailData['amount'] = $dBalance;
|
||||
$aMailData['payout_id'] = $aData['id'];
|
||||
if (!$notification->sendNotification($aData['account_id'], 'manual_payout', $aMailData))
|
||||
$log->logError('Failed to send notification email to users address: ' . $aMailData['email']);
|
||||
} else {
|
||||
$log->logError('Failed to add new Debit_MP transaction in database for user ' . $user->getUserName($aData['account_id']));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
@ -13,7 +13,7 @@ PHP_BIN=$( which php )
|
||||
PIDFILE='/tmp/mmcfe-ng-cron.pid'
|
||||
|
||||
# List of cruns to execute
|
||||
CRONS="findblock.php proportional_payout.php pplns_payout.php pps_payout.php blockupdate.php auto_payout.php tickerupdate.php notifications.php statistics.php archive_cleanup.php"
|
||||
CRONS="findblock.php proportional_payout.php pplns_payout.php pps_payout.php blockupdate.php manual_payout.php auto_payout.php tickerupdate.php notifications.php statistics.php archive_cleanup.php"
|
||||
|
||||
# Output additional runtime information
|
||||
VERBOSE="0"
|
||||
|
||||
@ -26,6 +26,7 @@ require_once(CLASS_DIR . '/api.class.php');
|
||||
require_once(CLASS_DIR . '/mail.class.php');
|
||||
require_once(CLASS_DIR . '/tokentype.class.php');
|
||||
require_once(CLASS_DIR . '/token.class.php');
|
||||
require_once(CLASS_DIR . '/payout.class.php');
|
||||
require_once(CLASS_DIR . '/block.class.php');
|
||||
require_once(CLASS_DIR . '/setting.class.php');
|
||||
require_once(CLASS_DIR . '/monitoring.class.php');
|
||||
|
||||
@ -178,12 +178,12 @@ class Notification extends Mail {
|
||||
$stmt = $this->mysqli->prepare("SELECT account_id FROM $this->tableSettings WHERE type = ? AND active = 1 AND account_id = ?");
|
||||
if ($stmt && $stmt->bind_param('si', $strType, $account_id) && $stmt->execute() && $stmt->bind_result($id) && $stmt->fetch()) {
|
||||
if ($stmt->close() && $this->sendMail('notifications/' . $strType, $aMailData) && $this->addNotification($account_id, $strType, $aMailData)) {
|
||||
$this->setErrorMessage('Error sending mail notification');
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
$this->setErrorMessage('User disabled ' . $strType . ' notifications');
|
||||
}
|
||||
$this->setErrorMessage('Error sending mail notification');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
65
public/include/classes/payout.class.php
Normal file
65
public/include/classes/payout.class.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
// Make sure we are called from index.php
|
||||
if (!defined('SECURITY')) die('Hacking attempt');
|
||||
|
||||
class Payout Extends Base {
|
||||
var $table = 'payouts';
|
||||
|
||||
/**
|
||||
* Check if the user has an active payout request already
|
||||
* @param account_id int Account ID
|
||||
* @return boolean bool True of False
|
||||
**/
|
||||
public function isPayoutActive($account_id) {
|
||||
$stmt = $this->mysqli->prepare("SELECT id FROM $this->table WHERE completed = 0 AND account_id = ? LIMIT 1");
|
||||
if ($stmt && $stmt->bind_param('i', $account_id) && $stmt->execute( )&& $stmt->store_result() && $stmt->num_rows > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all new, unprocessed payout requests
|
||||
* @param none
|
||||
* @return data Associative array with DB Fields
|
||||
**/
|
||||
public function getUnprocessedPayouts() {
|
||||
$stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE completed = 0");
|
||||
if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
|
||||
return $result->fetch_all(MYSQLI_ASSOC);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new payout request
|
||||
* @param account_id Account ID
|
||||
* @return data mixed Inserted ID or false
|
||||
**/
|
||||
public function createPayout($account_id=NULL) {
|
||||
$stmt = $this->mysqli->prepare("
|
||||
INSERT INTO $this->table (account_id)
|
||||
VALUES (?)
|
||||
");
|
||||
if ($stmt && $stmt->bind_param('i', $account_id) && $stmt->execute())
|
||||
return $stmt->insert_id;
|
||||
$this->setErrorMessage('Unable to create new payout request');
|
||||
$this->debug->append('Failed to create new payout request in database: ' . $this->mysqli->error);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a payout as processed
|
||||
* @param id int Payout ID
|
||||
* @return boolean bool True or False
|
||||
**/
|
||||
public function setProcessed($id) {
|
||||
$stmt = $this->mysqli->prepare("UPDATE $this->table SET completed = 1 WHERE id = ?");
|
||||
if ($stmt && $stmt->bind_param('i', $id) && $stmt->execute())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$oPayout = new Payout();
|
||||
$oPayout->setDebug($debug);
|
||||
$oPayout->setMysql($mysqli);
|
||||
@ -10,55 +10,24 @@ if ($user->isAuthenticated()) {
|
||||
} else {
|
||||
switch (@$_POST['do']) {
|
||||
case 'cashOut':
|
||||
if ($setting->getValue('manual_payout_active') == 1) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'A manual payout is in progress. Please try again later.', 'TYPE' => 'errormsg');
|
||||
} else if ($setting->getValue('disable_mp') == 1) {
|
||||
if ($setting->getValue('disable_mp') == 1) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Manual payouts are disabled.', 'TYPE' => 'info');
|
||||
} else {
|
||||
$setting->setValue('manual_payout_active', 1);
|
||||
$continue = true;
|
||||
$aBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
|
||||
$dBalance = $aBalance['confirmed'];
|
||||
$sCoinAddress = $user->getCoinAddress($_SESSION['USERDATA']['id']);
|
||||
// Ensure we can cover the potential transaction fee
|
||||
if ($dBalance > $config['txfee']) {
|
||||
if ($bitcoin->can_connect() === true) {
|
||||
try {
|
||||
$bitcoin->validateaddress($sCoinAddress);
|
||||
} catch (BitcoinClientException $e) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Invalid payment address: ' . $sUserSendAddress, 'TYPE' => 'errormsg');
|
||||
$continue = false;
|
||||
}
|
||||
if ($continue == true) {
|
||||
// Send balance to address, mind fee for transaction!
|
||||
try {
|
||||
$auto_payout = $monitoring->getStatus('auto_payout_active');
|
||||
if ($auto_payout['value'] == 0) {
|
||||
$bitcoin->sendtoaddress($sCoinAddress, $dBalance);
|
||||
} else {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Auto-payout active, please contact site support immidiately to revoke invalid transactions.', 'TYPE' => 'errormsg');
|
||||
$continue = false;
|
||||
}
|
||||
} catch (BitcoinClientException $e) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to send ' . $config['currency'] . ', please contact site support immidiately', 'TYPE' => 'errormsg');
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
// Set balance to 0, add to paid out, insert to ledger
|
||||
if ($continue == true && $transaction->addTransaction($_SESSION['USERDATA']['id'], $dBalance - $config['txfee'], 'Debit_MP', NULL, $sCoinAddress) && $transaction->addTransaction($_SESSION['USERDATA']['id'], $config['txfee'], 'TXFee', NULL, $sCoinAddress) ) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Transaction completed', 'TYPE' => 'success');
|
||||
$aMailData['email'] = $user->getUserEmail($user->getUserName($_SESSION['USERDATA']['id']));
|
||||
$aMailData['amount'] = $dBalance;
|
||||
$aMailData['subject'] = 'Manual Payout Completed';
|
||||
$notification->sendNotification($_SESSION['USERDATA']['id'], 'manual_payout', $aMailData);
|
||||
if (!$oPayout->isPayoutActive($_SESSION['USERDATA']['id'])) {
|
||||
if ($iPayoutId = $oPayout->createPayout($_SESSION['USERDATA']['id'])) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Created new manual payout request with ID #' . $iPayoutId);
|
||||
} else {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to create manual payout request.', 'TYPE' => 'errormsg');
|
||||
}
|
||||
} else {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to wallet RPC service', 'TYPE' => 'errormsg');
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'You already have one active manual payout request.', 'TYPE' => 'errormsg');
|
||||
}
|
||||
} else {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Insufficient funds, you need more than ' . $config['txfee'] . ' ' . $config['currency'] . ' to cover transaction fees', 'TYPE' => 'errormsg');
|
||||
}
|
||||
$setting->setValue('manual_payout_active', 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -15,56 +15,64 @@ $aCronStatus = array(
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('statistics_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('statistics_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('statistics_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('statistics_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('statistics_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('statistics_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('statistics_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('statistics_message') ),
|
||||
),
|
||||
'auto_payout' => array (
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('auto_payout_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('auto_payout_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('auto_payout_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('auto_payout_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('auto_payout_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('auto_payout_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('auto_payout_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('auto_payout_message') ),
|
||||
),
|
||||
'manual_payout' => array (
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('manual_payout_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('manual_payout_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('manual_payout_runtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('manual_payout_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('manual_payout_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('manual_payout_message') ),
|
||||
),
|
||||
'archive_cleanup' => array (
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('archive_cleanup_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('archive_cleanup_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('archive_cleanup_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('archive_cleanup_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('archive_cleanup_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('archive_cleanup_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('archive_cleanup_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('archive_cleanup_message') ),
|
||||
),
|
||||
'blockupdate' => array (
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('blockupdate_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('blockupdate_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('blockupdate_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('blockupdate_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('blockupdate_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('blockupdate_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('blockupdate_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('blockupdate_message') ),
|
||||
),
|
||||
'findblock' => array (
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('findblock_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('findblock_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('findblock_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('findblock_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('findblock_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('findblock_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('findblock_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('findblock_message') ),
|
||||
),
|
||||
'notifications' => array (
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('notifications_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('notifications_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('notifications_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('notifications_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('notifications_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('notifications_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('notifications_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('notifications_message') ),
|
||||
),
|
||||
'tickerupdate' => array (
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('tickerupdate_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('tickerupdate_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('tickerupdate_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('tickerupdate_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('tickerupdate_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('tickerupdate_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('tickerupdate_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('tickerupdate_message') ),
|
||||
)
|
||||
);
|
||||
@ -75,8 +83,8 @@ case 'pplns':
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('pplns_payout_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('pplns_payout_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('pplns_payout_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('pplns_payout_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('pplns_payout_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('pplns_payout_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('pplns_payout_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('pplns_payout_message') ),
|
||||
);
|
||||
break;
|
||||
@ -85,8 +93,8 @@ case 'pps':
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('pps_payout_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('pps_payout_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('pps_payout_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('pps_payout_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('pps_payout_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('pps_payout_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('pps_payout_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('pps_payout_message') ),
|
||||
);
|
||||
break;
|
||||
@ -95,8 +103,8 @@ case 'prop':
|
||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('proportional_payout_status') ),
|
||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('proportional_payout_active') ),
|
||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('proportional_payout_runtime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('proportional_payout_starttime') ),
|
||||
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('proportional_payout_endtime') ),
|
||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('proportional_payout_starttime') ),
|
||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('proportional_payout_endtime') ),
|
||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('proportional_payout_message') ),
|
||||
);
|
||||
break;
|
||||
|
||||
@ -24,15 +24,27 @@
|
||||
{else if $event.STATUS.type == 'message'}
|
||||
<i>{$event.STATUS.value}</i>
|
||||
{else if $event.STATUS.type == 'yesno'}
|
||||
{if $event.STATUS.value == 1}
|
||||
Yes
|
||||
{else}
|
||||
No
|
||||
{/if}
|
||||
<img src="{$PATH}/images/{if $event.STATUS.value == 1}success{else}error{/if}.gif" />
|
||||
{else if $event.STATUS.type == 'time'}
|
||||
{$event.STATUS.value|default:"0"|number_format:"2"} seconds
|
||||
{if $event.STATUS.value > 60}
|
||||
<font color="orange">
|
||||
{else if $event.STATUS.value > 120}
|
||||
<font color="red">
|
||||
{else}
|
||||
<font color="green">
|
||||
{/if}
|
||||
{$event.STATUS.value|default:"0"|number_format:"2"} seconds
|
||||
</font>
|
||||
{else if $event.STATUS.type == 'date'}
|
||||
{$event.STATUS.value|date_format:"%m/%d %H:%M:%S"}
|
||||
{if ($smarty.now - 180) > $event.STATUS.value}
|
||||
<font color="red">
|
||||
{else if ($smarty.now - 120) > $event.STATUS.value}
|
||||
<font color="orange">
|
||||
{else}
|
||||
<font color="green">
|
||||
{/if}
|
||||
{$event.STATUS.value|date_format:"%m/%d %H:%M:%S"}
|
||||
</font>
|
||||
{else}
|
||||
{$event.STATUS.value|default:""}
|
||||
{/if}
|
||||
|
||||
21
sql/006_payouts.sql
Normal file
21
sql/006_payouts.sql
Normal file
@ -0,0 +1,21 @@
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `payouts` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`account_id` int(11) NOT NULL,
|
||||
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`completed` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `account_id` (`account_id`,`completed`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
Loading…
Reference in New Issue
Block a user