Esempio n. 1
0
     */
    private function executionTime()
    {
        return microtime(true) - $this->executionTimeStart;
    }
}
spl_autoload_unregister(array('YiiBase', 'autoload'));
spl_autoload_register(function ($className) {
    if (strpos($className, 'RpcClient_') !== 0) {
        return false;
    }
    eval(sprintf('class %s extends TextRpcClient {}', $className));
});
spl_autoload_register(array('YiiBase', 'autoload'));
if (false) {
    $config = array('rpc_secret_key' => '769af463a39f077a0340a189e9c1ec28', 'User' => array('uri' => 'tcp://127.0.0.1:2201', 'user' => 'Optool', 'secret' => '{1BA09530-F9E6-478D-9965-7EB31A59537E}'), 'Item' => array('uri' => 'tcp://127.0.0.1:2201', 'user' => 'Optool', 'secret' => '{1BA09530-F9E6-478D-9965-7EB31A59537E}'), 'Order' => array('uri' => 'tcp://127.0.0.1:2201', 'user' => 'Optool', 'secret' => '{1BA09530-F9E6-478D-9965-7EB31A59537E}'));
    TextRpcClient::on('send', function ($data) {
        echo 'Send => ', $data, PHP_EOL;
    });
    TextRpcClient::on('recv', function ($data) {
        echo 'Recv <= ', $data, PHP_EOL;
    });
    TextRpcClient::config($config);
    //$test = RpcClient_Item_Iwc::instance();
    //var_export($test->getInventoryByWarehouses(array(100223,100002,100003,100006), array('BJ08','GZ07','SH05')));
    $test = RpcClient_User_Address::instance($config);
    //var_dump($test->getListByUid(5100));
    $test->getListByUid(5100, function () {
        var_dump(func_get_args());
    });
}
Esempio n. 2
0
<?php

require __DIR__ . '/../init.php';
\Model\Details::instance()->updateItemCount(3, 11, 3);
\Model\Details::instance()->testDbConnection();
\Model\Details::instance()->testLog();
\Model\Details::instance()->testRedis();
var_dump(\PHPClient\Text::inst('User')->setClass('Info')->getUserInfobyUid(5100));
var_dump(\PHPClient\Text::inst('User')->setClass('Address')->getListByUid(5100));
var_dump(\PHPClient\Text::inst('Example')->setClass('Example')->sayHello(5100));
var_dump(\PHPClient\Text::inst('Example')->setClass('Example\\C1')->fn(5100));
echo "--------\n";
var_dump(RpcClient_User_Address::instance()->getListByUid(5100));