| 
					
				 | 
			
			
				@@ -11,7 +11,7 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 *
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @return mixed
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public function log($uid, $action_key, $action_name, $callback = '', $score = false, $num = false)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public function log($uid, $action_key, $action_name, $callback = '', $score = false, $num = false, $type = false, $type_id = false)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$action = Dever::db('score/action')->one(array('key' => $action_key));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -40,12 +40,18 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if ($parent_uid > 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$insert['parent_uid'] = $parent_uid;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ($type) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	            $insert['type'] = $type;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	        if ($type_id) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	            $insert['type_id'] = $type_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$insert['cron_type'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$log_id = Dever::db('score/action_log')->insert($insert);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			Dever::load('score/lib/core.oper?log_id='.$log_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			return;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$sync = Dever::config('base', 'score')->sync;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$sync = Dever::config('base', 'project')->score['sync'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if ($sync) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				Dever::daemon('lib/core.oper?log_id='.$log_id, 'score');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -62,6 +68,61 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return $data;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	# 获取某一个用户的积分
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public function getUserScore($uid, $config_id = false, $type = false, $type_id = false)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($type && $type_id) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$where['config_id'] = $config_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$where['type'] = $type;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$where['type_id'] = $type_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$where['state'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$child = Dever::db('score/config_child')->one($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ($child) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$where = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$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']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$config = Dever::db('score/config')->one($config_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	# 设置子积分
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public function setScoreChild($config_type, $config_id, $type, $type_id, $name)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$where['config_id'] = $config_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$where['type'] = $type;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$where['type_id'] = $type_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$info = Dever::db('score/config_child')->one($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($info && $config_type == 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$update['where_id'] = $info['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$update['state'] = 2;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Dever::db('score/config_child')->update($update);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} elseif ($config_type == 2) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (!$name) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$config = Dever::db('score/config')->one($config_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$name = $config['name'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ($info) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$update['where_id'] = $info['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$update['name'] = $name;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$update['state'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Dever::db('score/config_child')->update($update);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$insert = $where;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$insert['name'] = $name;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Dever::db('score/config_child')->insert($insert);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return true;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public function oper_api()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -99,9 +160,23 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$uid = $log['uid'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$num = $info['num'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->user = 'score/user';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->user_log = 'score/user_log';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$info['config_child_id'] = false;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		# 验证是否有子积分设置
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($log['type'] && $log['type_id']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$child = Dever::db('score/config_child')->one(array(
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'config_id' => $info['config_id'], 'type' => $log['type'], 'type_id' => $log['type_id'], 'state' => 1));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ($child) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$this->user = 'score/user_child';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$this->user_log = 'score/user_child_log';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$info['config_child_id'] = $child['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($info['upper'] == 2 && $info['upper_limit'] >= 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$upper = $this->upper($uid, $info, $log);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if (!$upper) {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -113,21 +188,17 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		# 完成
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$this->finish($log, 2, $num);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$user_log_id = $this->add($uid, $num, $info['config_id'], $info['action_id'], $log['id']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$user_log_id = $this->add($uid, $num, $info, $log);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (!$user_log_id) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		# 增加返利
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($info['rebate_type'] > 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$this->rebate($uid, $num, $info, $log);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		# 提升等级
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$level_type = Dever::db('score/level_type')->state();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if ($level_type) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			foreach ($level_type as $k => $v) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				$this->setLevel($uid, $v);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($log['callback']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if (strstr($log['callback'], '?')) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				Dever::load($log['callback'] . '&user_log_id=' . $user_log_id);
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -138,13 +209,19 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# 增加积分
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	private function add($uid, $num, $config_id, $action_id, $log_id, $rebate_uid = false)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private function add($uid, $num, $info, $log, $rebate_uid = false)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$user = Dever::db('score/user')->one(array('uid' => $uid, 'config_id' => $config_id));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$where = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$where['uid'] = $uid;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$where['config_id'] = $info['config_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($info['config_child_id']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$where['config_child_id'] = $info['config_child_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$user = Dever::db($this->user)->one($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (!$user) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$user = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$user['id'] = Dever::db('score/user')->insert(array('uid' => $uid, 'config_id' => $config_id, 'score' => 0, 'no_score' => 0));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$user['id'] = Dever::db($this->user)->insert($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$user['score'] = 0;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -152,20 +229,30 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$update['where_id'] = $user['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$update['score'] = $user['score'] + $num;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$insert['uid'] = $uid;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$insert['config_id'] = $config_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$insert['action_log_id'] = $log_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$insert['action_id'] = $action_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$insert = $where;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$insert['action_log_id'] = $log['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$insert['action_id'] = $info['action_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($rebate_uid) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$insert['rebate_uid'] = $rebate_uid;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['status'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['num'] = $num;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['total'] = $update['score'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['cdate'] = time();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$user_log_id = Dever::db('score/user_log')->insert($insert);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$user_log_id = Dever::db($this->user_log)->insert($insert);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($user_log_id) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Dever::db($this->user)->update($update);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		Dever::db('score/user')->update($update);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			# 提升等级
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$level_type = Dever::db('score/level_type')->state();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ($level_type) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				foreach ($level_type as $k => $v) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$this->setLevel($uid, $v);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return $user_log_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -197,7 +284,7 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if ($parent_uid > 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					$this->add($parent_uid, $value, $info['config_id'], $info['action_id'], $log['id'], $uid);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$this->add($parent_uid, $value, $info, $log, $uid);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} elseif ($invite) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				# 上级的上级
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -210,7 +297,7 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$other_parent_uid = Dever::load('invite/api')->getParent($rebate_uid, $level);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if ($other_parent_uid > 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					$this->add($other_parent_uid, $value, $info['config_id'], $info['action_id'], $log['id'], $rebate_uid);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$this->add($other_parent_uid, $value, $info, $log, $rebate_uid);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -239,7 +326,7 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# 设置上限限制
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	private function upper($uid, $info)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private function upper($uid, $info, $log)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		# 有上限限制
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$limit = $info['upper_limit'];
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -248,11 +335,14 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$time = time();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$where = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($info['config_child_id']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$where['config_child_id'] = $info['config_child_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$where['config_id'] = $info['config_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$where['action_id'] = $info['action_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$where['uid'] = $uid;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$where['status'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$user_log = Dever::db('score/user_log')->getNew($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$user_log = Dever::db($this->user_log)->getNew($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($user_log) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if ($info['upper_type'] == 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				# 按天
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -268,7 +358,7 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return true;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$user_log_num = Dever::db('score/user_log')->getNewTotal($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$user_log_num = Dever::db($this->user_log)->getNewTotal($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if ($user_log_num >= $info['upper_limit']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return false;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -360,7 +450,7 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$rule = Dever::array_decode($config['score']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if ($rule) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				$user_score = Dever::db('score/user')->getScoreByConfig($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$user_score = Dever::db($this->user)->getScoreByConfig($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if ($user_score) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					foreach ($rule as $k => $v) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						$score = $v['config'];
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -372,7 +462,7 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							if ($level_type['score'] == 2 && $level_type['type'] == 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 								$user_score_update['where_id'] = $user_score[$score]['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 								$user_score_update['score'] = $user_score[$score]['score'] - $num;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-								Dever::db('score/user')->update($user_score_update);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+								Dever::db($this->user)->update($user_score_update);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						} else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							$yes = false;
 
			 |