master
ELF 5 years ago
parent 6920cecd99
commit 3af8fe116d

@ -57,7 +57,7 @@ class GameSourceService {
public function getChannelConfigFolder($zip, array $packData)
{
$appPath = $this->getIpaAppPath($zip);
return $appPath . '/TXChannel/' . Base62::encode(json_encode($packData));
return $appPath . '/TXChannel/' . Base62::encode(json_encode($packData, JSON_UNESCAPED_UNICODE));
}
public function getGameSourceUrl($gameSource)

@ -27,11 +27,18 @@ class Base62
return $chars;
}
public static function getSpecialChar($char, $default = null)
{
if ($default == null) {
$default = $char;
}
return $char == 'i' ? "ia" : ($char == '+' ? "ib" : ($char == '/' ? "ic" : $default));
}
public static function encode($string)
{
$encodes = self::getCharArray(self::ENCODES);
$bytes = self::stringToBytes($string);
$pos = 0;
$val = 0;
$result = [];
@ -40,21 +47,14 @@ class Base62
$pos += 8;
while ($pos > 5) {
$char = $encodes[$val >> ($pos -= 6)];
$result[] = (
$char == 'i' ? "ia" :
$char == '+' ? "ib" :
$char == '/' ? "ic" : $char
);
$encodeChar = self::getSpecialChar($char);
$result[] = $encodeChar;
$val &= ((1 << $pos) - 1);
}
}
if ($pos > 0) {
$char = $encodes[$val << (6 - $pos)];
$result[] = (
$char == 'i' ? "ia" :
$char == '+' ? "ib" :
$char == '/' ? "ic" : $char
);
$result[] = self::getSpecialChar($char);
}
return implode('', $result);
}
@ -72,8 +72,8 @@ class Base62
$char = $chars[++$i];
$char =
$char == 'a' ? 'i' :
$char == 'b' ? '+' :
$char == 'c' ? '/' : $chars[--$i];
($char == 'b' ? '+' :
($char == 'c' ? '/' : $chars[--$i]));
}
$val = ($val << 6) | $decodes[$char];
$pos += 6;

Loading…
Cancel
Save