array( /// 全国 ), 'z9kh0TRia0hF3C1m4lt5kuSfH02HoBBtjh9H0sp7t0Lapg0hGbz1sAfa44sqA1yA' => array( /// 上饶 ), 'wVcn0icGP0pgGK2hjBh0McJrOq2H92wXmdog06zrG0Grxp0AWNd1ipgtLCcmG0wm' => array( /// 休闲 ), 'cRif0rNjh0Wfhm2q1XE1qJonKxHkndDxDjBx0ishk0Chps0Ypga1bdrfO6W5Nzwi' => array( /// (测试) ), 'BCmh0jkhw0dBHy2uXia8gkg3Av3gkrvxhpcL0Slbq0fFkj0xfuy1vej6nglPDfU1' => array( /// 武汉 ), 'Cm2K0jK8e0tUl20gywl8iOkeKhSV4lSay2SK0h4df0rfGa0c9D17o589g7vXtw3L' => array( /// 海南 ), 'bjdc0emtp0irtD2cKcA2MBAZxk1AJRiuXgjo0UzHy0keYw0vMrf1kwzZoku9mpUl' => array( /// 168游戏平台 ), 'cjcH0Yrkq0EUfb2NvZu3pm7CG4y5fmo5RGsj0TiHx0Kmju0IUVo1dv6e9j6ZV39y' => array( /// 崇仁聚友棋牌 ), 'veRa0qrBf0df2K1G4de2tgfmVxB2jxpvFtJf073aa0d6rI1xD8J1Y42fINTm0ziK' => array( /// 进贤 ), 'hwky0lx17041Ss1TwnF3kSujL7cTlwbiursc0nZpf0acmj0ZU2m15X4T99GEmOoL' => array( /// 嘻哈 ), 'lNVL0tHmk0Maod2Bz1Q7g11ptboai9URghYu0egkk0rNez0Awdb1u2ne0qa7VmGR' => array( /// 0598游戏 ), 'fGex0vtan0czcx2KQsJ4HtQs997rmxygouEK0BeCc0nvHk0mxdY1HtddNcfo5ifm' => array( /// 有味棋牌 ), 'Fyjd04w1k0hSsZ1y0pl8nbPSbfK8DslquGvv0gxJd0tT3g0d7Of1cso0sL6eVZzM' => array( /// 广东 ), 'vPlg0pjcs0khhr3EtuB0ypFF20bi5Rc7iPuH0wAZf0gFBH0kggh1cmyfjkdv0dbq' => array( /// 陈默友乐大厅 ), 'm57z0hFgA0rNlb1en0f9Xyb37tpHz6Crc4Wn0Qsku0Vlgs0g79y1Z1VHkHlEa9CU' => array( /// 凡凡 ), 'UgUp0mzfs0uney3jira1nujd6mf8z9XtkhEh0nxja0kTad0YfPL1dGeR9dGwOHta' => array( /// 睿龙互动 ), 'VJJb0dhkf0ioRS2jhsh6akhVt91QVkwtrskL0Dvmp0hEOJ0ihLd1Ynz03cGH0x9K' => array( /// 丰城星星剑邑娱乐 ), 'uQgZ0uehf0greK3Ryjz2pEemhp37eddjtyug0dnjH0SLmu0rCuk1rdfGbpCR56c1' => array( /// 袋鼠娱乐 ), 'nMjx0zLil0jouv3EJsq3URziCdu9jtnCnjgu0snwd0kA1h0dsys1yn5xwb72VMj2' => array( /// 萍乡 ), 'ljke0uLyb0Kgdv3hqpt41oyyHfycudo7Qbhf0zTri0gkxF0zVxQ1zs8pX15v53c2' => array( /// 永盛在线游戏 ), 'nkTs0yPsV0jepu2kqFL5LafiuyF8fvoAmGoU0pJNt0hjkD0jdgq1pqThbcd8SEus' => array( /// H5 ), 'GsbU0eMWu0Lttw3fDSc5jd5Iez5L1iuwGGBh0ZsQB0aoop0duZb1YOknit8Em236' => array( /// 友乐东乡翻天 ), 'Gwuq0ljKm0uowP3srkp7dfhBK7b4mmnxFdsA0ltAc0Jgik0ZDcc1HvLwGzhm16D0' => array( /// 广州聚友 ), 'dTdK0QuCR0tcGw3Ucaf6yJg7CPL0lylxxuRv0pPyD0iYyb0nEmW1PmClud27cp5H' => array( /// 慈溪聚友 ), 'nJkC0ppYG0pbfv3XvnJ8g02603ddtwvkcdhz0ysai0yeiw0jdlv1Gb9y3j495fql' => array( /// 花色棋牌 ), 'styc0JLaY0nIeu3xMPn9Uvjus5945pNjPUXY0JmKC0YLUt0ifHt1crgiTkjVCQ9S' => array( /// 永新游戏 ), 'JkMw0wkez0xIRo4bcQv0ukNhzwDsLEk8cRqi0cBey0PnGe0nbMW1RETRvhZ1Y9Bb' => array( /// 古田棋牌 ), 'Brhz0sSkV0umvh4geNS1ngkpvlWxhggfUKpU0zjlF0xpYB0ujov1KQuopCjs04uf' => array( /// 康鹏娱乐 ), ); /** * @param ISQLCommand $command * @param string $mask * @param string $agentid * @param string $channelid * @param string $gameid * @param string $starttime * @param string $endtime * @return string|null */ private function format_command_line($command, $mask, $agentid, $channelid, $gameid, $starttime, $endtime) { if ($command instanceof ISQLCommand) { $mask = str_ireplace('%agentid%', $command->GetIdentifiers($agentid, true), $mask); $mask = str_ireplace('%channelid%', $command->GetIdentifiers($channelid, true), $mask); $mask = str_ireplace('%gameid%', $command->GetIdentifiers($gameid, true), $mask); $mask = str_ireplace('%starttime%', $command->GetIdentifiers($starttime, true), $mask); $mask = str_ireplace('%endtime%', $command->GetIdentifiers($endtime, true), $mask); } return $mask; } private function sum_array($array) { $return = 0; if (is_object($array)) $array = (array)$array; if (is_array($array)) { foreach ($array as $item) { if (is_object($item) || is_array($item)) $return += $this->sum_array($item); elseif (is_numeric($item)) $return += intval($item); else $return += 0; } } return $return; } private function extract_array($array) { $return = array(); if (is_object($array)) $array = (array)$array; if (is_array($array)) { foreach ($array as $item) { if (is_object($item) || is_array($item)) array_push($return, $this->extract_array($item)); else array_push($return, $item); } } else { array_push($return, $array); } return $return; } /** * @note 获取报表列表 * @param RequestParameter $request * @param ReturnParameter $return * @return bool */ // public function querybatch($request, &$return) // { // /// 代理 // $agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : ''; // /// 渠道 // $channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : ''; // /// 游戏 // $gameid = isset($request->biz_content['gameid']) ? $request->biz_content['gameid'] : ''; // /// 是否需要默认数据(当天、昨天、当月) // $needdata = isset($request->biz_content['needdata']) ? $request->biz_content['needdata'] : 0; // // if (empty($agentid)) // { // $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid')); // return false; // } // // if (empty($channelid)) // { // $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid')); // return false; // } // // $cmd = $this->NewMasterCommand(); // // /// 如果不需要数据则返回列表 // if (0 == $needdata) // { // $return->biz_content = $cmd // ->Select('reportid', 'reportname', 'agentid', 'channelid', 'reportcaption') // ->From('ct_report_info') // ->Where('(ifnull(agentid, \'\') = \'\' and ifnull(channelid, \'\') = \'\') or (agentid = ? and channelid = ?)') // ->BindParameters($agentid, $channelid) // ->Request(); // // $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); // return $this->PDO_IsDone(); // } // // /// 如果需要数据则需要多查询出脚本 // $data = $cmd // ->Select('reportid', 'reportname', 'agentid', 'channelid', 'reportcaption', 'commandline') // ->From('ct_report_info') // ->Where('(ifnull(agentid, \'\') = \'\' and ifnull(channelid, \'\') = \'\') or (agentid = ? and channelid = ?)') // ->BindParameters($agentid, $channelid) // ->Request(); // if (!$this->PDO_IsDone()) // { // $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); // return false; // } // // foreach ($data as &$item) // { // /// 取当前 // $starttime = date('Y-m-d'); // $endtime = date('Y-m-d'); // $commandline = $this->format_command_line($cmd, $item['commandline'], $agentid, $channelid, $gameid, $starttime, $endtime); // $item['today'] = $this->sum_array($this->PDO_Request($commandline)); // // /// 取昨天 // $starttime = date('Y-m-d', strtotime('-1 days')); // $endtime = date('Y-m-d', strtotime('-1 days')); // $commandline = $this->format_command_line($cmd, $item['commandline'], $agentid, $channelid, $gameid, $starttime, $endtime); // $item['yesterday'] = $this->sum_array($this->PDO_Request($commandline)); // // /// 取本月 // $starttime = date('Y-m-') . '01'; // $endtime = date('Y-m-') . '31'; // $commandline = $this->format_command_line($cmd, $item['commandline'], $agentid, $channelid, $gameid, $starttime, $endtime); // $item['currmonth'] = $this->sum_array($this->PDO_Request($commandline)); // // if (empty($item['today'])) // $item['today'] = 0; // if (empty($item['yesterday'])) // $item['yesterday'] = 0; // if (empty($item['currmonth'])) // $item['currmonth'] = 0; // // unset($item['commandline']); // } // // $return->biz_content = $data; // $return->SetErrors(ERRORCODE_SUCCESS, ERRORINFO_SUCCESS); // return true; // } public function querybatch($request, &$return) { /// 代理 $agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : ''; /// 渠道 $channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : ''; /// 游戏 $gameid = isset($request->biz_content['gameid']) ? $request->biz_content['gameid'] : ''; /// 是否需要默认数据(当天、昨天、当月) $needdata = isset($request->biz_content['needdata']) ? $request->biz_content['needdata'] : 0; /// 是否需要显示所有数据 $alldata = isset($request->biz_content['alldata']) ? $request->biz_content['alldata'] : 0; /// 代理id $salesid = isset($request->biz_content['salesid']) ? $request->biz_content['salesid'] : 0; if (empty($agentid)) { $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid')); return false; } if (empty($channelid)) { $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid')); return false; } $group = 0 == intval($alldata) ? ' and ifnull(is_admin, 0) = 0' : ''; $base_command = /** @lang text */ <<NewMasterCommand(); if (0 == $needdata) { /// 如果不需要数据则返回列表 $command_line = /** @lang text */ <<biz_content = $cmd->request($command_line, $agentid, $channelid); } else { $rate = $this->global_rate * empty($this->whitelist[$agentid . $channelid][$salesid]) ? 1 : $this->whitelist_rate; /// 如果需要数据则需要多查询出脚本 $command_line = /** @lang text */ <<biz_content = $cmd->request($command_line, $salesid, $agentid, $channelid); } $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); return $this->PDO_IsDone(); } /** * @note 获取报表详情 * @param RequestParameter $request * @param ReturnParameter $return * @return bool */ // public function querydetail($request, &$return) // { // /// 代理 // $agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : ''; // /// 渠道 // $channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : ''; // /// 游戏 // $gameid = isset($request->biz_content['gameid']) ? $request->biz_content['gameid'] : ''; // /// 报表id // $reportid = isset($request->biz_content['reportid']) ? $request->biz_content['reportid'] : ''; // /// 起始时间 // $starttime = isset($request->biz_content['starttime']) ? $request->biz_content['starttime'] : ''; // /// 终止时间 // $endtime = isset($request->biz_content['endtime']) ? $request->biz_content['endtime'] : ''; // // // if (empty($agentid)) // { // $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid')); // return false; // } // // if (empty($channelid)) // { // $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid')); // return false; // } // // if (empty($reportid)) // { // $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'reportid')); // return false; // } // // $cmd = $this->NewMasterCommand(); // $return->biz_content = $cmd // ->Select('reportid', 'reportname', 'agentid', 'channelid', 'reportcaption', 'commandline') // ->From('ct_report_info') // ->Where(array('reportid' => $reportid,)) // ->Request(); // // if (!$this->PDO_IsDone()) // { // $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); // return false; // } // // if (empty($return->biz_content) || empty($return->biz_content[0])) // { // $return->SetErrors(ERRORCODE_NODATAERROR, ERRORINFO_NODATAERROR); // return false; // } // $return->biz_content = $return->biz_content[0]; // $commandline = $this->format_command_line($cmd, $return->biz_content['commandline'], $agentid, $channelid, $gameid, $starttime, $endtime); // //$report = array_values((array)$this->PDO_Request(commandline)); // $report = $this->PDO_Request($commandline); // while (is_array($report)) // { // if (1 == count($report)) // $report = current($report); // else // break; // } // // unset($return->biz_content['commandline']); // $return->biz_content['data'] = $this->extract_array($report); // // $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); // return $this->PDO_IsDone(); // } public function querydetail($request, &$return) { /// 代理 $agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : ''; /// 渠道 $channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : ''; /// 游戏 $gameid = isset($request->biz_content['gameid']) ? $request->biz_content['gameid'] : ''; /// 代理id $salesid = isset($request->biz_content['salesid']) ? $request->biz_content['salesid'] : 0; /// 报表id $reportid = isset($request->biz_content['reportid']) ? $request->biz_content['reportid'] : ''; /// 起始时间 $starttime = isset($request->biz_content['starttime']) ? $request->biz_content['starttime'] : ''; /// 终止时间 $endtime = isset($request->biz_content['endtime']) ? $request->biz_content['endtime'] : ''; if (empty($agentid)) { $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid')); return false; } if (empty($channelid)) { $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid')); return false; } if (empty($reportid)) { $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'reportid')); return false; } $rate = $this->global_rate * empty($this->whitelist[$agentid . $channelid][$salesid]) ? 1 : $this->whitelist_rate; $cmd = $this->NewMasterCommand(); $command_line = /** @lang text */"select report_date, cast(report_data * {$rate} as decimal(18, 0)) report_data from ct_report_info where report_id = ? and agent_id = ? and channel_id = ? and ifnull(sales_id, 0) in (0, ?)"; if (empty($starttime) && empty($endtime)) { $command_line .= ' order by report_date desc'; $return->biz_content = $cmd->request($command_line, $reportid, $agentid, $channelid, $salesid); } else { $command_line .= ' and (report_date between ? and ?) order by report_date desc'; $return->biz_content = $cmd->request($command_line, $reportid, $agentid, $channelid, $salesid, $starttime, $endtime); } $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); return $this->PDO_IsDone(); } /** * @note 订单流水 * @param RequestParameter $request * @param ReturnParameter $return * @return bool */ public function querybillbatch($request, &$return) { /// 代理 $agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : ''; /// 渠道 $channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : ''; /// 起始时间 $starttime = isset($request->biz_content['starttime']) ? $request->biz_content['starttime'] : ''; /// 终止时间 $endtime = isset($request->biz_content['endtime']) ? $request->biz_content['endtime'] : ''; $page_index = isset($request->biz_content['page_index']) ? intval($request->biz_content['page_index']) : 1; $page_size = isset($request->biz_content['page_size']) ? intval($request->biz_content['page_size']) : 50; $start = ($page_index - 1) * $page_size ; $stop = $page_size; if (empty($agentid)) { $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid')); return false; } if (empty($channelid)) { $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid')); return false; } // $command = <<PDO_Request($command, $agentid, $channelid, $starttime, $endtime, $start, $stop); if(!is_array($orderList)) { $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); return false; } // $dbCount = $this->PDO_Request( // /** @lang text */ // ' // select // a.sabu_playername // from // sales_buybill a left join // agent b1 on a.sabu_pushsalesid1 = b1.idx left join // agent b2 on a.sabu_pushsalesid2 = b2.idx // where // sabu_agentid = ? and sabu_channelid = ? and sabu_createtime between cast(? as datetime) and cast(? as datetime)', // $agentid, $channelid, $starttime, $endtime); // if(!is_array($dbCount)) // { // $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); // return false; // } // // $page_count = ceil(count($dbCount) / $page_size); $command = /** @lang text */<<pdo_request($command, $agentid, $channelid, $starttime, $endtime); $page_count = intval(@$ret[0]['c']); $return->biz_content = array( 'list' => $orderList, 'page_index' => $page_index, 'page_size' => $page_size, 'page_count' => $page_count ); return true; } /** * 1)今日新增人数,茶水费 * 2)昨日新增人数,茶水费 * 3)近7日新增人数,茶水费 * 4)近30日新增人数,茶水费 * @param $request * @param $return * @return bool */ public function increasePeople($request, &$return) { $params = $request->biz_content; $agentid = isset($params['agentid']) ? $params['agentid'] : ''; $channelid = isset($params['channelid']) ? $params['channelid'] : ''; $salesid = isset($params['salesid']) ? intval($params['salesid']) : ''; $type = isset($params['type']) ? intval($params['type']) : 1; $day = isset($params['day']) ? intval($params['day']) : 0; if (empty($agentid)) { $return->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR); return false; } if (empty($channelid)) { $return->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR); return false; } if (empty($salesid)) { $return->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR); return false; } // 888 表示总代理查询,否则就是查自己的下级 if($type === 888) { $where = ''; } else { $where = " and saus_invitecode={$salesid}"; } // 如果有传具体的天数 if($day !== 0) { $sql = <<PDO_Request($sql); if (!$this->PDO_isdone()) { $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); return false; } $return->biz_content = $res; return true; } /** * 操作类型 1:购买房卡;11:购买星星; * @param $request * @param $return * @return bool */ public function buy($request, &$return) { $params = $request->biz_content; $agentid = isset($params['agentid']) ? $params['agentid'] : ''; $channelid = isset($params['channelid']) ? $params['channelid'] : ''; $salesid = isset($params['salesid']) ? intval($params['salesid']) : ''; $type = isset($params['type']) ? intval($params['type']) : 1; if (empty($agentid)) { $return->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR); return false; } if (empty($channelid)) { $return->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR); return false; } if (empty($salesid)) { $return->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR); return false; } // 888 表示总代理查询,否则就是查自己的下级 if($type === 888) { $where = ''; } else { $where = " and parentid={$salesid}"; } $sql = <<PDO_Request($sql); if (!$this->PDO_isdone()) { $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo()); return false; } $return->biz_content = $res; return true; } }