|
@@ -15,7 +15,7 @@ require_once (BASE_ROOT_PATH . "/helper/statistics_helper.php");
|
|
|
class mobileControl
|
|
|
{
|
|
|
//客户端类型
|
|
|
- protected $client_type_array = array('android', 'wap', 'wechat', 'ios', 'ajax', 'web');
|
|
|
+ private static $stClienTypes = array('android', 'wap', 'wechat', 'ios', 'ajax', 'web');
|
|
|
|
|
|
//列表默认分页数
|
|
|
protected $page_size;
|
|
@@ -42,8 +42,6 @@ class mobileControl
|
|
|
} else {
|
|
|
$this->cur_page = 1;
|
|
|
}
|
|
|
- $page = $this->cur_page;
|
|
|
- Log::record("curpage = {$page}",Log::DEBUG);
|
|
|
initpage($this->page_size, $this->cur_page);
|
|
|
$this->check_app_type();
|
|
|
statistics_helper::instance()->add_call($_GET);
|
|
@@ -81,15 +79,16 @@ class mobileControl
|
|
|
protected function check_app_type()
|
|
|
{
|
|
|
$client = strtolower(trim($_SERVER['HTTP_CLIENT_TYPE']));
|
|
|
- $version = trim($_SERVER['HTTP_CLIENT_VERSION']);
|
|
|
+ $client = strtolower($client);
|
|
|
|
|
|
+ $version = trim($_SERVER['HTTP_CLIENT_VERSION']);
|
|
|
if (empty($client)) {
|
|
|
$client = $_POST['client_type'];
|
|
|
} else {
|
|
|
$_SESSION['is_app'] = true;
|
|
|
}
|
|
|
|
|
|
- if (empty($client) || !in_array($client, $this->client_type_array)) {
|
|
|
+ if (empty($client) || !in_array($client, self::$stClienTypes)) {
|
|
|
$_SESSION['client_type'] = 'wap';
|
|
|
} else {
|
|
|
$_SESSION['client_type'] = $client;
|
|
@@ -126,11 +125,12 @@ class mobileControl
|
|
|
{
|
|
|
static $json_clients = array('android', 'ios');
|
|
|
|
|
|
- if(!is_null($type)) {
|
|
|
+ if(!empty($type)) {
|
|
|
$show_type = $type;
|
|
|
} else {
|
|
|
$show_type = $_SESSION['client_type'];
|
|
|
}
|
|
|
+ Log::record("show_type = {$show_type}",Log::DEBUG);
|
|
|
|
|
|
if (in_array($show_type, $json_clients))
|
|
|
{
|
|
@@ -181,14 +181,13 @@ class mobileControl
|
|
|
{
|
|
|
static $json_clients = array('android', 'ios');
|
|
|
|
|
|
- if(!is_null($type)) {
|
|
|
+ if(!empty($type)) {
|
|
|
$show_type = $type;
|
|
|
} else {
|
|
|
$show_type = $_SESSION['client_type'];
|
|
|
}
|
|
|
Log::record("show_type = {$show_type}",Log::DEBUG);
|
|
|
|
|
|
-
|
|
|
if (in_array($show_type, $json_clients))
|
|
|
{
|
|
|
joutput_data($data);
|