72 lines
2.1 KiB
PHP
72 lines
2.1 KiB
PHP
|
<?php
|
|||
|
class main extends MySQL{
|
|||
|
var $db; // Здесь объект для работы с MySQL
|
|||
|
var $id;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/* ----------------------------------------------------------------------
|
|||
|
30.10.2022
|
|||
|
Получаем список городов обитания
|
|||
|
---------------------------------------------------------------------- */
|
|||
|
function getCityWork(){
|
|||
|
$sql = 'SELECT `txt`, `id` FROM "city" WHERE `id` IN (SELECT `city_id` FROM `multiCity` WHERE `user_id`=' . $_SESSION['user_id'] . ')';
|
|||
|
return $this -> free_sql ( $sql );
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/* ----------------------------------------------------------------------
|
|||
|
02.06.2022
|
|||
|
Получаем информацию о пользователе
|
|||
|
---------------------------------------------------------------------- */
|
|||
|
|
|||
|
function get_user_info(){
|
|||
|
$a['id'] = $_SESSION['user_id'];
|
|||
|
return $this -> get_massiv( 'users', $a, 'json');
|
|||
|
}
|
|||
|
function get_user_option(){
|
|||
|
$a['user_id'] = $_SESSION['user_id'];
|
|||
|
return $this -> get_massiv( 'userOption', $a);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
function formatBytes( $bytes, $precision = 2 ) {
|
|||
|
$units = array( 'B', 'KB', 'MB', 'GB', 'TB' );
|
|||
|
$bytes = max( $bytes, 0 );
|
|||
|
$pow = floor( ( $bytes ? log ( $bytes ) : 0 ) / log( 1024 ) );
|
|||
|
$pow = min ( $pow, count( $units ) - 1 );
|
|||
|
return round ( $bytes, $precision ) . ' ' . $units[$pow];
|
|||
|
}
|
|||
|
|
|||
|
/* ----------------------------------------------------------------------
|
|||
|
09.06.2022
|
|||
|
Получаем историю заказов
|
|||
|
---------------------------------------------------------------------- */
|
|||
|
|
|||
|
function get_orders( $limit=20 ){
|
|||
|
$a['user_id'] = $_SESSION['user_id'];
|
|||
|
$this -> or_by_desc = 1;
|
|||
|
$orders = $this -> get_massiv( 'order', $a, 'id', $limit );
|
|||
|
unset( $db -> or_by_desc );
|
|||
|
|
|||
|
$count = count($orders);
|
|||
|
for ($i=0; $i < $count; $i++){
|
|||
|
$orders[$i]['t']=date("H:i d.m.Y", $orders[$i]['t']);
|
|||
|
unset($a);
|
|||
|
$a['id']=$orders[$i]['status'];
|
|||
|
$orders[$i]['status']=$this->get_val('order_status', $a, 'txt');
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return $orders;
|
|||
|
}
|
|||
|
}
|
|||
|
?>
|