public static function getdb_by_platformid($platformid)
 {
     $userid = AutoIncIdGenerator::genid($platformid);
     if ($userid) {
         return ServerConfig::connect_shop_mysql($userid, 1);
     }
 }
Exemple #2
0
 /**
  * 登录游戏
  *   
  * @param $params
  *    require   pid      -- platformid
  *    optional  anyfield  --头像等保存到 infos
  * @return 
  *    u      userid
  * 	  infos  map 玩家基本信息,头
  *    accs   map 玩家相关数值信息
  */
 public function login($params)
 {
     $pid = $params['pid'];
     $uid = AutoIncIdGenerator::genid($pid);
     $db = ServerConfig::getdb_by_userid($uid);
     $ua = ModelFactory::UserAccount($db);
     $uin = ModelFactory::UserInfo();
     $uin->put($params, $uid);
     $ret['s'] = 'ok';
     $ret['infos'] = $uin->get($uid);
     $ret['u'] = $uid;
     return $ret;
 }
Exemple #3
0
 protected function _dispatch($method, $params = null, $source = null)
 {
     $content = $params[0];
     return parent::_dispatch($method, $params, $source);
     $auth = $content->auth;
     ServerConfig::setLang($content->lang);
     if ($content->platform_id != null) {
         $platform_id = $content->platform_id;
     } else {
         if ($content->user_id != null) {
             $user_id = $content->user_id;
             $platform_id = AutoIncIdGenerator::getPlatformId($user_id);
         }
     }
     $vk = new Vk($platform_id);
     if ($vk->auth($auth)) {
         return parent::_dispatch($method, $params, $source);
     }
     Logger::error('Method "' . $method . '" auth failed' . " sk={$session_key} platform_id={$platform_id} ");
     return array('status' => 'error', 'msg' => 'auth failed');
 }
Exemple #4
0
<?php

//用户授权应用后的回调
//使用user_profiles 中的intparam2来记录用户的状态, -1来表示用户删除应用,1表示用户授权应用
include "./header.php";
$platform_id = "renren" . $renren->user;
$session_key = $renren->session_key;
$user_id = AutoIncIdGenerator::genid($platform_id);
$db = ServerConfig::getdb_by_userid($user_id);
$up = ModelFactory::UserProfile($db);
$up->find($user_id);
$up->setAttr("intparam2", 1);
$up->setAttr("intparam1", time());
$up->save();
Exemple #5
0
<?php

$myloc = dirname(__FILE__);
require_once $myloc . '/bg/base.php';
require_once LIB_ROOT . 'ModelFactory.php';
require_once LIB_ROOT . 'AutoIncIdGenerator.php';
$platform_id = "302268025";
$pid = "renren302268025";
$user_id = AutoIncIdGenerator::genid($platform_id);
$p_user = AutoIncIdGenerator::genid($pid);
echo "user_id = {$user_id}\n";
echo "p_user = {$p_user}\n";