| 
					
				 | 
			
			
				@@ -13,6 +13,12 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public function log($uid, $action_key, $action_name, $callback = '', $score = false, $num = false, $type = false, $type_id = false)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (strstr($action_key, '.')) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$temp = explode('.', $action_key);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$action_key = $temp[0];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$type = $temp[1];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$type_id = $temp[2];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$action = Dever::db('score/action')->one(array('key' => $action_key));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (!$action) {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -71,7 +77,7 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# 获取某一个用户的积分
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public function getUserScore($uid, $config_id = false, $type = false, $type_id = false)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if ($type && $type_id) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($config_id && $type && $type_id) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$where['config_id'] = $config_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$where['type'] = $type;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$where['type_id'] = $type_id;
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -83,11 +89,26 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$where['config_child_id'] = $child['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$score = Dever::db('score/user_child')->one($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				return array('name' => $child['name'], 'score' => $score['score']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				return array('name' => $child['name'], 'score' => $score['score'] ? $score['score'] : 0);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$config = Dever::db('score/config')->one($config_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (!$config_id) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$config = Dever::db('score/config')->one(array('type' => 1));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$config = Dever::db('score/config')->one($config_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ($config) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$where = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$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);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return false;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# 设置子积分
 
			 |