| 
					
				 | 
			
			
				@@ -31,13 +31,19 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if ($num > 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$insert['num'] = $num;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$insert['cron_type'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$log_id = Dever::db('score/action_log')->insert($insert);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			Dever::daemon('lib/core.oper?log_id='.$log_id, 'score');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//Dever::daemon('lib/core.oper?log_id='.$log_id, 'score');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//Dever::load('score/lib/core.oper?log_id='.$log_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public function oper_api()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	/**
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * 根据用户行为,增加积分
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 *
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -50,6 +56,8 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$log = Dever::db('score/action_log')->one($log_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$this->operAction($log);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return $log;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private function rule($log, $info)
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -63,6 +71,7 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$info['num'] = $info['num'] * $log['num'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($info['num'] == 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Dever::db('score/action_log')->update(array('where_id' => $log['id'], 'cron_type' => 3));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			return;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -81,11 +90,11 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($info['upper'] == 2 && $info['upper_limit'] >= 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$upper = $this->upper($uid, $info, $log);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if (!$upper) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				Dever::db('score/action_log')->update(array('where_id' => $log['id'], 'score_type' => 3, 'score' => '0'));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Dever::db('score/action_log')->update(array('where_id' => $log['id'], 'score_type' => 3, 'cron_type' => 3, 'score' => '0'));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			Dever::db('score/action_log')->update(array('where_id' => $log['id'], 'score_type' => 2, 'score' => $num));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Dever::db('score/action_log')->update(array('where_id' => $log['id'], 'score_type' => 2, 'cron_type' => 3, 'score' => $num));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$update = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$update['where_id'] = $user['id'];
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -93,10 +102,12 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['uid'] = $uid;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['config_id'] = $info['config_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$insert['action_log_id'] = $log['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['action_id'] = $info['action_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['status'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['num'] = $num;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$insert['total'] = $update['score'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$insert['cdate'] = time();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$user_log_id = Dever::db('score/user_log')->insert($insert);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Dever::db('score/user')->update($update);
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -153,7 +164,8 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private function operAction($log)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if ($log && $log['score_type'] == 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($log && $log['cron_type'] == 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Dever::db('score/action_log')->update(array('where_id' => $log['id'], 'cron_type' => 2));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$where = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$where['state'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$where['id'] = $log['action_id'];
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -172,13 +184,13 @@ class Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /**
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	 * 根据积分日志和规则,增加积分,这是一个定时任务,暂时不开启了
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 * 根据积分日志和规则,增加积分,这是一个定时任务,可以设置每天凌晨启动
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 *
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @return mixed
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public function cron()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$where['score_type'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$where['cron_type'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$log = Dever::db('score/action_log')->all($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($log) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			foreach ($log as $k => $v) {
 
			 |