| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <?php
- // +----------------------------------------------------------------------
- // | Fanwe 方维直播系统
- // +----------------------------------------------------------------------
- // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Author: 云淡风轻(1956838968@qq.com)
- // +----------------------------------------------------------------------
- class IndexAction extends AuthAction{
- //首页
- public function index(){
- //管理员的SESSION
- $adm_session = es_session::get(md5(conf("AUTH_KEY")));
- $adm_name = $adm_session['adm_name'];
- $adm_id = intval($adm_session['adm_id']);
-
- if(intval(app_conf('EXPIRED_TIME'))>0&&$adm_id!=0){
-
- $admin_logined_time = intval($adm_session['admin_logined_time']);
- $max_time = intval(conf('EXPIRED_TIME'))*60;
- if(NOW_TIME-$admin_logined_time>=$max_time)
- {
- es_session::delete((md5(conf("AUTH_KEY"))));
- $this->display();
- }
- }
-
- if($adm_id == 0)
- {
- //已登录
- $this->redirect(u("Public/login"));
- }else{
- $this->display();
- }
-
- }
-
- //框架头
- public function top()
- {
- $adm_session = es_session::get(md5(conf("AUTH_KEY")));
- $role_id = intval($adm_session['role_id']);
- $navs= get_admin_nav($role_id,$adm_session['adm_name']);
- $this->assign("navs",$navs);
- $this->assign("admin",$adm_session);
- $this->display();
- }
- //框架左侧
- public function left()
- {
- $adm_session = es_session::get(md5(conf("AUTH_KEY")));
- $adm_id = intval($adm_session['adm_id']);
- $role_id = intval($adm_session['role_id']);
- $navs= get_admin_nav($role_id,$adm_session['adm_name']);
- $nav_key = strim($_REQUEST['key']);
-
- $nav_group = $navs[$nav_key]['groups'];
- $this->assign("menus",$nav_group);
- $this->display();
- }
- //默认框架主区域
- public function main()
- {
- $adm_session = es_session::get(md5(conf("AUTH_KEY")));
- $this->assign("adm_session",$adm_session);
- $adm_id = intval($adm_session['adm_id']);
- $login_time = $GLOBALS['db']->getOne("SELECT login_time FROM ".DB_PREFIX."admin where id = $adm_id ");
- $h=to_date($login_time,"H");
- $login_time = to_date($login_time);
- $this->assign("login_time",$login_time);
- if($h<12){
- $greet ="上午好";
- }elseif($h<18){
- $greet ="下午好";
- }else{
- $greet ="晚上好";
- }
- $this->assign("greet",$greet);
- //$navs = require_once APP_ROOT_PATH."system/admnav_cfg.php";
- $role_id = intval($adm_session['role_id']);
- $navs= get_admin_nav($role_id,$adm_session['adm_name']);
- $this->assign("navs",$navs);
- if($navs['index']['groups']['index']['nodes'][0]['action'] == main){
- //待审核
- $register_count = M("User")->where("is_effect=0 and user_type=0 ")->count();
- $company_register_count = M("User")->where("is_effect=0 and user_type=1")->count();
- $this->assign("register_count",$register_count);
- $this->assign("company_register_count",$company_register_count);
- //认证
- $user_authentication=M("User")->where("is_authentication = 1 and is_effect=1 and is_robot = 0 ")->count();
- //$business_authentication=M("User")->where("is_authentication = 1 and is_effect=1 and user_type=1 ")->count();
- //$all_authentication=M("User")->where(" (user_type=0 or user_type=1) and is_authentication =1 and is_effect=1 and is_robot = 0")->count();
- //认证未通过
- $authentication_not_allow=M("User")->where("is_authentication = 3 and is_effect=1 and is_robot = 0 ")->count();
- $this->assign("user_authentica",$user_authentication);
- //$this->assign("business_authentica",$business_authentication);
- //$this->assign("all_authentica",$all_authentication);
- $this->assign("authentication_not_allow",$authentication_not_allow);
- //充值
- $pay_count = floatval($GLOBALS['db']->getOne("SELECT count(*) FROM ".DB_PREFIX."payment_notice where payment_id <>0"));
- $this->assign("pay_count",$pay_count);
- //普通用户
- $user_level=M("User")->where("is_authentication<>2 and is_effect=1 and is_robot = 0")->count();
- $this->assign("user_level",$user_level);
- //认证用户
- $authentication=M("User")->where("is_authentication=2 and is_effect=1 and is_robot = 0")->count();
- $this->assign("authentication",$authentication);
- //机器人
- $robot=M("User")->where("is_effect=1 and is_robot = 1")->count();
- $this->assign("robot",$robot);
- //会员总数
- $user_count=M("User")->where("is_effect=1")->count();
- $this->assign("user_count",$user_count);
- $is_live=M("Video")->where("live_in=1 or live_in = 3")->count(); //直播中
- $this->assign("is_live",$is_live);
- $is_playback=M("VideoHistory")->where("is_delete=0 and is_del_vod = 0 and room_type<>1")->count(); //保存的视频
- $this->assign("is_playback",intval($is_playback));
- //直播中视频观看人数
- $watch_number = intval($GLOBALS['db']->getOne("SELECT sum(watch_number) FROM ".DB_PREFIX."video where live_in=1"));
- $this->assign("watch_number",$watch_number);
- //统计在线人数
- $m_config = load_auto_cache("m_config");
- require_once(APP_ROOT_PATH . 'system/tim/TimApi.php');
- $api = createTimAPI();
- $show_online_user = 0;
- if($m_config['tim_identifier']&&!is_array($api)){
- $ret = $api->group_get_group_member_info($m_config['on_line_group_id'],0,0);
- $online_user = isset($ret['MemberNum'])?intval($ret['MemberNum']):0;//减去管理员本身
- $show_online_user = 1;
- $this->assign("online_user",$online_user);
- }
- $this->assign("show_online_user",$show_online_user);
- }
- $this->display();
- }
- //底部
- public function footer()
- {
- $this->display();
- }
-
- //修改管理员密码
- public function change_password()
- {
- $adm_session = es_session::get(md5(conf("AUTH_KEY")));
- $this->assign("adm_data",$adm_session);
- $this->display();
- }
- public function do_change_password()
- {
- $adm_id = intval($_REQUEST['adm_id']);
- if(!check_empty($_REQUEST['adm_password']))
- {
- $this->error(L("ADM_PASSWORD_EMPTY_TIP"));
- }
- if(!check_empty($_REQUEST['adm_new_password']))
- {
- $this->error(L("ADM_NEW_PASSWORD_EMPTY_TIP"));
- }
- if($_REQUEST['adm_confirm_password']!=$_REQUEST['adm_new_password'])
- {
- $this->error(L("ADM_NEW_PASSWORD_NOT_MATCH_TIP"));
- }
- if(M("Admin")->where("id=".$adm_id)->getField("adm_password")!=md5($_REQUEST['adm_password']))
- {
- $this->error(L("ADM_PASSWORD_ERROR"));
- }
- M("Admin")->where("id=".$adm_id)->setField("adm_password",md5($_REQUEST['adm_new_password']));
- save_log(M("Admin")->where("id=".$adm_id)->getField("adm_name").L("CHANGE_SUCCESS"),1);
- $this->success(L("CHANGE_SUCCESS"));
-
-
- }
-
- public function reset_sending()
- {
- $field = trim($_REQUEST['field']);
- if($field=='DEAL_MSG_LOCK'||$field=='PROMOTE_MSG_LOCK'||$field=='APNS_MSG_LOCK')
- {
- M("Conf")->where("name='".$field."'")->setField("value",'0');
- $this->success(L("RESET_SUCCESS"),1);
- }
- else
- {
- $this->error(L("INVALID_OPERATION"),1);
- }
- }
- /*
- * 网站数据统计
- */
- public function statistics(){
-
- //$user_count=M("User")->where("is_robot=0")->count();
- $user_count=M("User")->count();
- $no_effect=M("User")->where(" is_effect=0 or is_effect=2")->count(); //无效
- $is_effect=M("User")->where(" is_effect=1")->count(); //有效
- //认证
- $user_authentication=M("User")->where("is_authentication = 2 and user_type=0 and is_effect=1 and is_robot = 0")->count();
- $business_authentication=M("User")->where("is_authentication = 2 and user_type=1 and is_effect=1 and is_robot = 0")->count();
- $all_authentication=M("User")->where(" (user_type=0 or user_type=1) and is_authentication =2 and is_effect=1 and is_robot = 0")->count();
- if(defined('QK_TREE')&& QK_TREE == 1){
- //树苗订单
- $tree_order_count= M("QkTreeOrder")->count();
- $total_tree_order_money = M("QkTreeOrder")->sum('pay');
- $m_config = load_auto_cache('m_config');
- $diamonds_name = $m_config['diamonds_name'];
- $this->assign("diamonds_name",$diamonds_name);
- $this->assign("tree_order_count",$tree_order_count);
- $this->assign("total_tree_order_money",$total_tree_order_money);
- $this->assign("open_qk_tree",1);
- }
- //资金进出
- //线上充值
- $online_pay = floatval($GLOBALS['db']->getOne("SELECT sum(money) FROM ".DB_PREFIX."payment_notice where is_paid = 1 and payment_id>0 "));
- $this->assign("online_pay",$online_pay);
- //总计
- $total_usre_money = $online_pay;
- $this->assign("total_usre_money",$total_usre_money);
- $this->assign("user_count",$user_count);
- $this->assign("no_effect",$no_effect);
- $this->assign("is_effect",$is_effect);
- $this->assign("user_authentication",$user_authentication);
- $this->assign("business_authentication",$business_authentication);
- $this->assign("all_authentication",$all_authentication);
- $this->display();
- }
- public function main_weibo()
- {
- $adm_session = es_session::get(md5(conf("AUTH_KEY")));
- $this->assign("adm_session",$adm_session);
- $adm_id = intval($adm_session['adm_id']);
- $login_time = $GLOBALS['db']->getOne("SELECT login_time FROM ".DB_PREFIX."admin where id = $adm_id ");
- $h=to_date($login_time,"H");
- $login_time = to_date($login_time);
- $this->assign("login_time",$login_time);
- if($h<12){
- $greet ="上午好";
- }elseif($h<18){
- $greet ="下午好";
- }else{
- $greet ="晚上好";
- }
- $this->assign("greet",$greet);
- $navs = require_once APP_ROOT_PATH."system/admnav_cfg.php";
- $this->assign("navs",$navs);
- //待审核
- $register_count = M("User")->where("is_effect=0 and user_type=0 ")->count();
- $company_register_count = M("User")->where("is_effect=0 and user_type=1")->count();
- $this->assign("register_count",$register_count);
- $this->assign("company_register_count",$company_register_count);
- //认证
- $user_authentication=M("User")->where("is_authentication = 1 and is_effect=1 and user_type=0 and is_robot = 0 ")->count();
- $business_authentication=M("User")->where("is_authentication = 1 and is_effect=1 and user_type=1 ")->count();
- $all_authentication=M("User")->where(" (user_type=0 or user_type=1) and is_authentication =1 and is_effect=1 and is_robot = 0")->count();
- //认证未通过
- $authentication_not_allow=M("User")->where("is_authentication = 3 and is_effect=1 and user_type=0 and is_robot = 0 ")->count();
- $this->assign("user_authentica",$user_authentication);
- $this->assign("business_authentica",$business_authentication);
- $this->assign("all_authentica",$all_authentication);
- $this->assign("authentication_not_allow",$authentication_not_allow);
- //充值
- $pay_count = floatval($GLOBALS['db']->getOne("SELECT count(*) FROM ".DB_PREFIX."payment_notice where payment_id <>0"));
- $this->assign("pay_count",$pay_count);
- //普通用户
- $user_level=M("User")->where("is_authentication<>2 and is_effect=1 and is_robot = 0")->count();
- $this->assign("user_level",$user_level);
- //认证用户
- $authentication=M("User")->where("is_authentication=2 and is_effect=1 and is_robot = 0")->count();
- $this->assign("authentication",$authentication);
- //会员总数
- $user_count=M("User")->where("is_effect=1")->count();
- $this->assign("user_count",$user_count);
- $this->display();
- }
- }
- ?>
|