function inituser($fromid, $toid) { $otu = new TTUser($fromid); $tu = new TTUser($toid); $all = $otu->getAll(false); $allr = array(); $now = time(); foreach ($all as $k => $v) { $arr = explode(':', $k); $arr[0] = $toid; $nk = implode(':', $arr); $nv = $v; $isobj = TTExtend::checkObj($v); if ($isobj) { $v['id'] = $nk; if (isset($v['stime'])) { $v['stime'] = $now - 50; } if (isset($v['pos']['y'])) { $arr = explode(':', $v['pos']['y']); if (count($arr) > 1 && ($arr[0] = $toid)) { $arr[0] = $toid; $v['pos']['y'] = implode(':', $arr); } } $allr[$nk] = json_encode($v); } else { $allr[$nk] = $nv; } } $tt = TT::get_tt('main', $toid); $tt->put($allr); //print_r($tu->getAll()); }
function shareGoldCoin() { $key = $_POST['fid']; $obj = array('id' => $key, 'type' => 1, 'clickTime' => 0, 'count' => 0, 'rcv' => array()); $tt = TT::TTWeb(); $tt->puto($obj); changeUser(); }
/** * @param $data * @return unknown_type */ public static function record($data) { $t =& self::$_t; if ($t == null) { $t = TT::get_tt('log'); } $t->putCat(null, $data); }
function helpOpenShop($fid, $pid, $ot) { $obj = array('uid' => $pid, 'lid' => $fid, 'frd' => $_REQUEST['frd'], 'type' => 1, 'clickTime' => 0, 'count' => 0, 'oid' => $ot, 'date' => date('Ymd'), 'rcv' => array($pid => 1)); $tt = TT::LinkTT(); $id = $tt->put($obj); //print_r($tt->getbyuidx('lid',$fid)); changeUser($pid); }
static function test_TTExtend() { $t = TT::get_tt('web'); $oid = 'keyid1:o'; $data['id'] = $oid; $data['name'] = 'name'; $data['add'] = array('dff' => 'add', 2 => 3445); $str = '$id=$t->puto($data)'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $str = '$t->getbyid($id)'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $data = array(); $data['id'] = $oid; $data['name'] = 'new name'; $data['col'] = 'add new name'; $str = '$id=$t->puto($data,true)'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $str = '$t->getbyid($id)'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $str = '$id=$t->puto($data,false)'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $str = '$t->getbyid($id)'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $str = '$t->numch("add",1)'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $str = '$t->numch("add",1)'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $ids = array('add', ':d:df:new', $oid); $str = '$t->getbyids($ids)'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $t->put(':d:df:new', 'ddffffff'); $str = '$t->get("new")'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; $str = '$t->get("new")'; echo "{$str}="; eval('print_r( ' . $str . ');'); echo "\n"; }
public static function update($data, $id = null) { if ($id == null) { $id = $data['id']; } if ($id < 1) { return null; } $t =& self::$_t; if ($t == null) { $t = TT::get_tt('genid'); } $odata = $t->get($id); if (!$odata) { return null; } $newdata = array_merge($odata, $data); $t->put($id, $newdata); return $newdata; }
/** */ public function getid($data, $field = 'pid') { if (is_array($data)) { $key = $data[$field]; } else { $key = $data; $data = array($field => $key); } $t = TT::get_genidTT(); $q = $t->getQuery(); $q->addCond(self::IDX_F, TokyoTyrant::RDBQC_STREQ, $key); $res = $q->search(); if ($res) { foreach ($res as $k => $v) { $v['id'] = $k; return $v; } } $data[self::IDX_F] = $key; $data['id'] = $t->put(null, $data); return $id; }
public static function getbypid($pid) { $t =& self::$_t; if ($t == null) { $t = TT::get_tt('genid', 'slave'); } $q = $t->getQuery(); $q->addCond('pid', TokyoTyrant::RDBQC_STREQ, $pid); $res = $q->search(); if ($res) { foreach ($res as $k => $v) { $v['id'] = $k; return $v; } } }
/** * 使用副驾驶 * @param $params * require u -- user_id * tag -- 副驾驶类别 * cid -- car id * @return * s -- OK * tag -- 副驾驶tag * car -- 测试信息 * copi -- 测试信息 */ public function apply_copolit($params) { $uid = $params['u']; $tag = $params['tag']; $cid = $params['cid']; $copi = self::$_config[$tag]; $stat['tag'] = $tag; $stat['op'] = 'apply_copolit'; $stat['num'] = $num; $stat['u'] = $uid; $stat['tm'] = $_SERVER['REQUEST_TIME']; $gemt = TT::GemTT(); if (!$copi) { $ret['s'] = 'copinotexist'; $stat['s'] = $ret['s']; $gemt->putKeep(null, $stat); return $ret; } $tu = new TTUser($uid); $id = $tu->getoid('copilot', TT::OTHER_GROUP); $copilot = $tu->getbyid($id); $car_obj = $tu->getbyid($cid); if (!$car_obj) { $ret['s'] = 'carnotexsit'; $stat['s'] = $ret['s']; $gemt->putKeep(null, $stat); return $ret; } if ($tag != 2006 && $car_obj['copolitTag']) { $ret['s'] = 'repeat'; $stat['s'] = $ret['s']; $gemt->putKeep(null, $stat); return $ret; } $goods = ItemConfig::getItem($car_obj['goodsTag']); if ($tag != 2006) { if ($copilot['bag'][$tag] < 1) { $ret['s'] = 'needbuy'; $stat['s'] = $ret['s']; $gemt->putKeep(null, $stat); return $ret; } $copilot['bag'][$tag] -= 1; $car_obj['copolitTag'] = $tag; } else { if ($goods['buytime'] >= 1800) { $car = ItemConfig::getItem($car_obj['tag']); $add_exp = $goods['exp'] * $car['goodsNumber']; //乘以载重箱,经验不包括好友帮助增加的箱数 if ($add_exp) { $tu->addExp($add_exp); } } unset($car_obj['addgoods']); unset($car_obj['accelerate']); unset($car_obj['t']); unset($car_obj['help']); unset($car_obj['goodsTag']); unset($car_obj['copolitTag']); } $copilot['id'] = $id; $now = time(); $tu->puto($copilot); if ($copi['addgoods']) { $car_obj['addgoods'] += $copi['addgoods']; } if ($copi['accelerate'] && $car_obj['t']) { if ($now - $car_obj['t'] + $copi['accelerate'] > $goods['buytime']) { $car_obj['t'] = $now - $goods['buytime']; } else { $car_obj['t'] -= $copi['accelerate']; } } $tu->puto($car_obj); $ret['s'] = 'OK'; $ret['tag'] = $tag; $stat['s'] = $ret['s']; $gemt->putKeep(null, $stat); return $ret; }
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <?php require_once 'config.php'; $pid = $_REQUEST['pid']; if ($pid) { $sess = TTGenid::getbypid($pid); $u = $sess['id']; } $ot = TT::get_tt('order'); $q = $ot->getQuery(); if ($u) { $q->addCond('uid', TokyoTyrant::RDBQC_NUMEQ, $u); } else { $q->addCond('handledTime', TokyoTyrant::RDBQC_NUMGT, strtotime(date("Y-m-d"))); } $q->addCond('status', TokyoTyrant::RDBQC_NUMEQ, 1); // $q->setLimit(100); echo "<pre>"; $rets = $q->search(); $amount = 0; $cs = array(); foreach ($rets as $k => $ret) { $amount += $ret['amount']; if ($cs[$ret['amount']] === null) {
/** * 卖出 * @param $data (对应数据库的一条记录) * @param $num * @return */ public function saleItem(&$data, $num = 1) { $tag = $data['tag']; $stat['tag'] = $tag; $stat['num'] = $num; $stat['u'] = $this->_u; $stat['op'] = 'sale'; $stat['tm'] = $_SERVER['REQUEST_TIME']; $gemt = TT::GemTT(); $item = ItemConfig::getItem($tag); if (!$item || !isset($item['tag'])) { $ret['s'] = 'notfind'; $stat['s'] = $ret['s']; $gemt->putKeep(null, $stat); return $ret; } if ($item['onlygem'] == 'true') { //对用宝石购买的物品,按1:10000换成金币再3折 $num = $item['gem'] * 3000; } else { if ($item['group'] == 'g') { $num = $item['sellmoney'] * $item['unitcout'] * 0.3; } else { $num = $item['money'] * 0.3; } } $rnum = $this->numch(TT::MONEY_STAT, $num); $tusys = new TTUser(0); $statid = 'usalenum_' . $item['tag']; $saled = $tusys->numch($statid, $num); //记录系统回购每种商品总数 $ret['s'] = 'OK'; $ret['money'] = $rnum; $stat['money'] = $cnum; $stat['t'] = 'money'; $stat['s'] = $ret['s']; $gemt->putKeep(null, $stat); return $ret; }
</tr> </table> <table width="700px"> <?php require_once '../freeGift.php'; $gid = $_REQUEST["gift"]; $pid = $_REQUEST['pid']; $us = TTGenid::getbypid($pid); $exclude = "0"; $user = new TTUser($us['id']); $mode = 'all'; if (!$gid) { $mode = 'naf'; } //$key = date('Ymd').$pid; $tt = TT::LinkTT(); $feed = $tt->getbyuidx('uid', $pid); if ($feed) { $today = $feed['time']; $arr = '0'; if ($today == date('Ymd')) { foreach ($feed['invite'] as $k => $v) { $arr .= ',' . $k; } } } $linkid = uniqid(); $width = '740px'; $accept_url = RenrenConfig::$canvas_url . "accept.php?lid={$linkid}"; $content = '帮好友装货,卸货,在这里开电影院、盖厕所、做导购员,去好友那里抢客人,都在这里 !!<xn:req-choice url="' . $accept_url . '"label="赶快行动">'; //print_r($exclude);
// TT, because of "static". would be T, if it were "return new self" var_dump(TT::$hello); var_dump(TT::getParentHello()); var_dump(T::HELLO); var_dump(TT::HELLO); TT::getHelloConst(); // Notice: undefined var_dump($c->ewfiohoiwefh); // null //throw new Exception(); destructors won't run // fatal //var_dump((new T())->$hello); // works var_dump($c::$hello); var_dump($c3::$hello); // works (new T())->getHelloConst(); var_dump(TT::testConst()); // inherited // works, but E_STRICT T::test(); // can use null instead of TT $c->ca(null); // __PHP_Incomplete_class $zzz = unserialize('O:1:"A":0:{}'); var_dump($zzz); $cClone = clone $c; echo $cClone->getPrivate() . PHP_EOL; $c4 = clone $c3; $c3->modifyPrivate(); echo PHP_EOL;
<?php $myloc = dirname(__FILE__); require_once '../base.php'; echo "<pre>\n"; $now = time(); $datestr = date('Y-m-d', $now); $weekday = date('N', $now); $day_starttime = strtotime($datestr); $day_endtime = $day_starttime + 86400; $logt = TT::get_tt('debug'); $logt->needSV = false; $id = $logt->genUid(); echo "max : {$id}:\n"; #exit; $num = $logt->num(); $cont_no = 0; $end = $id; $vnum = $_REQUEST['num']; $u = $_REQUEST['u']; if (!$vnum) { $vnum = 50; } $start = $end - $vnum; if ($start < 1) { $start = 1; } for ($i = $id; $i > $start; --$i) { $data = $logt->get($i); if (!$data) { continue;
<?php require_once '../base.php'; $otu = new TTUser(2); $all = $otu->getAll(false); $now = time(); $tc = TT::get_tt('genid'); $num = $tc->num(); echo "init start from {$num}\n"; for ($i = $num + 1; $i < 300000; $i++) { $id = $tc->put(null, array('pid' => 'test' . $i, 'at' => $now)); $tt = TT::get_tt('main', $toid); $allr = array(); $tu = new TTUser($i); $toid = $i; foreach ($all as $k => $v) { $arr = explode(':', $k); $arr[0] = $toid; $nk = implode(':', $arr); $nv = $v; $isobj = TTExtend::checkObj($v); if ($isobj) { $v['id'] = $nk; if (isset($v['stime'])) { $v['stime'] = $now - 50; } if (isset($v['pos']['y'])) { $arr = explode(':', $v['pos']['y']); if (count($arr) > 1 && ($arr[0] = $toid)) { $arr[0] = $toid; $v['pos']['y'] = implode(':', $arr);
<?php class T { private $var = array(); public function add($a) { array_push($this->var, $a); } public function __destruct() { print_r($this->var); } } class TT extends T { } $t = new TT(); $t->add("Hello"); $t->add("World");
require_once 'config.php'; $data = array('uid' => 100, 'fid' => 12, 'gift_id' => 3); $pid = $_GET['fbid']; $session = TTGenid::getbypid($pid); $linkid = uniqid(); $tts = TT::TTweb(); $data['id'] = $linkid; $data['tm'] = time(); $tts->puto($data); print_r($tts->getbyid($linkid)); $giftid = $_GET['gid']; $fids = $_GET['fids']; $linkid = $_GET['linkid']; if ($fids) { $tts = TT::TTweb(); $data['id'] = $linkid; $data['tm'] = time(); $tts->puto($data); return; } if ($linkid) { } ?> <form > <input name='linkid' value='<?php echo uniqid(); ?> '/> <>
<?php $fromId = 0; $db = TT::LinkTT(); $time = date('Ymd'); file_put_contents('stat\\collect\\data', ""); $handler = fopen('ex.csv', 'a'); for ($index = $fromId;; ++$index) { $obj = $db->get($index); if ($obj) { if ($obj['date'] >= $time) { break; } $str = $obj['date'] . "," . $obj['type'] . ',' . $obj['clickTime'] . "\n"; fwrite($handler, $str); $db->remove($index); } else { break; } } fclose($handler);
<html> <head> </head> <body> <?php require_once '../config.php'; echo 'jklsajksadjkdkkdjd'; print_r($_REQUEST); $key = $_GET['key']; $tt = TT::TTWeb(); $value = $tt->get($key); $type = $value['type']; $type = 3; if ($type == 3 && $value['count'] > 0) { ?> <div class="padding_content center"> <div class="main_giftConfirm_cont"> <h3>You just accepted this Pine Tree</h3> <div class="gift_box_holder"> <div class="gift_box_cont"> <div class="giftConfirm_img"><img src="http://assets.frontierville.zynga.com/production/R.0.7.005.18240/assets/assets/trees/babypine_icon.png"></div> <div class="giftConfirm_name"><span>Pine Tree</span></div> </div> <div class="gift_from"><h3>From</h3></div> <div class="from_box_cont"> <div class="giftFrom_img"><img src="http://assets.frontierville.zynga.com/production/R.0.7.005.18240/assets/images/FV_Main_FriendBar_No_Profile_Img.png"></div> <div class="giftFrom_name"><span>雨农</span></div> </div> </div> </div> <div class="morePending_cont">
<?php $myloc = dirname(__FILE__); require_once $myloc . '/config.php'; $logt = TT::get_tt('log'); $num = $logt->num(); $tq = $logt->getQuery(); $tq->setLimit(1); $r = $tq->search(); foreach ($r as $k => $v) { $start = $k; break; } if (!$start) { die("no log start get "); } echo "start={$start} lognum = {$num}\n"; $mail_body .= "start={$start} lognum = {$num}\n"; $table = 'log_history'; $uhfname = $myloc . "/data/{$table}/{$weekday}.csv"; system("mkdir -p {$myloc}/data/{$table}/"); $uhf = fopen($uhfname, 'w') or die("open {$uhfname} failed"); $cont_no = 0; $end = $start + $num; $end = $logt->put(null, array('ad' => 1, 'add' => 2)); for ($i = $start; $i <= $end; ++$i) { try { $data = $logt->get($i); } catch (Exception $ee) { print_r($ee); }
require_once '../base.php'; echo "<pre>\n"; $u = $argv[1]; if (!$u) { $u = $_REQUEST['start']; } if (!$u) { $pid = $argv[2]; } if (!$u) { $pid = 1; } $page_num = 30; $e = $u + $page_num; $s = $u - $page_num; $tc = TT::get_tt('genid', 'slave'); $num = $tc->num(); echo "total users: {$num}\n"; if ($s >= 0) { echo "<a href='?start={$s}'>prev</a> | "; } if ($num > $u) { echo "<a href='?start={$e}'>next</a> | "; } $last = $num - $page_num + 10; echo "<a href='?start={$last}'>last</a> "; echo "<hr/>\n"; $pid = $_REQUEST['pid']; if ($pid) { $sess = TTGenid::getbypid($pid); $u = $sess['id'];
<?php ini_set('memory_limit', '1G'); $myloc = dirname(__FILE__); require_once $myloc . '/../../web/public/base.php'; require_once LIB_ROOT . 'DBModel.php'; $mail_body = "<pre>\n"; $gtt = TT::get_tt('genid', 0, 'slave'); $gttw = TT::get_tt('genid'); $now = time(); //$now -= 86400; $datestr = date('Y-m-d', $now); $weekday = date('N', $now); $day_starttime = strtotime($datestr); $day_endtime = $day_starttime + 86400; echo "date:{$datestr} \nweekday:{$weekday}\n"; $mail_body .= "date:{$datestr} \nweekday:{$weekday}\n"; require_once '../../web/renren/renren.php'; $ren = new Renren(); $ren->api_key = 'a32cb73bea154d2c9d40703b66dc9142'; $ren->secret = '023a6201a9b04955b1af79b1e9037c16'; $ren->init(); $dbconfig = array('host' => '127.0.0.1', 'username' => 'admin', 'password' => '123456', 'port' => '3307', 'charset' => 'utf8', 'dbname' => 'mall_stat'); $cmd = "mysql -u{$dbconfig['username']} -P{$dbconfig['port']} -h{$dbconfig['host']} "; if ($dbconfig['password']) { $cmd .= " -p'{$dbconfig['password']}'"; } $db = ServerConfig::connect_mysql($dbconfig); function getModel($name) { global $db;
if ($payment['status'] == 0) { if ($payment['sandbox'] == 'true' && $pid != '30578' && $pid != '253382225') { $ret['app_res_user'] = $pid; $ret['app_res_amount'] = $payment['amount']; $ret['app_res_order_id'] = $oid; echo json_encode($ret); } else { if ($user->chGem($payment['gem'])) { $payment['status'] = 1; $payment['handledTime'] = time(); $ot->put($oid, $payment); //│╔╣д║зих╗п //{"app_res_user":12345,"app_res_order_id":1000001,"app_res_amount":100} $ret['app_res_user'] = $pid; $ret['app_res_amount'] = $payment['amount']; $ret['app_res_order_id'] = $oid; $stat['t'] = 'gem'; $stat['u'] = $this->_u; $stat['op'] = 'pay'; $stat['tm'] = $_SERVER['REQUEST_TIME']; $gemt = TT::GemTT(); $stat['s'] = 'OK'; $gemt->putKeep(null, $stat); echo json_encode($ret); } else { $ret['app_res_code'] = "error gem"; echo json_encode($ret); exit; } } }
require_once '../config.php'; // $pid = $_REQUEST['xn_sig_user']; $gflg = $_REQUEST['glink']; if ($gflg) { $ts = TT::TTWeb(); $data = $ts->getbyid($gflg); $bids = $data['rfids']; if (strstr($bids, $pid)) { } else { //给玩家礼物 $flag = $data['gift_id']; $fconf = ItemConfig::get($flag); //取礼物信息 $tu = TT::TTUser($pid); // $bids .= ',' . $pid; } //$ts->puto($data); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xn="http://www.renren.com/2009/xnml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php //include FB_CURR.'/cs/check_connect_redirect.php'; ?> <link rel="stylesheet"href="<?php echo RenrenConfig::$resource_urlp;
public function test_tt() { $tu = new TTUser(1); $tt = TT::get_tt('main', 1); $id = $tu->getdid(TT::SHOP_NUM); $str = '$tu->numch(TT::SHOP_NUM,$shop_num)'; echo "{$str}="; record_time($st); eval('print_r( ' . $str . ');'); record_time($st, $str); echo "\n"; $shop_num = 10; $str = '$tu->numch(TT::SHOP_NUM,$shop_num)'; echo "{$str}="; record_time($st); eval('print_r( ' . $str . ');'); record_time($st, $str); echo "\n"; $shop_num = -10; $str = '$tu->numch(TT::SHOP_NUM,$shop_num)'; echo "{$str}="; record_time($st); eval('print_r( ' . $str . ');'); record_time($st, $str); echo "\n"; $tu->putf('strint', '0000'); $str = '$tu->getf("strint")'; echo "{$str}="; record_time($st); eval('print_r( ' . $str . ');'); record_time($st, $str); echo "\n"; $shop_num = -10; $str = '$tu->numch("strint",$shop_num)'; echo "{$str}="; record_time($st); eval('print_r( ' . $str . ');'); record_time($st, $str); echo "\n"; $shop_num = 10; $str = '$tu->numch("strint",$shop_num)'; echo "{$str}="; record_time($st); eval('print_r( ' . $str . ');'); record_time($st, $str); echo "\n"; $tt->put("strint", 'a'); $str = '$tt->get("strint")'; echo "{$str}="; record_time($st); eval('print_r( ' . $str . ');'); record_time($st, $str); echo "\n"; $str = '$tt->numch("strint",100)'; echo "{$str}="; record_time($st); eval('print_r( ' . $str . ');'); record_time($st, $str); echo "\n"; $str = '$tt->numch("strint",100)'; echo "{$str}="; record_time($st); eval('print_r( ' . $str . ');'); record_time($st, $str); echo "\n"; }
border-color:#D9DFEA #0E1F5B #0E1F5B #D9DFEA; border-style:solid; border-width:1px; color:white; font-size:12px; font-weight:bold; height:25px; margin:1px 5px; padding:3px 10px; text-decoration:none; } </style> <?php require_once 'pop/freeGift.php'; $linkid = $_REQUEST['lid']; $tw = TT::LinkTT(); $link = $tw->getbyuidx('lid', $linkid); $touser = $_REQUEST['xn_sig_user']; ?> <xn:if-is-app-user> <div id='is_install'></div> <?php $fromuser = $link['pid']; $fsess = TTGenid::getbypid($fromuser); $tsess = TTGenid::getbypid($touser); $ftu = new TTUser($fsess['id']); $ttu = new TTUser($tsess['id']); $att = $tsess['authat']; $ut = $tsess['ut']; $gemd = $tsess['gemd']; if ($link['gift']) {
protected function _handle(&$req) { //just add method map here $tm = $_SERVER['REQUEST_TIME']; $method = $req['m']; $mypre = $method; $log_nok = false; if (array_key_exists($method, self::$log_NOK_methods)) { $log_nok = true; } $req['p']['_cid'] = $req['cid']; $u = $req['p']['u']; if (!$log_nok) { if (check_dup($u, $req['cid'], $ret)) { TTLog::record(array('s' => 'dup', 'm' => $method, 'tm' => $tm, 'u' => $u, 'p' => $this->_raw_reg)); return $ret; } } if ($this->_debug) { CrabTools::mydump($req['p'], REQ_DATA_ROOT . $mypre . '.param'); } if (isset(self::$exist_methods[$method])) { $caller =& self::$exist_methods[$method]; $c =& $caller[0]; $m = $caller[1]; } else { $caller = explode('.', $method); $cn = $caller[0]; $m = $caller[1]; $file = CONTROLLER_ROOT . "{$cn}.php"; if (!file_exists($file)) { throw new JsonServerExecption("method {$method} file not exist:(" . CONTROLLER_ROOT . "{$cn}.php)"); } @(require_once $file); $c = new $cn(); if (!method_exists($c, $m)) { throw new JsonServerExecption("{$cn} don't has callable method {$m}"); } } try { $ret = $c->{$m}($req['p']); //for debug if (isset(self::$record_users[$u])) { $dt = TT::get_tt('debug'); $dt->needSV = true; $dt->put(array('m' => $method, 'tm' => $_SERVER['REQUEST_TIME'], 'in' => $req['p'], 'out' => $ret)); } if (!$u) { $u = 'nouser'; } } catch (Exception $e) { $r['s'] = 'exc'; $r['msg'] = $e->getMessage(); $r['exce'] = $e->getTrace(); error_log($method . ':' . $r['msg']); } if ($this->_debug) { CrabTools::myprint($ret, REQ_DATA_ROOT . $mypre . '.resp'); } if (!$ret) { $ret['s'] = "KO"; $ret['msg'] = "{$cn}::{$m} return null"; } if ($log_nok) { if ($ret['s'] != 'OK') { TTLog::record(array('s' => 'OK', 'm' => $method, 'tm' => $tm, 'u' => $u, 'p' => $this->_raw_reg)); } } else { if (!array_key_exists($m, self::$nolog_methods)) { TTLog::record(array('s' => $ret['s'], 'm' => $method, 'tm' => $tm, 'u' => $u, 'p' => $this->_raw_reg)); } } return $ret; }
function TTUDB($uid, $only_read = false, $name = 'main') { $this->_u = $uid; $this->type = $only_read ? 'slave' : 'master'; $this->_t = TT::get_tt($this->name, $this->_u, $this->type); }
public function getbyids($ids, $uid = null, &$t = null) { $id = $ids[0]; if (!$t && !$uid) { $idata = explode(':', $id, 4); if ($idata[0] > 0) { $uid = $idata[0]; } } if (!$uid) { throw new Exception("no uid set"); } if ($t == null) { $t = TT::get_tt($this->name, $uid, $this->type); } $ret = $t->get($ids); $res = array(); foreach ($ret as $k => $v) { $res[$k] = json_decode($v, true); } return $res; }