mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 08:41:39 +09:00
Allow programs to determine whether a member has points without calling isExistsPoint() and getPoint() separately
포인트 정보가 아예 없는 경우와 0포인트가 있는 경우를 구분하기 위해 isExistsPoint()와 getPoint()를 각각 호출하지 않아도 되도록 getPoint()에 3번째 인자 $exists를 추가함
This commit is contained in:
parent
01ee23b7d9
commit
3e1d223962
2 changed files with 8 additions and 3 deletions
|
|
@ -43,8 +43,8 @@ function pointLevelIconTrans($matches, $addon_info)
|
|||
$oPointModel = &$GLOBALS['_pointModel'];
|
||||
|
||||
// Get points
|
||||
$point = $oPointModel->getPoint($member_srl);
|
||||
if(!$point)
|
||||
$point = $oPointModel->getPoint($member_srl, false, $exists);
|
||||
if(!$exists)
|
||||
{
|
||||
return $matches[0];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,13 +29,14 @@ class pointModel extends point
|
|||
/**
|
||||
* @brief Get the points
|
||||
*/
|
||||
function getPoint($member_srl, $from_db = false)
|
||||
function getPoint($member_srl, $from_db = false, &$exists = null)
|
||||
{
|
||||
$member_srl = abs($member_srl);
|
||||
|
||||
// Get from instance memory
|
||||
if (!$from_db && isset(self::$_member_point_cache[$member_srl]))
|
||||
{
|
||||
$exists = true;
|
||||
return self::$_member_point_cache[$member_srl];
|
||||
}
|
||||
|
||||
|
|
@ -46,6 +47,7 @@ class pointModel extends point
|
|||
$point = Rhymix\Framework\Cache::get($cache_key);
|
||||
if ($point !== null)
|
||||
{
|
||||
$exists = true;
|
||||
return $point;
|
||||
}
|
||||
}
|
||||
|
|
@ -55,6 +57,7 @@ class pointModel extends point
|
|||
$cache_filename = sprintf('%s%d.cache.txt', $cache_path, $member_srl);
|
||||
if (!$from_db && file_exists($cache_filename))
|
||||
{
|
||||
$exists = true;
|
||||
return self::$_member_point_cache[$member_srl] = intval(trim(Rhymix\Framework\Storage::read($cache_filename)));
|
||||
}
|
||||
|
||||
|
|
@ -64,10 +67,12 @@ class pointModel extends point
|
|||
$output = executeQuery('point.getPoint', $args);
|
||||
if (isset($output->data->member_srl))
|
||||
{
|
||||
$exists = true;
|
||||
$point = intval($output->data->point);
|
||||
}
|
||||
else
|
||||
{
|
||||
$exists = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue