dever 4 years ago
parent
commit
1978ec14eb
4 changed files with 101 additions and 0 deletions
  1. 16 0
      database/action.php
  2. 18 0
      database/user_child_log.php
  3. 17 0
      database/user_log.php
  4. 50 0
      lib/Core.php

+ 16 - 0
database/action.php

@@ -76,4 +76,20 @@ return array
 			'list1' => array('已计算日志', '"action_log_finish&search_option_action_id={id}&oper_parent=action"'),
 		),
 	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getData' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('id' => 'desc'),
+			'col' => '*|id',
+		),
+	)
 );

+ 18 - 0
database/user_child_log.php

@@ -237,6 +237,24 @@ return array
 			'col' => '*',
 		),
 
+		'getList' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'config_child_id' => 'yes',
+				'config_id' => 'yes',
+				'action_id' => 'yes',
+				'uid' => 'yes',
+				'status' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('cdate' => 'desc'),
+			'page' => array(5, 'list'),
+			'col' => '*',
+		),
+
 		'getNewTotal' => array
 		(
 			# 匹配的正则或函数 选填项

+ 17 - 0
database/user_log.php

@@ -226,6 +226,23 @@ return array
 			'col' => '*',
 		),
 
+		'getList' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'config_id' => 'yes',
+				'action_id' => 'yes',
+				'uid' => 'yes',
+				'status' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('cdate' => 'desc'),
+			'page' => array(5, 'list'),
+			'col' => '*',
+		),
+
 		'getNewTotal' => array
 		(
 			# 匹配的正则或函数 选填项

+ 50 - 0
lib/Core.php

@@ -111,6 +111,56 @@ class Core
 		return false;
 	}
 
+	# 获取用户积分日志列表
+	public function getUserScoreList($uid, $config_id = false, $type = false, $type_id = false)
+	{
+		$result = array();
+
+		if ($config_id && $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'];
+				$result = Dever::db('score/user_log')->getList($where);
+			}
+		}
+
+		if (!$result) {
+			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'];
+
+				$result = Dever::db('score/user_log')->getList($where);
+			}
+		}
+
+		if ($result) {
+			$action = Dever::db('score/action')->getData();
+			foreach ($result as $k => $v) {
+				$result[$k]['cdate'] = date('Y-m-d H:i:s', $v['cdate']);
+				if (isset($action[$v['action_id']])) {
+					$result[$k]['title'] = $action[$v['action_id']]['name'];
+				} else {
+					$result[$k]['title'] = '未知';
+				}
+			}
+		}
+		
+		return $result;
+	}
+
 	# 设置子积分
 	public function setScoreChild($config_type, $config_id, $type, $type_id, $name)
 	{