当前位置: 首页>>代码示例>>PHP>>正文


PHP TTLog::record方法代码示例

本文整理汇总了PHP中TTLog::record方法的典型用法代码示例。如果您正苦于以下问题:PHP TTLog::record方法的具体用法?PHP TTLog::record怎么用?PHP TTLog::record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TTLog的用法示例。


在下文中一共展示了TTLog::record方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pick

 /**
  * 捡钱并结算
  * @param $params
  *   require  u               -- 玩家id
  *            sid             -- shop id 不仅限于cinema
  * @return 
  *            s         --  OK
  */
 public function pick($params)
 {
     $uid = $params['u'];
     $sid = $params['sid'];
     $now = time();
     $tu = new TTUser($uid);
     $shop_obj = $tu->getbyid($sid);
     //		$ret['now'] = $now;  //for debug
     //		$ret['fnow'] = date( TM_FORMAT,$now );  //for debug
     //		$ret['bshopobj'] = $shop_obj;  //for debug
     //		$ret['fbshopobj'] = date( TM_FORMAT,$shop_obj['ctime'] );  //for debug
     if (!$shop_obj) {
         $ret['s'] = 'notexist';
         return $ret;
     }
     $item = ItemConfig::getItem($shop_obj['tag']);
     if (!$item) {
         $ret['s'] = 'itemnotexsit';
         return $ret;
     }
     if ($shop_obj['tag'] == '60102') {
         //电影院
         if ($now - $shop_obj['ctime'] < $item['selltime'] * 60) {
             //坐满30个才开映,再过2小时才放映结束
             $ret['s'] = 'time';
             return $ret;
         }
         $money = $item['sellmoney'];
         $shop_obj['ctime'] = $now;
     } elseif ($shop_obj['tag'] == '60103' || $shop_obj['tag'] == '60104') {
         //健身房和按摩店
         if ($now - $shop_obj['ctime'] < $item['settletime']) {
             //开业时间需满足一定条件才可以收钱
             $ret['s'] = 'time';
             return $ret;
         }
         $money = $item['sellmoney'];
         $shop_obj['ctime'] = $now;
     } elseif ($shop_obj['tag'] == '60105' || $shop_obj['tag'] == '60106') {
         //月巴克和8-11便利店
         if ($now - $shop_obj['ctime'] < 3600) {
             //开业1小时后就可以收钱,但最多只能积累6~9小时
             $ret['s'] = 'time';
             return $ret;
         }
         $gap = $now - $shop_obj['ctime'];
         $factor = floor($gap / 3600);
         $money = $factor * $item['sellmoney'];
         $shop_obj['ctime'] += $factor * 3600;
         if ($gap > $item['settletime']) {
             $money = floor($item['settletime'] / 3600) * $item['sellmoney'];
             //			    $shop_obj['ctime'] += floor( $gap/3600 ) * 3600;
             $shop_obj['ctime'] = $now;
         }
     }
     $tu->chMoney($money);
     $tu->puto($shop_obj, TT::CINEMA_GROUP);
     //		$ret['fashopobj'] = date( TM_FORMAT,$shop_obj['ctime'] );  //for debug
     //		$ret['ashopobj'] = $shop_obj;  //for debug
     TTLog::record(array('m' => __METHOD__, 'tm' => $_SERVER['REQUEST_TIME'], 'u' => $uid, 'intp1' => $money, 'sp1' => $shop_obj['ctime']));
     $ret['money'] = $money;
     $ret['s'] = 'OK';
     return $ret;
 }
开发者ID:uning,项目名称:mall-back,代码行数:72,代码来源:Cinema.php

示例2: _handle

 protected function _handle(&$req)
 {
     //just add method map here
     $method = $req['m'];
     $mypre = $method;
     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}");
         }
     }
     $log_method = array('Achieve.get' => 1, 'Achieve.finish' => 1, 'Advert.buy' => 1, 'Advert.set' => 1, 'Cinema.enter' => 1, 'Cinema.pick' => 1, 'Gift.send' => 1, 'Gift.accept' => 1, 'Man.update' => 1, 'UserController.login' => 1, 'UserController.precheckout' => 1, 'UserController.update_friends' => 1, 'UserController.enlarge_mall' => 1, 'ItemController.buy' => 1, 'ItemController.sale' => 1, 'CarController.buy' => 1, 'CarController.sale' => 1, 'CarController.go_goods' => 1, 'CarController.enlarge_garage' => 1, 'GoodsController.buy' => 1, 'GoodsController.remove' => 1, 'GoodsController.exhibit_goods' => 1, 'GoodsController.checkshop' => 1, 'GoodsController.checkout' => 1, 'TaskController.share' => 1, 'TaskController.request' => 1, 'TaskController.accept' => 1, 'TaskController.update' => 1, 'TaskController.finish' => 1, 'TaskController.get_award' => 1, 'Friend.dis_neighbor' => 1, 'Friend.invite_neighbor' => 1, 'Friend.accept_neighbor' => 1);
     $ret = $c->{$m}($req['p']);
     if ($this->_debug) {
         CrabTools::myprint($ret, REQ_DATA_ROOT . $mypre . '.resp');
     }
     if (!$ret) {
         $ret['s'] = "KO";
         $ret['msg'] = "{$cn}::{$m} return null";
     }
     if ($ret['s'] == 'OK') {
         if (array_key_exists($method, $log_method)) {
             TTLog::record(array('m' => $method, 'p' => json_encode($params)));
         }
     }
     return $ret;
 }
开发者ID:uning,项目名称:backend_common,代码行数:42,代码来源:JsonServer.php

示例3:

<?php

require_once 'ttserver/test_config.php';
//璁板綍鏃ュ織
$m = $_GET['m'];
if ($m) {
    $_GET['tm'] = $_SERVER['REQUEST_TIME'];
    TTLog::record($_GET);
}
开发者ID:uning,项目名称:mall-back,代码行数:9,代码来源:error.php

示例4: update_help

 /**
 * 更新帮助获取物品
 * @param
              tag 
              fid
 
 * @return  one or a array of help open objects
 */
 public function update_help($tag, $fid)
 {
     $oid = $this->getoid($tag, 'ho');
     $obj = $this->getbyid($oid);
     $now = $_SERVER['REQUEST_TIME'];
     $obj['help'][$fid] = $now;
     $obj['id'] = $oid;
     TTLog::record(array('s' => 'OK', 'm' => __METHOD__, 'tm' => $now, 'sp1' => $tag, 'intp1' => $fid));
     $this->puto($obj);
 }
开发者ID:uning,项目名称:mall-back,代码行数:18,代码来源:TTUser.php

示例5: items


//.........这里部分代码省略.........
     $mano = $tu->getbyid($id);
     $mean_gap = 20;
     $now = time();
     $mano['id'] = $id;
     $level = $tu->getLevel();
     if ($level > $conf['maxlevel']) {
         $ret['s'] = 'level';
         $ret['d'] = $mano;
         //return $ret;
     }
     if ($v && $mano[$step]['vtime'] > 0) {
         $ret['s'] = 'already';
         $ret['d'] = $mano;
         return $ret;
     }
     if ($d && $mano[$step]['dtime'] > 0) {
         $ret['s'] = 'already';
         $ret['d'] = $mano;
         return $ret;
         //
     }
     $award = array();
     if ($v) {
         $mano[$step]['vtime'] = $now;
         $m = $conf['v_money'];
         if ($m > 0) {
             $ret['money'] = $tu->chMoney($m);
             $award['money'] = $m;
         }
         $m = $conf['v_gem'];
         if ($m > 0) {
             $ret['gem'] = $tu->chGem($m);
             $award['gem'] = $m;
         }
         $m = $conf['v_exp'];
         if ($m > 0) {
             $ret['exp'] = $tu->addExp($m);
             $award['exp'] = $m;
         }
         $items = $conf['v_items'];
         if ($items) {
             foreach ($items as $item) {
                 $config = ItemConfig::getItem($item['tag']);
                 $idp = $item['idp'];
                 //					$item['id']=$uid.$idp;
                 unset($item['idp']);
                 $item['pos'] = 's';
                 if ($config['group'] == 'g') {
                     $item['num'] = $config['unitcout'];
                     $tu->puto($item, TT::GOODS_GROUP);
                 } else {
                     $tu->puto($item, TT::ITEM_GROUP);
                 }
                 $award['items'][] = $item;
             }
         }
         $tu->puto($mano);
         $ret['award'] = $award;
         $ret['s'] = 'OK';
         return $ret;
     }
     $mano[$step]['dtime'] = $now;
     $m = $conf['d_money'];
     if ($m > 0) {
         $ret['money'] = $tu->chMoney($m);
         $award['money'] = $m;
     }
     $m = $conf['d_gem'];
     if ($m > 0) {
         $ret['gem'] = $tu->chGem($m);
         $award['gem'] = $m;
     }
     $m = $conf['d_exp'];
     if ($m > 0) {
         $ret['exp'] = $tu->addExp($m);
         $award['exp'] = $m;
     }
     $items = $conf['d_items'];
     if ($items) {
         foreach ($items as $item) {
             $config = ItemConfig::getItem($item['tag']);
             $idp = $item['idp'];
             //			    $item['id']=$uid.$idp;
             unset($item['idp']);
             $item['pos'] = 's';
             if ($config['group'] == 'g') {
                 $item['num'] = $config['unitcout'];
                 $tu->puto($item, TT::GOODS_GROUP);
             } else {
                 $tu->puto($item, TT::ITEM_GROUP);
             }
             $award['items'][] = $item;
         }
     }
     $tu->puto($mano);
     TTLog::record(array('m' => __METHOD__, 'tm' => $_SERVER['REQUEST_TIME'], 'u' => $uid, 'intp1' => $step));
     $ret['s'] = 'OK';
     $ret['award'] = $award;
     return $ret;
 }
开发者ID:uning,项目名称:mall-back,代码行数:101,代码来源:Man.php

示例6: pick

 /**
  * 捡钱并结算
  * @param $params
  *   require  u               -- 玩家id
  *            sid             -- shop id 不仅限于cinema
  * @return 
  *            s         --  OK
  */
 public function pick($params)
 {
     $uid = $params['u'];
     $sid = $params['sid'];
     $now = time();
     $tu = new TTUser($uid);
     $shop_obj = $tu->getbyid($sid);
     //		$ret['now'] = $now;  //for debug
     //		$ret['fnow'] = date( TM_FORMAT,$now );  //for debug
     //		$ret['bshopobj'] = $shop_obj;  //for debug
     //		$ret['fbshopobj'] = date( TM_FORMAT,$shop_obj['ctime'] );  //for debug
     if (!$shop_obj) {
         $ret['s'] = 'notexist';
         return $ret;
     }
     $item = ItemConfig::getItem($shop_obj['tag']);
     if (!$item) {
         $ret['s'] = 'itemnotexsit';
         return $ret;
     }
     if ($now - $shop_obj['ctime'] < $item['mintime']) {
         //开业mintime后就可以收钱,但最多只能积累maxtime
         $ret['s'] = 'time';
         return $ret;
     }
     $gap = $now - $shop_obj['ctime'];
     $factor = floor($gap / $item['mintime']);
     $money = $factor * $item['sellmoney'];
     $shop_obj['ctime'] += $factor * $item['mintime'];
     if ($gap > $item['maxtime']) {
         $money = floor($item['maxtime'] / $item['mintime']) * $item['sellmoney'];
         $shop_obj['ctime'] = $now;
     }
     $tu->chMoney($money);
     $tu->puto($shop_obj, TT::CINEMA_GROUP);
     //		$ret['fashopobj'] = date( TM_FORMAT,$shop_obj['ctime'] );  //for debug
     //		$ret['ashopobj'] = $shop_obj;  //for debug
     TTLog::record(array('m' => __METHOD__, 'tm' => $_SERVER['REQUEST_TIME'], 'u' => $uid, 'intp1' => $money, 'sp1' => $shop_obj['ctime']));
     $ret['money'] = $money;
     $ret['s'] = 'OK';
     return $ret;
 }
开发者ID:uning,项目名称:mallb,代码行数:50,代码来源:Cinema.php

示例7: TTUser

$user = false;
$oid = 60102;
if ($linkid) {
    $tw = TT::LinkTT();
    $irec = $tw->getbyuidx('lid', $linkid);
    $pid = $irec['uid'];
    $sess = TTGenid::getbypid($pid);
    $user = new TTUser($sess['id']);
}
$new = 0;
if ($_REQUEST['new']) {
    $new = 1;
}
$mypid = $_REQUEST['xn_sig_user'];
$myid = TTGenid::getbypid($mypid);
TTLog::record(array('m' => 'help_open_shop', 'tm' => $_SERVER['REQUEST_TIME'], 'u' => $myid['id'], 'sp2' => $new, 'sp1' => $oid));
$sess = TTGenid::getbypid($pid);
$myuser = new TTUser($sess['id']);
$nowu = new TTUser($myid['id']);
if ($user) {
    $obj = $user->get_help($oid);
} else {
    $obj = $nowu->get_help($oid);
    $pid = $mypid;
    $user = $nowu;
}
?>
 <style>  
 
#content {
height: 700px;
开发者ID:uning,项目名称:mallb,代码行数:31,代码来源:cinema.php

示例8: _handle

 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;
 }
开发者ID:uning,项目名称:mallb,代码行数:74,代码来源:JsonServer.php

示例9: array

<?php

require_once '../config.php';
$linkid = $_REQUEST['linkid'];
$pid = $_REQUEST['pid'];
$ids = $_REQUEST['ids'];
$oid = $_REQUEST['oid'];
if ($pid && $ids && $linkid && $oid) {
    $tw = TT::LinkTT();
    $value = $tw->getbyuidx('lid', $linkid);
    if (!$value) {
        /*$value = array('linkid'=>$linkid,
        		'uid'=>$pid,
        		'date'=>date('Ymd'),
        		'geted'=> array(),
        		'ids' =>$_REQUEST['ids']*/
        //);
        $_REQUEST['geted'] = array();
        $_REQUEST['time'] = date('Ymd');
        $tw->put($_REQUEST);
        //print_r($_REQUEST);
        TTLog::record(array('m' => 'open_shop_invite', 'tm' => $_SERVER['REQUEST_TIME'], 'u' => $pid));
    }
}
header('Location: ' . RenrenConfig::$canvas_url . '?c=invite');
开发者ID:uning,项目名称:mallb,代码行数:25,代码来源:store_link.php

示例10: checkout


//.........这里部分代码省略.........
         ksort($gs);
         $shop =& $vvv['shop'];
         $curtime = $shop['ctime'];
         //可以售卖新商品时间
         $cgoods = array();
         $shop_changed = false;
         $shop_empty = true;
         foreach ($gs as $t => $g) {
             $gconfig = ItemConfig::getItem($g['tag']);
             if (!$gconfig) {
                 continue;
             }
             $ctime = $g['ctime'];
             //上次结算时间
             if ($curtime < $t) {
                 $curtime = $t;
             }
             //上架时间
             if ($curtime < $ctime) {
                 $curtime = $ctime;
             }
             if ($curtime < $g['stime']) {
                 $curtime = $g['stime'];
             }
             $gaps = self::getTimeRates($used_advert, $curtime, $now, $popu, $maxpopu, $total_width);
             foreach ($gaps as $k => $gr) {
                 //测试信息需要该索引值
                 //$snum = floor( $gr[0]/$gconfig['selltime']*$gr[1] );
                 $pertime = $gconfig['selltime'] / $gr[1] / $sconfig['gridWidth'];
                 $snum = floor($gr[0] / $pertime);
                 if ($snum >= $g['num']) {
                     //卖完了
                     $asnum = $g['num'];
                 } else {
                     $asnum = $snum;
                 }
                 if ($asnum == 0) {
                     break;
                 }
                 $ret['sell'][$g['tag']] += $asnum;
                 $sale_count += $asnum;
                 //记录销售份数,成就用
                 $income += $asnum * $gconfig['sellmoney'];
                 //sellmoney是单份物品的卖价
                 $g['num'] -= $asnum;
                 $curtime += floor($asnum * $pertime);
                 //
                 $g['ctime'] = $curtime;
                 $shop_changed = true;
                 $shop['ctime'] = $curtime;
                 if ($g['num'] == 0) {
                     //当前时间段卖光此箱货物,继续卖下一个货物
                     $cgoods[] = $g;
                     $selloutids[] = $g['id'];
                     unset($shop['goods'][$g['id']]);
                     break;
                     //跳出时间段循环,继续卖同一商店下一个上架时间的货物(在同一商店,同一时间上架但售卖顺序不同的货物,已在上架时微调成不同上架时间)
                 }
             }
             //foreach group
             if ($g['num'] != 0) {
                 $tu->puto($g, TT::GOODS_GROUP);
                 $shop_empty = false;
                 break;
                 //跳出上架时间循环,但是继续店铺循环,终止同一店铺的货物队列中其他货物的结算
             }
         }
         //foreach goods
         if ($shop_changed) {
             $shop['_s'] = 'goods';
             if ($shop_empty) {
                 $shop['_s'] = 'empty';
                 unset($shop['goods']);
             }
             $tu->puto($shop, TT::GOODS_GROUP, false);
         }
     }
     //foreach shop
     //总销售份数
     $now_sale_count = $tu->numch('total_count', $sale_count);
     //总销售额
     $now_total_sale = $tu->numch('total_sale', $income);
     //记录玩家每一种物品卖出量
     if ($ret['sell']) {
         foreach ($ret['sell'] as $gid => $num) {
             $tu->numch("sale_goods_{$gid}", $num);
         }
     }
     $ret['s'] = 'OK';
     $ret['income'] = $income;
     $ret['money'] = $tu->chMoney($income);
     $ret['t'] = $now;
     $ret['rids'] = $selloutids;
     $ret['total_width'] = $total_width;
     $ret['popu'] = $popu;
     $ret['maxpopu'] = $maxpopu;
     TTLog::record(array('m' => __METHOD__, 'u' => $uid, 'tm' => $_SERVER['REQUEST_TIME'], 'p' => json_encode($ret)));
     $tu->remove($selloutids);
     return $ret;
 }
开发者ID:uning,项目名称:mallb,代码行数:101,代码来源:GoodsController.php

示例11: unset

        if (array_key_exists($k, $value['invite']) && !$new) {
            unset($ids[$k]);
        } else {
            $value['invite'][$k] = $v;
        }
    }
    $_REQUEST['ids'] = $ids;
}
if (!$gid) {
    $gid = 0;
}
$_REQUEST['geted'] = array(0);
if ($pid) {
    $tw->put($value);
    $tw->put($_REQUEST);
    TTLog::record(array('m' => 'pub_invite', 'tm' => $_SERVER['REQUEST_TIME'], 'u' => $sess['id'], 'sp2' => $linkid, 'sp1' => $gid));
}
$sessionK = $_REQUEST['sessionK'];
$renren = new Renren();
$renren->session_key = $sessionK;
$renren->api_key = RenrenConfig::$api_key;
$renren->secret = RenrenConfig::$secret;
$renren->init($sessionK);
$noti = '<xn:name uid="' . $pid . '" linked="true"/><a href="' . RenrenConfig::$canvas_url . '">正在玩购物天堂,邀请你去帮他装货、卸货,顺便帮他抢几个客人</a>';
$idstr = '';
foreach ($_REQUEST['ids'] as $k => $id) {
    $idstr .= $k . ',';
}
$ids = substr($ids, 0, strlen($idstr) - 1);
$r = $renren->api_client->notifications_send($idstr, $noti);
header('Location: ' . RenrenConfig::$canvas_url . '?f=invite&noti=' . $r['result']);
开发者ID:uning,项目名称:mallb,代码行数:31,代码来源:store_invite.php

示例12: changeUser

    changeUser($pid);
}
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);
}
$type = $_REQUEST['type'];
$fid = $_REQUEST['fid'];
$pid = $_REQUEST['pid'];
$ot = $_REQUEST['ot'];
switch ($type) {
    case 1:
        shareGoldCoin($fid, $pid);
        break;
    case 2:
        shareTask($fid, $pid, $ot);
        break;
    case 3:
        ShareGift($fid, $pid, $ot);
        break;
    case 4:
        helpOpenShop($fid, $pid, $ot);
    default:
        break;
}
TTLog::record(array('m' => 'pub_feed', 'tm' => $_SERVER['REQUEST_TIME'], 'u' => $pid, 'sp2' => $ot, 'sp1' => $type));
开发者ID:uning,项目名称:mall-back,代码行数:30,代码来源:storeFeed.php

示例13: move

 /**
  * 移动
  * @param $params
  *  require u              --             user id
  *          d              --             item数组
  *                         id             --        type id(类型id)
  *                         pos            --        position information of items
  * @return 
  *                         s              --        OK ,or other fail
  *                                     notexsit ,不存在
  *				      gem
  */
 public function move($params)
 {
     $uid = $params['u'];
     $tu = new TTUser($uid);
     if ($tu->check_dup($params['_cid'], $ret)) {
         return $ret;
     }
     $index = 1;
     $ids = array();
     $pop = 0;
     $now = time();
     foreach ($params['d'] as $index => $row) {
         $item_obj = $tu->getbyid($row['id']);
         if (!$item_obj) {
             $ret['s'] = 'notexsit';
             $ret['index'] = $index;
             return $ret;
         }
         $item = ItemConfig::getItem($item_obj['tag']);
         if (!$item) {
             $ret['s'] = 'notexsit';
             $ret['index'] = $index;
             return $ret;
         }
         if ($item['type'] == 'ro' && $row['pos'] == 's') {
             //todo $tu 结算
             if ($item_obj['pos'] != 's') {
                 require_once 'GoodsController.php';
                 GoodsController::checkout($params);
                 $item_obj = $tu->getbyid($row['id']);
             }
             //*{//对货物尚未卖完的店面进行移动时要先单个结算,确定货物队列为空时才能移动
             if ($item_obj['_s'] == 'goods') {
                 $ret['error'] = 'notempty';
                 $ret['s'] = 'OK';
                 $ret['index'] = $index;
                 TTLog::record(array('m' => __METHOD__, 'tm' => $_SERVER['REQUEST_TIME'], 'u' => $uid, 'sp2' => 'movegoodsshop', 'shoptag' => $item_obj['tag'], 'sp1' => $item_obj['id']));
                 continue;
             }
         }
         if ($item['type'] != 'ro') {
             //改为不计算店面的人气
             if ($row['pos'] != 's' && $item_obj['pos'] == 's') {
                 $pop += $item['pop'];
                 if ($item['type'] == 'rs') {
                     //特殊店需从仓库摆出,结算时间为摆放时间
                     $row['ctime'] = $now;
                 }
             } else {
                 if ($row['pos'] == 's' && $item_obj['pos'] != 's') {
                     $pop -= $item['pop'];
                     if ($item['type'] == 'rs') {
                         //特殊店放入仓库结算时间需置零
                         unset($row['ctime']);
                     }
                 }
             }
         }
         foreach ($row as $k => $v) {
             $item_obj[$k] = $v;
         }
         $ret[$row['id']] = $item;
         $tu->puto($item_obj, '', false);
         //reduce a get op
     }
     if ($pop) {
         $popu = $tu->numch(TT::POPU, $pop);
     }
     if (!$ret['s']) {
         $ret['s'] = 'OK';
     }
     return $ret;
 }
开发者ID:uning,项目名称:mallb,代码行数:85,代码来源:ItemController.php

示例14: update_popu

 /**
  *update popula
  *$params  
  *     u     -- uid
  *     ids    --  itemids with popu
  *     popu    --  itemids with popu
  **/
 function update_popu($params)
 {
     $uid = $params['u'];
     $ids = $params['ids'];
     $tu = new ttuser($uid);
     $ret['oldpopu'] = $tu->getf(TT::POPU);
     $ret['s'] = 'OK';
     if (!$ids) {
         $tu->putf(TT::POPU, 0);
         $ret['newpopu'] = $tu->getf(TT::POPU);
         return $ret;
     }
     $items = $tu->getbyids($ids);
     $popu = 0;
     foreach ($items as $o) {
         $conf = ItemConfig::getItem($o['tag']);
         $popu += $conf['pop'];
     }
     $tu->putf(TT::POPU, $popu);
     $ret['newpopu'] = $tu->getf(TT::POPU);
     TTLog::record(array('m' => __METHOD__, 'u' => $uid, 'tm' => $_SERVER['REQUEST_TIME'], 'intp1' => $popu));
     return $ret;
 }
开发者ID:uning,项目名称:mallb,代码行数:30,代码来源:UserController.php

示例15: _handle

 protected function _handle(&$req)
 {
     //just add method map here
     $method = $req['m'];
     $mypre = $method;
     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}");
         }
     }
     $log_method = array('Achieve.finish' => 1, 'Advert.buy' => 1, 'Advert.set' => 1, 'Cinema.enter' => 1, 'Cinema.pick' => 1, 'Gift.send' => 1, 'Gift.accept' => 1, 'Man.update' => 1, 'UserController.update_friends' => 1, 'UserController.enlarge_mall' => 1, 'ItemController.buy' => 1, 'ItemController.sale' => 1, 'CarController.buy' => 1, 'CarController.sale' => 1, 'CarController.go_goods' => 1, 'CarController.enlarge_garage' => 1, 'CarController.buy_copolit' => 1, 'CarController.apply_copolit' => 1, 'GoodsController.checkout' => 1, 'Task.share' => 1, 'Task.request' => 1, 'Task.accept' => 1, 'Task.update' => 1, 'Task.finish' => 1, 'Task.get_award' => 1, 'Friend.dis_neighbor' => 1, 'HelpGet.award' => 1);
     try {
         $ret = $c->{$m}($req['p']);
     } catch (Exception $e) {
         $r['s'] = 'exc';
         $r['msg'] = $e->getMessage();
         $r['exce'] = $e->getTrace();
         error_log($method . ':' . $r['msg']);
         TTLog::record(array('s' => $ret['s'], 'm' => $method, 'tm' => $_SERVER['REQUEST_TIME'], 'p' => $this->_raw_reg));
     }
     if ($this->_debug) {
         CrabTools::myprint($ret, REQ_DATA_ROOT . $mypre . '.resp');
     }
     if (!$ret) {
         $ret['s'] = "KO";
         $ret['msg'] = "{$cn}::{$m} return null";
         TTLog::record(array('s' => 'rnull', 'm' => $method, 'tm' => $tm, 'p' => $this->_raw_reg));
     }
     $tm = $_SERVER['REQUEST_TIME'];
     if ($ret['s'] == 'OK') {
         if (array_key_exists($method, $log_method)) {
             TTLog::record(array('s' => 'OK', 'm' => $method, 'tm' => $tm, 'p' => $this->_raw_reg));
         }
     }
     //else{
     //	TTLog::record(array('s'=>$ret['s'],'m'=>$method,'tm'=>$tm,'p'=>$this->_raw_reg));
     //}
     return $ret;
 }
开发者ID:uning,项目名称:mall-back,代码行数:55,代码来源:test_server.php


注:本文中的TTLog::record方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。