- Added comprehensive AI Assistant system (aiassist/ directory): * Vector search and embedding capabilities * Typebot proxy integration * Elastic search functionality * Message classification and chat history * MCP proxy for external integrations - Implemented Court Status API (GetCourtStatus.php): * Real-time court document status checking * Integration with external court systems * Comprehensive error handling and logging - Enhanced S3 integration: * Improved file backup system with metadata * Batch processing capabilities * Enhanced error logging and recovery * Copy operations with URL fixing - Added Telegram contact creation API - Improved error logging across all modules - Enhanced callback system for AI responses - Extensive backup file storage with timestamps - Updated documentation and README files - File storage improvements: * Thousands of backup files with proper metadata * Fix operations for broken file references * Project-specific backup and recovery systems * Comprehensive file integrity checking Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
84 lines
3.9 KiB
PHP
84 lines
3.9 KiB
PHP
<?php
|
||
/* +**********************************************************************************
|
||
* The contents of this file are subject to the vtiger CRM Public License Version 1.1
|
||
* ("License"); You may not use this file except in compliance with the License
|
||
* The Original Code is: vtiger CRM Open Source
|
||
* The Initial Developer of the Original Code is vtiger.
|
||
* Portions created by vtiger are Copyright (C) vtiger.
|
||
* All Rights Reserved.
|
||
* ***********************************************************************************/
|
||
|
||
function vtws_gethotelslist($region, $city, $from, $quantity, $user = false) {
|
||
$logstring = date('Y-m-d H:i:s').' - запрос по региону '.$region.', город: '.$city.', позиции с '.$from.' по '.$to.PHP_EOL;
|
||
file_put_contents('logs/GetHotelsList.log', $logstring, FILE_APPEND);
|
||
|
||
global $adb;
|
||
|
||
if(empty($region)){
|
||
throw new WebServiceException(WebServiceErrorCode::$INVALIDID,"Не указан регион");
|
||
}
|
||
|
||
if(empty($city)){
|
||
throw new WebServiceException(WebServiceErrorCode::$INVALIDID,"Не указан город");
|
||
}
|
||
|
||
if (empty($from)) {
|
||
$from = 0;
|
||
}
|
||
|
||
if (empty($quantity) or $quantity < 1) {
|
||
$quantity = $from + 100;
|
||
}
|
||
|
||
$output = [];
|
||
$query = 'select a.accountid, a.tickersymbol, a.email1, a.inn, a.website, ad.ship_street, cf.cf_2308 as stars, cf.cf_2425 as rating
|
||
from vtiger_account a
|
||
left join vtiger_crmentity e on e.crmid = a.accountid
|
||
left join vtiger_accountshipads ad on ad.accountaddressid = a.accountid
|
||
left join vtiger_accountscf cf on cf.accountid = a.accountid
|
||
where e.deleted = 0 and a.account_type = "Гостиница" and ad.ship_city = "'.$city.'" and ad.ship_state = "'.$region.'"
|
||
limit '.$from.', '.$quantity;
|
||
$result = $adb->pquery($query);
|
||
|
||
$output['count'] = $adb->num_rows($result);
|
||
if ($output['count'] == 0) {
|
||
$logstring = date('Y-m-d H:i:s').' - ничего не найдено'.PHP_EOL;
|
||
file_put_contents('logs/GetHotelsList.log', $logstring, FILE_APPEND);
|
||
} else {
|
||
$logstring = date('Y-m-d H:i:s').' - найдено отелей: '.$output['count'].PHP_EOL;
|
||
file_put_contents('logs/GetHotelsList.log', $logstring, FILE_APPEND);
|
||
for ($i=0; $i<$output['count']; $i++) {
|
||
$output[$i] = [];
|
||
$output[$i]['id'] = $adb->query_result($result, $i, 'accountid');
|
||
$output[$i]['name'] = $adb->query_result($result, $i, 'tickersymbol');
|
||
$output[$i]['email'] = $adb->query_result($result, $i, 'email1');
|
||
$output[$i]['inn'] = $adb->query_result($result, $i, 'inn');
|
||
$output[$i]['website'] = $adb->query_result($result, $i, 'website');
|
||
$output[$i]['address'] = $adb->query_result($result, $i, 'ship_street');
|
||
$output[$i]['stars'] = $adb->query_result($result, $i, 'stars');
|
||
$output[$i]['rating'] = $adb->query_result($result, $i, 'rating');
|
||
$output[$i]['images'] = [];
|
||
|
||
$query = 'select n.title, a.path, a.storedname, s.attachmentsid
|
||
from vtiger_senotesrel r
|
||
left join vtiger_notes n on n.notesid = r.notesid
|
||
left join vtiger_seattachmentsrel s on s.crmid = r.notesid
|
||
left join vtiger_attachments a on a.attachmentsid = s.attachmentsid
|
||
where (n.filetype = "image/png" or n.filetype = "image/jpeg") and n.folderid = 6 and r.crmid = '.$output[$i]['id'];
|
||
// n.folderid = 6 - это папка viewhotel, в которой лежат официальные фотки владельцев отелей
|
||
$images = $adb->pquery($query);
|
||
|
||
if ($adb->num_rows($images) > 0) {
|
||
for ($j=0; $j<$adb->num_rows($images); $j++) {
|
||
$output[$i]['images'][$j]['title'] = $adb->query_result($images, $j, 'title');
|
||
$output[$i]['images'][$j]['path'] = $adb->query_result($images, $j, 'path').$adb->query_result($images, $j, 'attachmentsid').'_'.$adb->query_result($images, $j, 'storedname');
|
||
}
|
||
}
|
||
}
|
||
|
||
$logstring = date('Y-m-d H:i:s').' - поиск картинок завершен'.PHP_EOL;
|
||
file_put_contents('logs/GetHotelsList.log', $logstring, FILE_APPEND);
|
||
}
|
||
|
||
return $output;
|
||
} |