function deleteSqlLogsByIds($ids) { if (!ACloud_Sys_Core_S::isArray($ids)) { return false; } $this->query(sprintf("DELETE FROM %s WHERE id IN (%s)", $this->tablename, ACloud_Sys_Core_S::sqlImplode($ids))); return $this->affected_rows(); }
function deleteSqlLogsByIds($ids) { if (!ACloud_Sys_Core_S::isArray($ids)) { return false; } $sqlLogDao = $this->getSqlLogDao(); return $sqlLogDao->deleteSqlLogsByIds($ids); }
function updateTableSettingByTableName($tableName, $fields) { list($tableName, $fields) = array(trim($tableName), $this->checkFields($fields)); if (!$tableName || !ACloud_Sys_Core_S::isArray($fields)) { return false; } $apisDao = $this->getTableSettingsDao(); return $apisDao->update($fields, $tableName); }
function updateApiConfigByApiName($apiName, $fields) { list($apiName, $fields) = array(trim($apiName), $this->checkFields($fields)); if (!$apiName || !ACloud_Sys_Core_S::isArray($fields)) { return false; } $apisDao = $this->getApisDao(); return $apisDao->update($fields, $apiName); }
function crawlSqlLog($startTime, $endTime, $page, $perpage) { list($startTime, $endTime, $page, $perpage) = array(intval($startTime), intval($endTime), intval($page), intval($perpage)); if ($startTime > $endTime) { return ''; } $page < 1 && ($page = 1); $perpage < 1 && ($perpage = $this->perpage); $sqlLogService = ACloud_Sys_Core_Common::loadSystemClass('sql.log', 'config.service'); $result = $sqlLogService->getSqlLogsByTimestamp($startTime, $endTime, $page, $perpage); if (!ACloud_Sys_Core_S::isArray($result)) { return ''; } return $this->outputDataFlow($result); }
function call($api, $request) { $api = trim($api); if (!$api) { return $this->buildResponse(10000); } $apiConfigService = ACloud_Sys_Core_Common::loadSystemClass('apis', 'config.service'); $apiConfig = $apiConfigService->getApiConfigByApiName($api); if (!ACloud_Sys_Core_S::isArray($apiConfig)) { return $this->buildResponse(10001); } if (!$apiConfig['status']) { return $this->buildResponse(10002); } list($apiClass, $method, $arguments) = $this->getClassAndMethodAndArguments($apiConfig, $request); if (!$apiClass) { return $this->buildResponse(10003); } list($errorCode, $data) = call_user_func_array(array($apiClass, $method), $arguments); return $this->buildResponse($errorCode, $data); }
function sqlMulti($array, $strip = true) { if (!ACloud_Sys_Core_S::isArray($array)) { return ''; } $str = ''; foreach ($array as $val) { if (!empty($val) && ACloud_Sys_Core_S::isArray($val)) { $str .= ($str ? ', ' : ' ') . '(' . ACloud_Sys_Core_S::sqlImplode($val, $strip) . ') '; } } return $str; }
function replaceSql($sqlTemplate, $argumentValues, $fields) { preg_match_all('/\\{(\\w+)\\}/', $sqlTemplate, $matches); if (!ACloud_Sys_Core_S::isArray($matches)) { return ''; } $seg = $this->getRandString(4); $sql = preg_replace('/\\{(\\w+)\\}/', $seg . '{${1}}' . $seg, $sqlTemplate); foreach ($matches[0] as $k => $v) { $value = $v != '{fields}' ? is_array($argumentValues[$matches[1][$k]]) ? ACloud_Sys_Core_S::sqlImplode($argumentValues[$matches[1][$k]]) : $argumentValues[$matches[1][$k]] : $fields; $sql = str_replace($seg . $v . $seg, $value, $sql); } return $sql; }