mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 12:02:24 +09:00
General cleanup of point diff logic
This commit is contained in:
parent
a43f0368ec
commit
9ba8c9159e
1 changed files with 43 additions and 41 deletions
|
|
@ -31,14 +31,12 @@ class pointController extends point
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = $this->getConfig();
|
$config = $this->getConfig();
|
||||||
$point = intval($config->signup_point);
|
$diff = intval($config->signup_point);
|
||||||
if (!$point)
|
if ($diff != 0)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cur_point = PointModel::getPoint($member_srl);
|
$cur_point = PointModel::getPoint($member_srl);
|
||||||
$this->setPoint($member_srl, $cur_point + $point, 'signup');
|
$this->setPoint($member_srl, $cur_point + $diff, 'signup');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -59,14 +57,12 @@ class pointController extends point
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = $this->getConfig();
|
$config = $this->getConfig();
|
||||||
$point = intval($config->login_point);
|
$diff = intval($config->login_point);
|
||||||
if (!$point)
|
if ($diff != 0)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cur_point = PointModel::getPoint($member_srl);
|
$cur_point = PointModel::getPoint($member_srl);
|
||||||
$this->setPoint($member_srl, $cur_point + $point);
|
$this->setPoint($member_srl, $cur_point + $diff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -120,9 +116,12 @@ class pointController extends point
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase the point.
|
// Increase the point.
|
||||||
|
if ($diff != 0)
|
||||||
|
{
|
||||||
$cur_point = PointModel::getPoint($member_srl);
|
$cur_point = PointModel::getPoint($member_srl);
|
||||||
$this->setPoint($member_srl, $cur_point + $diff);
|
$this->setPoint($member_srl, $cur_point + $diff);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save information about the original document before updating.
|
* Save information about the original document before updating.
|
||||||
|
|
@ -178,8 +177,11 @@ class pointController extends point
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase the point.
|
// Increase the point.
|
||||||
|
if ($diff != 0)
|
||||||
|
{
|
||||||
$cur_point = PointModel::getPoint($member_srl);
|
$cur_point = PointModel::getPoint($member_srl);
|
||||||
$this->setPoint($member_srl, $cur_point + $diff);
|
$this->setPoint($member_srl, $cur_point + $diff);
|
||||||
|
}
|
||||||
|
|
||||||
// Remove the reference to the original document.
|
// Remove the reference to the original document.
|
||||||
$this->_original = null;
|
$this->_original = null;
|
||||||
|
|
@ -226,18 +228,15 @@ class pointController extends point
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the points of the member
|
|
||||||
$cur_point = PointModel::getPoint($member_srl);
|
|
||||||
|
|
||||||
// Subtract points for the document.
|
// Subtract points for the document.
|
||||||
$document_point = $this->_getModulePointConfig($module_srl, 'insert_document');
|
$diff = $this->_getModulePointConfig($module_srl, 'insert_document');
|
||||||
if ($document_point > 0)
|
|
||||||
{
|
|
||||||
$cur_point -= $document_point;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increase the point.
|
// Increase the point.
|
||||||
$this->setPoint($member_srl, $cur_point);
|
if ($diff != 0)
|
||||||
|
{
|
||||||
|
$cur_point = PointModel::getPoint($member_srl);
|
||||||
|
$this->setPoint($member_srl, $cur_point - $diff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -291,9 +290,12 @@ class pointController extends point
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase the point.
|
// Increase the point.
|
||||||
|
if ($diff != 0)
|
||||||
|
{
|
||||||
$cur_point = PointModel::getPoint($member_srl);
|
$cur_point = PointModel::getPoint($member_srl);
|
||||||
$this->setPoint($member_srl, $cur_point + $diff);
|
$this->setPoint($member_srl, $cur_point + $diff);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger which gives points for uploaded file changes to a comment
|
* @brief A trigger which gives points for uploaded file changes to a comment
|
||||||
|
|
@ -340,18 +342,16 @@ class pointController extends point
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the module_srl of the document to which this comment belongs
|
// Calculate points based on the module_srl of the document to which this comment belongs
|
||||||
$module_srl = $oDocument->get('module_srl');
|
$module_srl = $oDocument->get('module_srl');
|
||||||
|
$diff = $this->_getModulePointConfig($module_srl, 'insert_comment');
|
||||||
|
|
||||||
// Get the points of the member
|
// Decrease the point.
|
||||||
|
if ($diff != 0)
|
||||||
|
{
|
||||||
$cur_point = PointModel::getPoint($member_srl);
|
$cur_point = PointModel::getPoint($member_srl);
|
||||||
|
$this->setPoint($member_srl, $cur_point - $diff);
|
||||||
// Add points for the comment.
|
}
|
||||||
$comment_point = $this->_getModulePointConfig($module_srl, 'insert_comment');
|
|
||||||
$cur_point -= $comment_point;
|
|
||||||
|
|
||||||
// Increase the point.
|
|
||||||
$this->setPoint($member_srl, $cur_point);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -392,14 +392,16 @@ class pointController extends point
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the points of the member
|
// Get the points of the member
|
||||||
$cur_point = PointModel::getPoint($member_srl);
|
|
||||||
|
|
||||||
// Subtract points for the file.
|
// Subtract points for the file.
|
||||||
$file_point = $this->_getModulePointConfig($module_srl, 'upload_file');
|
$diff = $this->_getModulePointConfig($module_srl, 'upload_file');
|
||||||
$cur_point -= $file_point;
|
|
||||||
|
|
||||||
// Update the point.
|
// Update the point.
|
||||||
$this->setPoint($member_srl, $cur_point);
|
if ($diff != 0)
|
||||||
|
{
|
||||||
|
$cur_point = PointModel::getPoint($member_srl);
|
||||||
|
$this->setPoint($member_srl, $cur_point - $diff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue