/** * 日漫接口 */ public function getActionListAc($params) { $event_id = isset($params['event_id']) ? intval($params['event_id']) : 0; $action_tag = isset($params['action_tag']) ? trim($params['action_tag']) : ''; $action_id = 0; $data = array(); if ($event_id > 0 && !empty($action_tag)) { $ret = $this->getActionInfo($event_id, $action_tag); if (!empty($ret) && $ret['id'] > 0 && !in_array($ret['category'], $this->stats_category)) { $action_id = $ret['id']; } } //浏览数(参与人) $item = array(); $item['event_id'] = $event_id; $item['action_tag'] = 'view'; $stats = $this->getActionStats($item); $view = isset($stats['count']) ? intval($stats['count']) : 0; $uin = isset($params['uin']) ? intval($params['uin']) : 0; $object = isset($params['object']) ? Utils::EscapeDBInput($params['object']) : ''; $action_vol = isset($params['action_vol']) ? intval($params['action_vol']) : -1; $action_val = isset($params['action_val']) ? Utils::EscapeDBInput($params['action_val']) : ''; $terminal = isset($params['terminal']) ? intval($params['terminal']) : 0; $state = isset($params['state']) ? intval($params['state']) : 1; $reserve1 = isset($params['reserve1']) ? Utils::EscapeDBInput($params['reserve1']) : ''; $reserve2 = isset($params['reserve2']) ? Utils::EscapeDBInput($params['reserve2']) : ''; $page = isset($params['page']) ? intval($params['page']) : 1; $page_size = isset($params['page_size']) ? intval($params['page_size']) : 10; $sort = isset($params['sort']) ? Utils::EscapeDBInput($params['sort']) : 'id'; $order = isset($params['order']) && $params['order'] == 'asc' ? 'asc' : 'desc'; $start = ($page - 1) * $page_size; $data = array('total' => 0, 'view' => $view, 'data' => array()); if ($action_id > 0) { $db = DBHelper::GenerateEventActionClient('slave'); $table = 'tb_event_action_' . intval($action_id % 100); $where = "`action_id` = {$action_id}"; $where .= intval($ret['privacy']) == 1 ? " and `uin` = {$uin}" : ''; //判断私有或公开 $where .= empty($object) ? '' : " and `object` = '{$object}'"; $where .= $action_vol >= 0 ? " and `action_vol` = {$action_vol}" : ''; $where .= empty($action_val) ? '' : " and `action_val` = '{$action_val}'"; $where .= $terminal > 0 ? " and `terminal` = {$terminal}" : ''; $where .= $state > 0 ? " and `state` = {$state}" : ''; $where .= empty($reserve1) ? '' : " and `reserve1` = '{$reserve1}'"; $where .= empty($reserve2) ? '' : " and `reserve2` = '{$reserve2}'"; $sql_count = "select count(`id`) as total from {$table} where {$where}"; $row = $db->query($sql_count); if (!empty($row[0]) && intval($row[0]['total']) > 0) { $data['total'] = intval($row[0]['total']); $col = isset($params['col']) ? $params['col'] : 'object'; $where .= " group by `uin`"; $where .= empty($sort) ? '' : " order by `{$sort}` {$order}"; $sql = "select `uin`,{$col} as `col` from {$table} where {$where} limit {$start}, {$page_size} "; $rows = $db->query($sql); if (!empty($rows)) { if ($col == 'object') { $objectInfo = json_decode($ret['objects'], TRUE); } foreach ($rows as $k => $row) { $uinfo = $this->getUserInfo($row['uin']); $data['data'][$k]['uin'] = $row['uin']; $data['data'][$k]['nickname'] = !empty($uinfo['nick']) ? $uinfo['nick'] : $row['uin']; $data['data'][$k]['col'] = $col == 'object' ? $objectInfo[$row['col']] : $row['col']; } } } } return $data; }
protected function getVipPacketRecord($uin) { $table = 'tb_event_action_59'; $sql = "select count(*) from {$table} where uin = {$uin}"; // var_dump($sql); $db = DBHelper::GenerateEventActionClient('slave'); $row = $db->query($sql); if (!empty($row[0])) { $data = $row[0]; } return $data; }