src/Topxia/MobileBundleV2/Controller/MobileAppController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Topxia\MobileBundleV2\Controller;
use AppBundle\System;
use Symfony\Component\HttpFoundation\Request;
class MobileAppController extends MobileBaseController
{
const API_VERSIN = '1.6.0';
public function indexAction(Request $request)
{
$userAgent = $request->headers->get('user-agent');
$clientType = $this->getClientType($userAgent);
$debug = 'debug';
$render = "TopxiaMobileBundleV2:ESMobile:main.index-{$debug}.html.twig";
if (!strpos($userAgent, 'kuozhi')) {
return $this->render($render, array('clientType' => 'pc'));
}
return $this->render($render, array('clientType' => $clientType));
}
public function versionAction(Request $request)
{
$code = $request->query->get('code', 'edusoho');
$userAgent = $request->headers->get('user-agent');
$clientType = $this->getClientType($userAgent);
$versionStr = $this->sendRequest('GET', "http://www.edusoho.com/version/{$code}-html5-main", array());
if (empty($versionStr)) {
return $this->createJson($request, array());
}
$main = (array) json_decode($versionStr);
if (isset($main['error'])) {
return $this->createJson($request, array());
}
$supportVersion = $main['support_version'];
if (strnatcasecmp(System::VERSION, $supportVersion) < 0) {
return $this->createJson($request, array());
}
$main['resource'] = $main[$clientType.'Url'];
unset($main['AndroidUrl']);
unset($main['iOSUrl']);
return $this->createJson($request, $main);
}
private function getClientType($userAgent)
{
$clientType = 'Android';
if (strpos($userAgent, 'iPhone') || strpos($userAgent, 'iPad')) {
$clientType = 'iOS';
} elseif (strpos($userAgent, 'Android')) {
$clientType = 'Android';
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。