public function tName($user, $talbeName = NULL) { $tableName = parent::tName($tableName); $key = is_numeric($user) ? $user : abs(crc32(trim($user))); $key = $key % self::TABLE_NUM; return $tableName . '_' . $key; }
/** * 跟据userId返回用户详细资料 * @param $userId * @return array */ public function findDetailById($userId) { $key = $userId % self::TABLE_NUM; $tableName = parent::tName() . '_' . $key; $data = $this->select("select * from {$tableName} where id={$userId}", $this->pk, 1); return $data; }