Esempio n. 1
0
File: Show.php Progetto: hduwzy/test
 public function showsqlkey()
 {
     $sk = Flight::request()->getQuery('sk', '');
     $sk = '%' . implode('%', explode('|', $sk)) . '%';
     $sqlkey = Flight::db()->fetchAll('sql.sqldoc.sqlkey.select.sqlkey', array('sk' => $sk));
     $this->app->json($sqlkey);
 }
Esempio n. 2
0
function insert_param($param_info, $sk_id, $pname)
{
    $is_exsists = Flight::db()->fetchOne('sql.sqldoc.params.select.param', array('sk_id' => $sk_id, 'pname' => $pname));
    if (false === $is_exsists) {
        echo Flight::db()->errorMsg();
    }
    if (empty($is_exsists)) {
        $insert_data = array('sk_id' => $sk_id, 'param_name' => $pname, 'param_comments' => $param_info['comment'], 'required' => $param_info['required'], 'eg_val' => isset($param_info['eg_val']) ? $param_info['eg_val'] : '');
        $ret = Flight::db()->insert('sql.sqldoc.params.insert.param', $insert_data);
        if (false === $ret) {
            echo Flight::db()->errorMsg();
        }
        return Flight::db()->lastInsertId();
    }
    return 0;
}
Esempio n. 3
0
File: call.php Progetto: hduwzy/test
<?php

define('FLIGHT_ROOT', dirname(dirname(__DIR__)) . "/includes/flight");
define('BOOT_FILE', FLIGHT_ROOT . "/boot/boot.php");
require_once BOOT_FILE;
use rpc\Rpcclient;
use flight\Flight;
Flight::set('app.root', FLIGHT_ROOT);
$client = new Rpcclient();
$client->schema('tcp')->host('192.168.236.133')->port(7788);
// $client->call('test', array(1,2,3,4,5))->commit();
// for ($i=0; $i < 100000000; $i++) {
// }
$status = $client->remoteLog(100);
print_r($status);
// $client->close();
Esempio n. 4
0
<?php

require_once __DIR__ . '/vendor/autoload.php';
use flight\Flight;
Flight::set('app.name', 'sqldoc');
Flight::set('app.root', dirname(__FILE__));
Flight::set('flight.views.path', Flight::get('app.root') . "/views");
require Flight::get('app.root') . '/sysext/extend.php';
Flight::start();
?>


Esempio n. 5
0
 public function sig_child($fd, $events, $args)
 {
     $status = -1;
     date_default_timezone_set('Asia/Shanghai');
     while (($pid = \pcntl_waitpid(-1, $status, WNOHANG)) > 0) {
         foreach (Process::$child as $key => $value) {
             if ($value == $pid) {
                 unset(Process::$child[$key]);
                 foreach (Process::$alias as $key => $value) {
                     if ($pid == $value) {
                         unset(Process::$alias[$key]);
                     }
                 }
             }
         }
         Msgqueue::delQueue($pid);
         $log_file = Flight::conf()->get('cli.sys.rpc_logpath') . date('Y-m-d') . '.log';
         $spare_time = microtime(1) - $this->_spare_time[$pid];
         $spare_time = sprintf("%.2f", $spare_time);
         if (pcntl_wifexited($status)) {
             $exit_code = pcntl_wexitstatus($status);
             $log = date("H:i:s") . " exit({$exit_code}-{$pid}):" . json_encode($this->_runing_list[$pid]) . " {$spare_time}";
         } else {
             $exit_code = -1;
             $log = date("H:i:s") . " exit({$exit_code}-{$pid}):" . json_encode($this->_runing_list[$pid]) . " {$spare_time}";
         }
         $ret = `echo "{$log}" >> {$log_file}`;
         unset($this->_runing_list[$pid]);
         unset($this->_spare_time[$pid]);
         $this->handle();
     }
 }
Esempio n. 6
0
File: boot.php Progetto: hduwzy/test
<?php

define('ROOT', dirname(dirname(__DIR__)));
require_once ROOT . '/vendor/autoload.php';
use flight\Flight;
Flight::set('app.name', 'sqldoccli');
Flight::set('app.root', dirname(__FILE__));
Flight::set('app.confpath', ROOT . '/conf');
require_once ROOT . '/sysext/extend.php';
Esempio n. 7
0
File: sys.php Progetto: hduwzy/test
<?php

use flight\Flight;
return array('maxprocess' => 5, 'localhost' => '0.0.0.0', 'localport' => '7788', 'phpexe' => '/usr/bin/php', 'rpc_logpath' => Flight::get('app.root') . "/data/rpclog/");
Esempio n. 8
0
<?php

use flight\Flight;
$app = Flight::app();
$app->register('router', '\\sysext\\net\\Router', array(), function ($obj) use($app) {
    $obj->app = $app;
});
$app->register('request', '\\sysext\\net\\Request', array(), function ($obj) use($app) {
    $obj->app = $app;
});
$app->register('conf', '\\sysext\\app\\Conf', array(), function ($obj) use($app) {
    $obj->app = $app;
    $app->set('app.confpath', $app->get('app.root') . '/conf');
});
$app->register('cookie', '\\sysext\\net\\Cookie', array(), function ($obj) use($app) {
    $obj->app = $app;
});
$app->register('db', 'sysext\\db\\mysql\\Pdoex', array(), function ($obj) use($app) {
    $obj->app = $app;
});
$app->map('start', function () use($app) {
    $request = $app->request();
    $response = $app->response();
    $router = $app->router();
    if (ob_get_length() > 0) {
        $response->write(ob_get_clean());
    }
    ob_start();
    $app->handleErrors($app->get('flight.handle_errors'));
    if ($request->ajax) {
        $response->cache(false);
Esempio n. 9
0
<?php

define('FLIGHT_ROOT', dirname(dirname(__DIR__)) . "/includes/flight");
define('BOOT_FILE', FLIGHT_ROOT . "/boot/boot.php");
require_once BOOT_FILE;
use rpc\Rpcserver;
use rpc\Rpcmaster;
use flight\Flight;
use cli\proc\Process;
use cli\events\EventInterface;
Flight::set('app.root', FLIGHT_ROOT);
Process::init();
$server = new Rpcserver();
$server->schema('tcp')->host(Flight::conf()->get('cli.sys.localhost'))->port(Flight::conf()->get('cli.sys.localport'))->create();
$rpc_master = new Rpcmaster();
Process::onSysEvent($server->getSocket(), EventInterface::EV_READ, array($rpc_master, 'handle'));
Process::loop();