Overview

Packages

  • None
  • WxRobot
    • Admin
    • Cmd
    • CoreFunctions
    • Exends
    • Install
    • Table
    • Uninstall
    • WxSDK

Classes

  • ErrorCode
  • PKCS7Encoder
  • Prpcrypt
  • SHA1
  • Weixin_BaseCore
  • WeiXin_SDK
  • Weixin_Template
  • WXBizMsgCrypt
  • WxRobot_Admin
  • WxRobot_Admin_Menu_Extends
  • WxRobot_Admin_Menu_Instro
  • WxRobot_Admin_Menu_Menu
  • WxRobot_Admin_Menu_Records
  • WxRobot_Admin_Menu_Reply
  • WxRobot_Admin_Menu_Setting
  • WxRobot_Admin_Menu_Statistics
  • WxRobot_Cmd
  • WxRobot_Cmd_Event
  • WxRobot_Cmd_Event_User
  • WxRobot_Cmd_Text
  • WxRobot_Extends
  • WxRobot_Install
  • WxRobot_Robot
  • WxRobot_SDK
  • WxRobot_Table_Extends
  • WxRobot_Table_Menu
  • WxRobot_Table_Records
  • WxRobot_Table_Reply
  • WxRobot_Uninstall
  • WxRobot_Wp
  • XMLParse

Functions

  • wx_admin_log
  • wx_is_xml
  • wx_notice_msg
  • wx_parse_xml
  • wx_random_big_pic
  • wx_random_small_pic
  • wx_request_array
  • wx_request_decode
  • wx_request_is_encode
  • wx_request_xml
  • wx_send_encode
  • Overview
  • Package
  • Class
  1: <?php
  2: /**
  3:  * WxRobot Admin
  4:  * 
  5:  * WP微信机器人后台菜单 - 统计页
  6:  *
  7:  * @author      midoks
  8:  * @category    Admin
  9:  * @package     WxRobot/Admin
 10:  * @since       5.3.0
 11:  */
 12: 
 13: if ( ! defined( 'ABSPATH' ) ) {
 14:     exit;
 15: }
 16: 
 17: /**
 18:  *  WxRobot_Admin_Menu_Statistics 通信记录统计类
 19:  */
 20: class WxRobot_Admin_Menu_Statistics{
 21: 
 22:     /**
 23:      * 初始化钩子和过滤
 24:      *
 25:      * return void
 26:      */
 27:     public function init(){
 28:         add_action('init', array($this, 'statistics_ajax'), 10);
 29:         add_action('admin_head', array(&$this, 'weixin_robot_menu_js'), 10);
 30:     }
 31: 
 32:     /**
 33:      * 菜单初始化
 34:      *
 35:      * @return void
 36:      */
 37:     public function menu(){
 38:         add_submenu_page('weixin-robot',
 39:             'weixin-robot', 
 40:             '微信机器人统计',
 41:             'manage_options',
 42:             'weixin-robot-statistics',
 43:             array($this, 'weixin_robot_statistics'));
 44:     }
 45: 
 46:     /**
 47:      * 传递ajax请求
 48:      * 
 49:      * @return echo json
 50:      */
 51:     public function statistics_ajax(){
 52:         if(!empty($_POST['page']) && $_POST['page'] == 'weixin-robot-statistics'){
 53:             echo($this->weixin_robot_count_ajax());
 54:         }
 55:     }
 56: 
 57:     /**
 58:      * 通过ajax获取各类型总数
 59:      *
 60:      * @return json
 61:      */
 62:     public function weixin_robot_count_ajax(){
 63:         $text       = WxRobot_Table_Records::instance()->weixin_get_msgtype_count('text');
 64:         $voice      = WxRobot_Table_Records::instance()->weixin_get_msgtype_count('voice');
 65:         $video      = WxRobot_Table_Records::instance()->weixin_get_msgtype_count('video');
 66:         $link       = WxRobot_Table_Records::instance()->weixin_get_msgtype_count('link');
 67:         $event      = WxRobot_Table_Records::instance()->weixin_get_msgtype_count('event');
 68:         $image      = WxRobot_Table_Records::instance()->weixin_get_msgtype_count('image');
 69:         $location   = WxRobot_Table_Records::instance()->weixin_get_msgtype_count('location');
 70: 
 71:         $list['text']       = $text;
 72:         $list['voice']      = $voice;
 73:         $list['video']      = $video;
 74:         $list['link']       = $link;
 75:         $list['event']      = $event;
 76:         $list['image']      = $image;
 77:         $list['location']   = $location;
 78:         return json_encode($list);
 79:     }
 80: 
 81:     /**
 82:      * 加载需要的js
 83:      *
 84:      * @return void
 85:      */
 86:     public function weixin_robot_menu_js(){
 87:         $url = WEIXIN_ROBOT_URL;
 88:         if(!empty($_GET['page']) && 'weixin-robot-statistics' == $_GET['page']){
 89:             echo '<script type="text/javascript" src="'.$url.'/assets/js/ichart.min.js"></script>';
 90:             echo '<script type="text/javascript" src="'.$url.'/assets/js/ichart.count.js"></script>';
 91:         }
 92:     
 93:     }
 94: 
 95:     /**
 96:      * 微信机器人统计页
 97:      */
 98:     public function weixin_robot_statistics(){
 99:         echo '<div class="wrap"><div class="metabox-holder">',
100:             '<div class="postbox"><h3>微信通信记录统计分析</h3><div id="canvasDiv1"></div></div></div></div>';
101:         do_action('weixin_midoks_push');
102:     }   
103: }
104: 
105: ?>
106: 
API documentation generated by ApiGen