예제 #1
0
 /**
  * 登录游戏
  *   
  * @param $params
  *    require   pid      -- platformid
  *    optional  anyfield  --头像等保存到 infos
  * @return 
  *    u      userid
  * 	  infos  map 玩家基本信息,头像
  *    a          玩家帐户信息,金币,宝石,经验
  *    accs   map 玩家相关数值信息
  *    t      server time
  */
 public function login($params)
 {
     $now = time();
     $params['at'] = $now;
     $data = TTGenid::genid($params, $new);
     $uid = $data['id'];
     $tu = new TTUser($uid);
     //if( 1 || $new ){
     if ($new) {
         //初始化用户信息
         $tu->initAccount();
     }
     $ret['infos'] = $data;
     $ret['u'] = $uid;
     $ret['a'] = $tu->getdata();
     $ret['s'] = 'OK';
     $cid = $tu->numch('_cid');
     $ret['cid'] = $cid;
     $data['_cid'] = $cid;
     TTGenid::save($data);
     $flashv = $params['fv'];
     if ($flashv) {
         $tu->putf('fv', $flashv);
     }
     $ret['t'] = time();
     $params['u'] = $uid;
     TTLog::record(array('m' => __METHOD__, 'tm' => $_SERVER['REQUEST_TIME'], 'intp1' => $new, 'u' => $uid, 'sp1' => $params['pid']));
     return $ret;
 }
예제 #2
0
파일: Tool.php 프로젝트: uning/mall-back
 /**
  * 清数据,输入  uid   u
  */
 public function clean($params)
 {
     $uid = $params['u'];
     $tu = new TTUser($uid);
     $ret['bitems'] = $tu->get(TT::ITEM_GROUP);
     $ret['bgoods'] = $tu->get(TT::GOODS_GROUP);
     $aid = $tu->getoid('advert', TT::OTHER_GROUP);
     $ret['aid'] = $aid;
     $ret['badverts'] = $tu->getbyid($aid);
     $ret['bcars'] = $tu->get(TT::CAR_GROUP);
     foreach ($ret['bitems'] as $item) {
         $itemids[] = $item['id'];
     }
     foreach ($ret['bgoods'] as $goods) {
         $goodsids[] = $goods['id'];
     }
     foreach ($ret['bcars'] as $car) {
         $carids[] = $car['id'];
     }
     $tu->remove($aid);
     $tu->remove($itemids);
     $tu->remove($goodsids);
     $tu->remove($carids);
     $ret['bua'] = $tu->getf(array(TT::MONEY_STAT, TT::GEM_STAT, TT::EXP_STAT, TT::COMPUTE_PONIT, TT::SHOP_NUM, TT::POPU, TT::GARAGE_STAT, TT::CAPACITY_STAT, TT::TASK_STAT, 'lastawardtime', 'continued'));
     //		$data = array( TT::MONEY_STAT,TT::GEM_STAT,TT::EXP_STAT,TT::COMPUTE_PONIT,TT::SHOP_NUM,TT::POPU,TT::GARAGE_STAT,TT::CAPACITY_STAT,TT::TASK_STAT,'lastawardtime','continued');
     //		$tu->mputf( $data );
     $tu->numch(TT::MONEY_STAT, 0 - $ret['bua']['money']);
     $tu->numch(TT::GEM_STAT, 0 - $ret['bua']['gem']);
     $tu->numch(TT::EXP_STAT, 0 - $ret['bua']['exp']);
     $tu->numch(TT::COMPUTE_PONIT, 0 - $ret['bua']['compute']);
     $tu->numch(TT::SHOP_NUM, 0 - $ret['bua'][TT::SHOP_NUM]);
     $tu->numch(TT::POPU, 0 - $ret['bua'][TT::POPU]);
     $tu->numch(TT::GARAGE_STAT, 0 - $ret['bua'][TT::GARAGE_STAT]);
     $tu->numch('lastawardtime', 0 - $ret['bua']['lastawardtime']);
     $tu->numch('continued', 0 - $ret['bua']['continued']);
     //        $data = array( TT::CAPACITY_STAT=>"3,2",TT::TASK_STAT=>'1' );
     //        $tu->mputf( $data );
     $tu->initAccount();
     $ret['aua'] = $tu->getf(array(TT::MONEY_STAT, TT::GEM_STAT, TT::EXP_STAT, TT::COMPUTE_PONIT, TT::SHOP_NUM, TT::POPU, TT::GARAGE_STAT, TT::CAPACITY_STAT, TT::TASK_STAT, 'lastawardtime', 'continued'));
     $ret['all'] = $tu->getAll();
     $ret['aitems'] = $tu->get(TT::ITEM_GROUP);
     $ret['agoods'] = $tu->get(TT::GOODS_GROUP);
     $ret['acras'] = $tu->get(TT::CAR_GROUP);
     $ret['aadverts'] = $tu->getbyid($aid);
     return $ret;
 }