コード例 #1
0
ファイル: core.member.php プロジェクト: hamily/sblack
 public function loadinit(&$aUser, $api = 1, $version = "1.0.0")
 {
     //首次登录
     if ($aUser['firstLogin'] == 1) {
         //设置mid缓存
         $cacheKey = Core_Keys::getOneBySitemid($aUser['sitemid'], $aUser['sid']);
         Loader_Memcached::stocache()->set($cacheKey, $mid, 3 * 24 * 3600);
         //设置在线信息
         Member::factory()->setOnline($aUser);
     }
     $aUser['gztime'] = Core_System::$gztime;
     $aUser['gzfile'] = Core_System::$gzfile;
     $aUser['sigRequest'] = Logs::encrypt(json_encode(array("mid" => $aUser['mid'], "sitemid" => $aUser['sitemid'], "api" => $api, "sid" => $aUser['sid'], 'version' => $version)));
     return (array) $aUser;
 }
コード例 #2
0
ファイル: member.php プロジェクト: hamily/sblack
 /**
  * 根据平台ID与站点ID获取用户信息
  *
  * @param {string} $sitemid 用户平台ID
  * @param {int}    $sid     站点ID
  * @param {bool}   $inCache 是否从缓存中获取
  *
  * @return array 
  */
 public function getOneBySitemid($sitemid, $sid = 1, $inCache = false)
 {
     $sid = Helper::uint($sid);
     $sitemid = Helper::uint($sitemid);
     if (!$sitemid || !$sid) {
         return array();
     }
     $mid = 0;
     $cacheKey = Core_Keys::getOneBySitemid($sitemid, $sid);
     //保存mid
     $mid = (int) Loader_Memcached::stocache()->get($cacheKey);
     if (!$mid) {
         $query = " SELECT mid FROM {$this->memberinfo} WHERE sitemid='{$sitemid}' AND sid={$sid} LIMIT 1 ";
         $result = Loader_Mysql::dbmaster()->getOne($query, MYSQL_ASSOC);
         $mid = isset($result['mid']) ? (int) $result['mid'] : 0;
         $mid && Loader_Memcached::stocache()->set($cacheKey, $mid, 3 * 24 * 3600);
     }
     return $mid ? $this->getOneById($mid, $inCache) : array();
 }