mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
Refactor triggerInsertMember() and triggerAfterLogin()
This commit is contained in:
parent
d4ccf4222d
commit
d4136f9081
1 changed files with 49 additions and 33 deletions
|
|
@ -19,20 +19,22 @@ class pointController extends point
|
||||||
*/
|
*/
|
||||||
public function triggerInsertMember($obj)
|
public function triggerInsertMember($obj)
|
||||||
{
|
{
|
||||||
// Get the point module information
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
// Get the member_srl of the newly registered member
|
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = $obj->member_srl;
|
||||||
// Get the points of the member
|
if (!$member_srl)
|
||||||
$oPointModel = getModel('point');
|
{
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
return new Object();
|
||||||
|
}
|
||||||
$point = $config->signup_point;
|
|
||||||
// Increase the point
|
$config = getModel('module')->getModuleConfig('point');
|
||||||
$cur_point += $point;
|
$point = intval($config->signup_point);
|
||||||
$this->setPoint($member_srl,$cur_point, 'signup');
|
if (!$point)
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
|
$this->setPoint($member_srl, $cur_point + $point, 'signup');
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,21 +44,27 @@ class pointController extends point
|
||||||
public function triggerAfterLogin($obj)
|
public function triggerAfterLogin($obj)
|
||||||
{
|
{
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = $obj->member_srl;
|
||||||
if(!$member_srl) return new Object();
|
if (!$member_srl)
|
||||||
// If the last login is not today, give the points
|
{
|
||||||
if(substr($obj->last_login,0,8)==date("Ymd")) return new Object();
|
return new Object();
|
||||||
// Get the point module information
|
}
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
// Points are given only once a day.
|
||||||
// Get the points of the member
|
if (substr($obj->last_login, 0, 8) === date('Ymd'))
|
||||||
$oPointModel = getModel('point');
|
{
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
return new Object();
|
||||||
|
}
|
||||||
$point = $config->login_point;
|
|
||||||
// Increase the point
|
$config = getModel('module')->getModuleConfig('point');
|
||||||
$cur_point += $point;
|
$point = intval($config->login_point);
|
||||||
$this->setPoint($member_srl,$cur_point);
|
if (!$point)
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
|
$this->setPoint($member_srl, $cur_point + $point);
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,10 +73,9 @@ class pointController extends point
|
||||||
*/
|
*/
|
||||||
public function triggerDeleteGroup($obj)
|
public function triggerDeleteGroup($obj)
|
||||||
{
|
{
|
||||||
// Get the point module config
|
|
||||||
$config = getModel('module')->getModuleConfig('point');
|
|
||||||
// Get the group_srl of the deleted group
|
|
||||||
$group_srl = $obj->group_srl;
|
$group_srl = $obj->group_srl;
|
||||||
|
$config = getModel('module')->getModuleConfig('point');
|
||||||
|
|
||||||
// Exclude deleted group from point/level/group integration
|
// Exclude deleted group from point/level/group integration
|
||||||
if($config->point_group && isset($config->point_group[$group_srl]))
|
if($config->point_group && isset($config->point_group[$group_srl]))
|
||||||
{
|
{
|
||||||
|
|
@ -721,13 +728,22 @@ class pointController extends point
|
||||||
{
|
{
|
||||||
$module_srl = intval($module_srl);
|
$module_srl = intval($module_srl);
|
||||||
$config_key = strval($config_key);
|
$config_key = strval($config_key);
|
||||||
if (!$module_srl || !$config_key)
|
if (!$config_key)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oModuleModel = getModel('module');
|
$oModuleModel = getModel('module');
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
|
||||||
|
if ($module_srl)
|
||||||
|
{
|
||||||
|
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$module_config = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($module_config[$config_key]) && $module_config[$config_key] !== '')
|
if (isset($module_config[$config_key]) && $module_config[$config_key] !== '')
|
||||||
{
|
{
|
||||||
$point = $module_config[$config_key];
|
$point = $module_config[$config_key];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue