Index.php
5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/**
* tpshop
* ============================================================================
* 版权所有 2015-2027 深圳搜豹网络科技有限公司,并保留所有权利。
* 网站地址: http://www.tp-shop.cn
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
* 不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* Author: 当燃
* Date: 2015-09-09
*/
namespace app\manager\controller;
use think\AjaxPage;
use think\Controller;
use think\Url;
use think\Config;
use think\Page;
use think\Verify;
use think\Db;
class Index extends Base {
public function index(){
//$this->pushVersion();
$act_list = session('act_list');
$menu_list = getMenuList($act_list);
$this->assign('menu_list',$menu_list);
$admin_info = getAdminInfo(session('manager_id'));
$order_amount = M('order')->where("order_status=0 and (pay_status=1 or pay_code='cod')")->count();
$this->assign('order_amount',$order_amount);
$this->assign('admin_info',$admin_info);
$this->assign('menu',getMenuArr());
return $this->fetch();
}
public function welcome(){
$this->assign('sys_info',$this->get_sys_info());
$today = strtotime("-1 day");
$count['stores'] = M('store')->where("1=1")->count();//商家数量
$count['isno_audit'] = M('store')->where("is_audit=0")->count();//商家数量
//$count['handle_order'] = M('order')->where("order_status=0 and (pay_status=1 or pay_code='cod')")->count();//待处理订单
//$count['new_order'] = M('order')->where("add_time>$today")->count();//今天新增订单
//$count['goods'] = M('goods')->where("1=1")->count();//商品总数
//$count['article'] = M('article')->where("1=1")->count();//文章总数
//$count['users'] = M('users')->where("1=1")->count();//会员总数
//$count['today_login'] = M('users')->where("last_login>$today")->count();//今日访问
//$count['new_users'] = M('users')->where("reg_time>$today")->count();//新增会员
//$count['comment'] = M('comment')->where("is_show=0")->count();//最新评论
$this->assign('count',$count);
return $this->fetch();
}
public function get_sys_info(){
$sys_info['os'] = PHP_OS;
$sys_info['zlib'] = function_exists('gzclose') ? 'YES' : 'NO';//zlib
$sys_info['safe_mode'] = (boolean) ini_get('safe_mode') ? 'YES' : 'NO';//safe_mode = Off
$sys_info['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone";
$sys_info['curl'] = function_exists('curl_init') ? 'YES' : 'NO';
$sys_info['web_server'] = $_SERVER['SERVER_SOFTWARE'];
$sys_info['phpv'] = phpversion();
$sys_info['ip'] = GetHostByName($_SERVER['SERVER_NAME']);
$sys_info['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') :'unknown';
$sys_info['max_ex_time'] = @ini_get("max_execution_time").'s'; //脚本最大执行时间
$sys_info['set_time_limit'] = function_exists("set_time_limit") ? true : false;
$sys_info['domain'] = $_SERVER['HTTP_HOST'];
$sys_info['memory_limit'] = ini_get('memory_limit');
$sys_info['version'] = file_get_contents(APP_PATH.'manager/conf/version.php');
$mysqlinfo = Db::query("SELECT VERSION() as version");
$sys_info['mysql_version'] = $mysqlinfo[0]['version'];
if(function_exists("gd_info")){
$gd = gd_info();
$sys_info['gdinfo'] = $gd['GD Version'];
}else {
$sys_info['gdinfo'] = "未知";
}
return $sys_info;
}
// 在线升级系统
public function pushVersion()
{
if(!empty($_SESSION['isset_push']))
return false;
$_SESSION['isset_push'] = 1;
error_reporting(0);//关闭所有错误报告
$app_path = dirname($_SERVER['SCRIPT_FILENAME']).'/';
$version_txt_path = $app_path.'/application/manager/conf/version.php';
$curent_version = file_get_contents($version_txt_path);
$vaules = array(
'domain'=>$_SERVER['SERVER_NAME'],
'last_domain'=>$_SERVER['SERVER_NAME'],
'key_num'=>$curent_version,
'install_time'=>INSTALL_DATE,
'serial_number'=>SERIALNUMBER,
);
$url = "http://service.tp-shop.cn/index.php?m=Home&c=Index&a=user_push&".http_build_query($vaules);
stream_context_set_default(array('http' => array('timeout' => 3)));
file_get_contents($url);
}
/**
* ajax 修改指定表数据字段 一般修改状态 比如 是否推荐 是否开启 等 图标切换的
* table,id_name,id_value,field,value
*/
public function changeTableVal(){
$table = I('table'); // 表名
$id_name = I('id_name'); // 表主键id名
$id_value = I('id_value'); // 表主键id值
$field = I('field'); // 修改哪个字段
$value = I('value'); // 修改字段值
M($table)->where("$id_name = $id_value")->save(array($field=>$value)); // 根据条件保存修改的数据
}
public function showimg(){
$img=I('img');
return "<img src='".urldecode($img)."'>";
}
}