* fix bug.

This commit is contained in:
wyd621
2013-10-24 07:53:40 +00:00
parent da1ea662b7
commit e5f79e31f1
5 changed files with 15 additions and 10 deletions

View File

@@ -814,12 +814,12 @@ class treeModel extends model
public function getStoryModule($moduleID)
{
$module = $this->dao->select('id,type,parent')->from(TABLE_MODULE)->where('id')->eq($moduleID)->fetch();
while($module->id and $module->type != 'story')
if($module->id and $module->type != 'story')
{
$module = $this->dao->select('id,type,parent')->from(TABLE_MODULE)->where('id')->eq($module->parent)->fetch();
}
return $module->id;
return empty($module) ? 0 : $module->id;
}
/**
@@ -973,6 +973,7 @@ class treeModel extends model
if(!isset($modules[$parentModuleID]) and $parentModuleID != 0) continue;
if($parentModuleID == 0)
{
$parentModule = new stdclass();
$parentModule->grade = 0;
$parentModule->path = ',';
}