|
@@ -77,6 +77,7 @@ class Core
|
|
|
|
|
|
public function getUserScore($uid, $config_id = false, $type = false, $type_id = false)
|
|
|
{
|
|
|
+ $score = array();
|
|
|
if ($config_id && $type && $type_id) {
|
|
|
$where['config_id'] = $config_id;
|
|
|
$where['type'] = $type;
|
|
@@ -88,8 +89,11 @@ class Core
|
|
|
$where['uid'] = $uid;
|
|
|
$where['config_child_id'] = $child['id'];
|
|
|
$score = Dever::db('score/user_child')->one($where);
|
|
|
-
|
|
|
- return array('name' => $child['name'], 'score' => $score['score'] ? $score['score'] : 0);
|
|
|
+ if ($score) {
|
|
|
+ return array('name' => $child['name'], 'score' => $score['score'] ? $score['score'] : 0);
|
|
|
+ } else {
|
|
|
+ return array();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -104,11 +108,14 @@ class Core
|
|
|
$where['uid'] = $uid;
|
|
|
$where['config_id'] = $config['id'];
|
|
|
$score = Dever::db('score/user')->one($where);
|
|
|
-
|
|
|
- return array('name' => $config['name'], 'score' => $score['score'] ? $score['score'] : 0);
|
|
|
+ if ($score) {
|
|
|
+ return array('name' => $config['name'], 'score' => $score['score'] ? $score['score'] : 0);
|
|
|
+ } else {
|
|
|
+ return array();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- return false;
|
|
|
+ return array();
|
|
|
}
|
|
|
|
|
|
|