function deleteAccountsIPTV($usersList) { if (!empty($usersList)) { # составим список для удаления $deleteList = array('username'); foreach ($usersList as $user) { $deleteList[] = $user; } // var_dump($deleteList); # удаление абонентских устройств акаунта "123456" $res = jsonRequest("delete", array("from" => "terminal", "where" => array("in" => array("subscriber_id", array("select" => array("data" => "id", "from" => "subscriber", "where" => array("in" => $deleteList))))))); // echo 'delete cmd result: '; // print_r($res); # удаление пакетов для акаунта "123456" $res = jsonRequest("delete", array("from" => "subscriber_package", "where" => array("in" => array("subscriber_id", array("select" => array("data" => "id", "from" => "subscriber", "where" => array("in" => $deleteList))))))); // echo 'delete cmd result: '; // print_r($res); # удаление аккаунта 123456 $res = jsonRequest("delete", array("from" => "subscriber", "where" => array("in" => $deleteList))); // echo 'delete cmd result: '; // print_r($res); } }
function servicesAdd($servicesAdd) { // jsonsql_call("delete", // array( // "from" => "package", // ) // ); $servicesMB2IPTV = array(); $serviceData = array(); foreach ($servicesAdd as $service) { # Если цена услуги 0 тогда - бесплатная if (isset($service['amount']) and $service['amount'] == '0') { $paid = false; } else { $paid = true; } $serviceData[] = array($service['servicename'], $paid); } # добавление пакетов if (!empty($servicesAdd)) { $result = jsonRequest("insert", array("into" => "package", "columns" => array("name", "paid"), "values" => $serviceData, "returning" => "id")); echo 'insert services result: '; #print_r($result); } # выбрать все услуги $servicesIPTV = getServicesIPTV(); }