|
@@ -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)
|
|
|
{
|