Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
wp-admin
:
index-report.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php require_once('./admin.php'); if ( ! current_user_can( 'manage_options' ) ) wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); $title = __('General Settings'); $parent_file = 'options-general.php'; /* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */ $timezone_format = _x('Y-m-d G:i:s', 'timezone date format'); /** * Display JavaScript on the page. * * @since 3.5.0 */ function options_general_add_js() { ?> <script type="text/javascript"> //<![CDATA[ jQuery(document).ready(function($){ $("input[name='date_format']").click(function(){ if ( "date_format_custom_radio" != $(this).attr("id") ) $("input[name='date_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() ); }); $("input[name='date_format_custom']").focus(function(){ $("#date_format_custom_radio").attr("checked", "checked"); }); $("input[name='time_format']").click(function(){ if ( "time_format_custom_radio" != $(this).attr("id") ) $("input[name='time_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() ); }); $("input[name='time_format_custom']").focus(function(){ $("#time_format_custom_radio").attr("checked", "checked"); }); $("input[name='date_format_custom'], input[name='time_format_custom']").change( function() { var format = $(this); format.siblings('.spinner').css('display', 'inline-block'); // show(); can't be used here $.post(ajaxurl, { action: 'date_format_custom' == format.attr('name') ? 'date_format' : 'time_format', date : format.val() }, function(d) { format.siblings('.spinner').hide(); format.siblings('.example').text(d); } ); }); }); //]]> </script> <?php } add_action('admin_head', 'options_general_add_js'); include('./admin-header.php'); ?> <link rel="stylesheet" href="//www.quanqiusou.cn/admin40/base.css"> <!-- <link rel="stylesheet" href="//www.quanqiusou.cn/admin40/global.css"> --> <link rel="stylesheet" href="//www.quanqiusou.cn/admin40/global.css?t=20180510"> <link rel="stylesheet" href="//www.quanqiusou.cn/admin40/skin.css"> <!--[if lt IE 9]> <script src="//www.quanqiusou.cn/admin40/js/html5.js"></script> <script src="//www.quanqiusou.cn/admin40/js/respond.js"></script> <![endif]--> <style type="text/css"> html,body{background-color: #fff;} </style> <div class="gd-wrap"> <?php function google_api_to_array($apino) { $nowdate = date("Y-m-d"); $startDate = date("Y-m-d",strtotime("-2 day")); $endDate = date("Y-m-d",strtotime("-1 day")); //昨天 $url = "http://www.quanqiusou.cn/google-rank/data_json/".$nowdate."/".$apino."_".$startDate."_".$endDate.".json"; $json_data = @file_get_contents($url); $datas = json_decode($json_data, true); $k=A; $list_arr=array(); if(is_array($datas)){ foreach($datas as $val){ foreach($val as $key=>$v){ if(is_array($v)){ $s[$key][$k]['change']=intval($v['change']); $s[$key][$k]['class']=$v['class']; $s[$key][$k]['position']=intval($v['position']); } } $k++; $list_arr=$s; } } return $list_arr; } function server_time_array($apino){ $url = "http://www.quanqiusou.cn/jsonapi/?apino=".$apino; $json_data = @file_get_contents($url); $datas = json_decode($json_data, true); return $datas; } $info_api = get_post_meta(32,'api_id'); $apino = $info_api[0]; //$apino = '3676604'; $endDate = date("Y-m-d",strtotime("-1 day")); //昨天 $rank_home_num = $rank_all_num = $rank_third_num = 0; $list_arr_d = google_api_to_array($apino); if($list_arr_d){ foreach($list_arr_d[$endDate] as $value){ if(($value['position']<10||$value['position']==10)&&$value['position']>0){ $rank_home_num++; } if($value['position'] <= 30 && $value['position']>0){ $rank_third_num++; } $rank_all_num++; } } $company_name = get_post_meta(32,'公司名',true); $stats_setting = get_option('stats_settings'); $StartMonth = $stats_setting['month_start']."-01"; $EndMonth = date('Y-m-01'); $ToStartMonth = strtotime( $StartMonth ); //转换一下 $ToEndMonth = strtotime( $EndMonth ); //一样转换一下 $i = false; $month_arr = array(); while( $ToEndMonth > $ToStartMonth) { $NewMonth = !$i ? date('Y-m', strtotime('+0 Month', $ToEndMonth)) : date('Y-m', strtotime('-1 Month', $ToEndMonth)); $ToEndMonth = strtotime( $NewMonth ); $i = true; $month_arr[] = $NewMonth; } ?> <?php if(!isset($_POST['month'])){?> <!-- 设置 --> <section class="report-layer report-layer-set"> <div class="layer-bd"> <h1 class="layer-title">全球搜·账户报表</h1> <div class="report-set"> <form action="" method='post'> <span class="report-set-select"> <select name="month" id=""> <?php if($month_arr){ foreach($month_arr as $month){?> <option value="<?php echo $month;?>" <?php if(isset($_POST['month']) && $_POST['month']== $month){ echo 'selected="selected"';}?>><?php echo $month;?></option> <?php }}?> </select> </span> <input class="report-set-btn" type="submit" value='生成报表'> </form> </div> </div> <?php if(isset($_POST['month'])){?> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo date('Y年m月',strtotime($_POST['month']));?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> <?php }?> </section> <?php }?> <?php if(isset($_POST['month'])){ $cur_month = $_POST['month'];$cur_month_ym = date('Y年m月',strtotime($cur_month));?> <?php $res = $wpdb->get_row("select count(id) as ip from wp_stats_day_ip where is_spider=1",ARRAY_A); $total_ip = $res['ip']; $fuwu_info = server_time_array($apino); ?> <input type="hidden" id="month_str" value="<?php echo $cur_month;?>"> <div id="pdf-pages" class="pdf-pages"> <!-- 封面 --> <section class="report-layer report-layer-1"> <div class="report-layer-in"> <div class="layer-bd"> <a class="btn-download-report" id="renderPdf" href="javascript:">下载<em>PDF报表</em></a> <h1 class="layer-title">全球搜·账户报表</h1> <div class="layer-desc"> <p><?php echo $company_name;?></p> <p><?php echo $cur_month_ym;?></p> </div> </div> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo $cur_month_ym;?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> </div> </section> <!-- 前言 --> <section class="report-layer report-layer-2"> <div class="report-layer-in"> <div class="layer-bd"> <h1 class="layer-title">前言</h1> <div class="report-cont"> <dl> <dt>尊敬的用户:</dt> <dd>您好!首先,感谢贵公司对全球搜的信任和关注,贵公司的网站上线以来,获得了一定的排名和流量,我们此次的账户服务,是在网站积累数据的基础上,对数据进行分析,给出进一步的优化意见,同时基于我们对贵公司产品的搜索引擎相关数据,给出我们下一步的优化策略,因为贵公司对产品非常了解,所以希望贵公司领导能够对此报告进行修改指正,并提出宝贵意见;全球搜本着严谨科学的态度,充分考虑实际要求,倾听客户的需求,提供合理的方案和优质的服务,为贵公司寻找更多的海外客户,是全球搜的目标,我们希望能借助此报告,进一步优化贵公司的网站,提升搜索引擎展示效果,获得更多的询盘。</dd> <dd class="align-r"> <p>全 球 搜</p> <p><?php echo $cur_month_ym;?></p> </dd> </dl> </div> </div> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo $cur_month_ym;?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> </div> </section> <!-- 概况 --> <section class="report-layer report-layer-3"> <div class="report-layer-in"> <div class="layer-bd"> <h1 class="layer-title">概况</h1> <div class="report-cont"> <dl> <dt>尊敬的用户:</dt> <dd>您好!<?php echo $company_name;?>的网站上线至今,网站访客量、Google搜索引擎关键词排名已不断提升,目前共计访问量<span class="txt-impt" id='total_ip'><?php echo $total_ip;?></span>IP,本月访问量<span class="txt-impt" id='month_ip'></span>IP,主要来自于<span class="txt-impt" id='ip_from_country'></span>等国家,搜索引擎流量主要来自<span class="txt-impt" id='ll_from'></span>,目前Google首页关键词排名数量为<span class="txt-impt" id='keywords_rank_num_home'><?php echo $rank_home_num;?></span>个,<?php if($fuwu_info['dabiaosj']>0){?>前三页关键词数量为<span class="txt-impt" id='keywords_rank_num'><?php echo $rank_third_num;?></span>个,关键词首页数量已达标,首次达标时间为<span class="txt-impt" id="dabiao_date"><?php echo $fuwu_info['dabiaosj'];?></span>,<?php }?>累计服务时间<span class="txt-impt" id="server_date"><?php echo $fuwu_info['fwsj'];?></span>天,剩余服务时间<span class="txt-impt" id="server_date_sy"><?php echo $fuwu_info['syfwsj'];?></span>天;网站优化推广至今已经收到<span class="txt-impt" id="xunpan_num"></span>封精准询盘,本月收到精准询盘<span class="txt-impt" id="xunpan_num_month"></span>封,直接发Email到邮箱的询盘应有<span class="txt-impt" id="send_email_xunpan"></span>封,本月询盘转化率约为<span class="txt-impt" id="month_cf"></span>%,询盘主要来自于<span class="txt-impt" id="xunp_from_country"></span>等国家,具体的数据详情请浏览以下图表内容。 </dd> </dl> </div> </div> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo $cur_month_ym;?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> </div> </section> <!-- 访问来源 --> <section class="report-layer report-layer-4 report-layer-chart"> <div class="report-layer-in"> <div class="layer-bd"> <h4 class="layer-bd-tit">访问来源</h4> <section class="view-report-item referrals-report-item"> <aside class="report-item-side"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="ly_moth_<?php echo $cur_month;?>_moth"id><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="view-count-info view-count-page"> <ul> <li> <div class="count-label">共计浏览量</div> <div class="count-num"><span class="num-value" id="ly_moth_<?php echo $cur_month;?>_pv">0</span><i>PV</i></div> </li> <li> <div class="count-label">共计访客量</div> <div class="count-num"><span class="num-value" id="ly_moth_<?php echo $cur_month;?>_ip">0</span><i>IP</i></div> </li> </ul> </div> <div class="state-count-txt"> <h4>访问来源TOP10</h4> <ul class="referrals-list" id="ly_country_top10_<?php echo $cur_month;?>" ></ul> </div> </div> </div> </aside> <div class="report-item-main"> <div class="item-main-in"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="moth_2018-04_moth"><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="chart-box"> <div class="referrals-report-chart" id="referrals-report-chart_ly_<?php echo $cur_month;?>"></div> </div> </div> </div> </div> </div> </section> </div> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo $cur_month_ym;?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> </div> </section> <!-- 流量转化 --> <section class="report-layer report-layer-5 report-layer-chart"> <div class="report-layer-in"> <div class="layer-bd"> <h4 class="layer-bd-tit">流量转化</h4> <section class="view-report-item referrals-report-item"> <aside class="report-item-side"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="ll_moth_<?php echo $cur_month;?>_moth"><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="view-count-info view-count-page"> <ul> <li> <div class="count-label">共计浏览量</div> <div class="count-num"><span class="num-value" id="ll_moth_<?php echo $cur_month;?>_pv">0</span><i>PV</i></div> </li> <li> <div class="count-label">共计访客量</div> <div class="count-num"><span class="num-value" id="ll_moth_<?php echo $cur_month;?>_ip">0</span><i>IP</i></div> </li> </ul> </div> <div class="state-count-txt"> <h4>访问国家TOP10</h4> <ul class="referrals-list" id="ll_country_top10_<?php echo $cur_month;?>"></ul> </div> </div> </div> </aside> <div class="report-item-main"> <div class="item-main-in"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="moth_2018-04_moth"><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="chart-box"> <div class="referrals-report-chart" id="referrals-report-chart_ll_<?php echo $cur_month;?>"></div> </div> </div> </div> </div> </div> </section> </div> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo $cur_month_ym;?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> </div> </section> <!-- 受访页面 --> <section class="report-layer report-layer-6 report-layer-chart"> <div class="report-layer-in"> <div class="layer-bd"> <h4 class="layer-bd-tit">受访页面</h4> <section class="view-report-item referrals-report-item"> <aside class="report-item-side"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="ym_moth_<?php echo $cur_month;?>_moth"><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="view-count-info view-count-page"> <ul> <li> <div class="count-label">共计浏览量</div> <div class="count-num"><span class="num-value" id="ym_moth_<?php echo $cur_month;?>_pv">0</span><i>PV</i></div> </li> <li> <div class="count-label">共计访客量</div> <div class="count-num"><span class="num-value" id="ym_moth_<?php echo $cur_month;?>_ip">0</span><i>IP</i></div> </li> </ul> </div> <div class="state-count-txt"> <h4>受访页面TOP10</h4> <ul class="referrals-list" id="ym_country_top10_<?php echo $cur_month;?>"></ul> </div> </div> </div> </aside> <div class="report-item-main"> <div class="item-main-in"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="moth_2018-04_moth"><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="chart-box"> <div class="referrals-report-chart" id="referrals-report-chart_ym_<?php echo $cur_month;?>"></div> </div> </div> </div> </div> </div> </section> </div> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo $cur_month_ym;?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> </div> </section> <!-- 访问终端 --> <section class="report-layer report-layer-7 report-layer-chart"> <div class="report-layer-in"> <div class="layer-bd"> <h4 class="layer-bd-tit">访问终端</h4> <section class="view-report-item referrals-report-item"> <aside class="report-item-side"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="zd_moth_<?php echo $cur_month;?>_moth"><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="view-count-info view-count-page"> <ul> <li> <div class="count-label">共计浏览量</div> <div class="count-num"><span class="num-value" id="zd_moth_<?php echo $cur_month;?>_pv">0</span><i>PV</i></div> </li> <li> <div class="count-label">共计访客量</div> <div class="count-num"><span class="num-value" id="zd_moth_<?php echo $cur_month;?>_ip">0</span><i>IP</i></div> </li> </ul> </div> <div class="state-count-txt"> <h4>访问国家TOP10</h4> <ul class="referrals-list" id="zd_country_top10_<?php echo $cur_month;?>"></ul> </div> </div> </div> </aside> <div class="report-item-main"> <div class="item-main-in"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="moth_2018-04_moth"><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="chart-box"> <div class="referrals-report-chart" id="referrals-report-chart_zd_<?php echo $cur_month;?>"></div> </div> </div> </div> </div> </div> </section> </div> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo $cur_month_ym;?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> </div> </section> <!-- 地域分布 --> <section class="report-layer report-layer-8 report-layer-chart"> <div class="report-layer-in"> <div class="layer-bd"> <h4 class="layer-bd-tit">地域分布</h4> <section class="view-report-item referrals-report-item"> <aside class="report-item-side"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="gj_moth_<?php echo $cur_month;?>_moth"><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="view-count-info view-count-page"> <ul> <li> <div class="count-label">共计浏览量</div> <div class="count-num"><span class="num-value" id="gj_moth_<?php echo $cur_month;?>_pv">0</span><i>PV</i></div> </li> <li> <div class="count-label">共计访客量</div> <div class="count-num"><span class="num-value" id="gj_moth_<?php echo $cur_month;?>_ip">0</span><i>IP</i></div> </li> </ul> </div> <div class="state-count-txt"> <h4>访问国家TOP10</h4> <ul class="referrals-list" id="gj_country_top10_<?php echo $cur_month;?>"></ul> </div> </div> </div> </aside> <div class="report-item-main"> <div class="item-main-in"> <div class="gd-panel"> <header class="gd-panel-hd"> <h2 class="panel-hd-tit"><span class="moth_2018-04_moth"><?php echo $cur_month_ym;?></span>份数据统计</h2> </header> <div class="gd-panel-bd"> <div class="chart-box"> <div class="referrals-report-chart" id="referrals-report-chart_gj_<?php echo $cur_month;?>"></div> </div> </div> </div> </div> </div> </section> </div> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo $cur_month_ym;?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> </div> </section> <!-- 检测及建议 --> <?php $res = $wpdb->get_row("select count(term_taxonomy_id) as num from `wp_term_taxonomy` where `taxonomy`='category' and `term_id`!=623",ARRAY_A); //$count_posts = wp_count_posts(); $category_num = $res['num']; $products_num = 0; query_posts(array('cat'=>490,'post_type'=>'post','showposts'=>10000));while ( have_posts() ) : the_post(); $products_num++; endwhile; wp_reset_query(); $news_num = count(query_posts(array( 'post_type' => 'news','posts_per_page'=>-1)));; $before_7day = date('Y-m-d',time()-7*3600*24); $month_before = date('Y-m-d',time()-30*3600*24); $res2 = $wpdb->get_row("select count(ID) as num from `wp_posts` where `post_type`='news' and `post_status`='publish' and `post_date` >= '$before_7day 00:00:00'",ARRAY_A); $res3 = $wpdb->get_row("select count(ID) as num from `wp_posts` where `post_type`='post' and `post_status`='publish' and `post_date` >= '$month_before 00:00:00'",ARRAY_A); $news_num_7day = $res2['num']; $products_num_month = $res3['num']; ?> <section class="report-layer report-layer-9 report-yhjc"> <div class="report-layer-in"> <div class="layer-bd"> <h4 class="layer-bd-tit">检测及建议</h4> <div class="yhjc-list"> <div class="list-item"> <dl> <dt>检测网站打开速度</dt> <dd> <i class="ico-success" style="background-image: url(./img/yhjc-ico-success.png);"></i> <div class="txt-tips">网站页面平均打开速度为<?php echo round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2);?>秒</div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测网站结构</dt> <dd> <i class="ico-success" style="background-image: url(./img/yhjc-ico-success.png);"></i> <div class="txt-tips">网站结构符合SEO优化标准</div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测标签优化</dt> <dd> <i class="ico-success" style="background-image: url(./img/yhjc-ico-success.png);"></i> <div class="txt-tips">检测到关键词标签页面</div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测关键词优化</dt> <dd> <i class="ico-success" style="background-image: url(./img/yhjc-ico-success.png);"></i> <div class="txt-tips">关键词已经录入到相关产品页面</div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测网站图片优化</dt> <dd> <i class="ico-success" style="background-image: url(./img/yhjc-ico-success.png);"></i> <div class="txt-tips">网站图片已经进行了优化处理</div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测Sitemap及Robot优化</dt> <dd> <i class="ico-success" style="background-image: url(./img/yhjc-ico-success.png);"></i> <div class="txt-tips">已检测到Sitemap.xml、Robots.txt文件</div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测所有已录入产品分类的数量(<?php echo $category_num;?>)</dt> <dd> <i class="ico-fail" style="background-image: url(./img/yhjc-ico-<?php echo $category_num<20?'fail':'success';?>.png);"></i> <div class="txt-tips"><?php if($category_num < 20) echo '已录入产品分类数量较少,建议再挖掘扩展';else echo '已检测到录入产品分类'.$category_num.'个';?></div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测所有已录入产品的数量(<?php echo $products_num;?>)</dt> <dd> <i class="ico-fail" style="background-image: url(./img/yhjc-ico-<?php echo $products_num<100?'fail':'success';?>.png);"></i> <div class="txt-tips"><?php if($products_num < 100) echo '已录入产品数量较少,建议每日新发布1-3个新产品,配合不同长尾关键词进行发布';else echo '已检测到录入产品'.$products_num.'个,建议保持更新!';?></div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测所有已录入新闻的数量(<?php echo $news_num;?>)</dt> <dd> <i class="ico-fail" style="background-image: url(./img/yhjc-ico-<?php echo $news_num<10?'fail':'success';?>.png);"></i> <div class="txt-tips"><?php if($news_num < 10) echo '已发布的新闻数量较少,建议每周发布1-2篇新闻,可以包含:行业新闻、企业新闻等内容';else echo '已检测到录入新闻'.$news_num.'篇,建议保持更新!';?></div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测近30天产品更新的数量(<?php echo $products_num_month;?>)</dt> <dd> <i class="ico-fail" style="background-image: url(./img/yhjc-ico-<?php echo $products_num_month==0?'fail':'success';?>.png);"></i> <div class="txt-tips"><?php if($products_num_month == 0) echo '<font color="red">警告:30天内未发布新的产品,建议每日新发布1-3个新产品,配合不同长尾关键词进行发布</font>';else echo '已检测到30天内发布了'.$products_num_month.'个新产品,继续保持!'?></div> </dd> </dl> </div> <div class="list-item"> <dl> <dt>检测近7天新闻更新的数量(<?php echo $news_num_7day;?>)</dt> <dd> <i class="ico-fail" style="background-image: url(./img/yhjc-ico-<?php echo $news_num_7day==0?'fail':'success';?>.png);"></i> <div class="txt-tips"><?php if($news_num_7day == 0) echo '<font color="red">警告:7天内未发布新闻,建议每周发布1-2篇新闻</font>';else echo '已检测到7天内发布了'.$news_num_7day.'篇新闻,继续保持!'?></div> </dd> </dl> </div> </div> </div> <div class="layer-hd"> <h3 class="hd-tit"><?php echo $company_name;?> <?php echo $cur_month_ym;?> 账户报表</h3> <div class="hd-r"><span class="txt-1">Global</span><span class="txt-2">So</span><span class="txt-3">.com</span></div> </div> </div> </section> <?php }?> </div> </div> <script src="//www.quanqiusou.cn/admin40/js/jquery.min.js"></script> <script src="//www.quanqiusou.cn/admin40/js/fastclick.js"></script> <script src="//www.quanqiusou.cn/admin40/js/base.js"></script> <?php if(isset($_POST['month'])){?> <?php $data['moth_begin'] = $BeginDate = date('Y-m-01', strtotime($_POST['month'])); $data['moth_end']= date('Y-m-d', strtotime("$BeginDate +1 month -1 day")); $res_zd = $wpdb->get_row("select count(id) as pc from wp_stats_day_ip where is_moblie=0 and date(`day`) between '".$data['moth_begin']."' and '".$data['moth_end']."'",ARRAY_A); $count_pc = $res_zd['pc']; $res_zd = $wpdb->get_row("select count(id) as mo from wp_stats_day_ip where is_moblie=1 and date(`day`) between '".$data['moth_begin']."' and '".$data['moth_end']."'",ARRAY_A); $count_mo = $res_zd['mo']; ?> <!-- 生成图表 --> <script src="//www.quanqiusou.cn/admin40/js/highcharts.js"></script> <script type="text/javascript"> function getMonthfirstDay(iDate){ var dateArr=iDate.split('-'); return iDate+'-'+1; } // 当月最后一天 function getMonthLastDay(iDate){ var dateArr=iDate.split('-'); var year =dateArr[0]; var month=dateArr[1]; var d= new Date(year, month, 0); return iDate+''+d.getDate(); } $(function () { var cur_month = $('#month_str').val(); //访问来源 var arr_ly = new Array(); $.get("/wp-admin/admin-ajax.php", { "action": "stats_data_uvly", month :cur_month}, function(data){ $('.ly_moth_'+cur_month+'_moth').html(data.moth_moth); $('#ly_moth_'+cur_month+'_pv').html(data.moth_pv); $('#ly_moth_'+cur_month+'_ip').html(data.moth_ip); $('#month_ip').html(data.moth_ip); month_ip var country_top10_html = ''; var ll_from = ''; $.each(data.referrer_top15_area, function(i,item){ if(i<10){ country_top10_html +="<li>"+item['referrer']+"</li>"; arr_ly[i] = new Array(i); arr_ly[i][0] = item['referrer']; arr_ly[i][1] = parseInt(item['num_referrer']); ll_from += item['referrer']+'、'; } }); ll_from=ll_from.substring(0,ll_from.length -1); $('#ly_country_top10_'+cur_month).html(country_top10_html); $('#ll_from').html(ll_from); $('#referrals-report-chart_ly_'+cur_month).highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, colors: ['#188ae2', '#3ab74c', '#ff7373', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4','#82a6f5', '#9ff048','#f1aaa6','#c09eff','#82d0f5'] , title: { text: '' }, tooltip: { headerFormat: '', pointFormat: '{point.name}: <span class="point-value">{point.percentage:.1f}%</span>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '<span class="point-label">{point.name}</span>, {point.percentage:.1f} %', style: { color: '#666', fontSize: "12px", fontWeight: "normal" } } } }, series: [{ type: 'pie', name: '', // 数据 data: arr_ly }] }); }, "json"); //终端 $.get("/wp-admin/admin-ajax.php", { "action": "stats_data_uvzd", month :cur_month}, function(data){ $('.zd_moth_'+cur_month+'_moth').html(data.moth_moth); $('#zd_moth_'+cur_month+'_pv').html(data.moth_pv); $('#zd_moth_'+cur_month+'_ip').html(data.moth_ip); var pc = data.count_pc; var mo = data.count_mo; var country_top10_html = ''; $.each(data.country_top10, function(i,item){ country_top10_html +="<li>"+item['show_area']+"</li>" }); $('#zd_country_top10_'+cur_month).html(country_top10_html); $('#referrals-report-chart_zd_'+cur_month).highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, colors: ['#188ae2', '#3ab74c', '#ff7373', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4','#82a6f5', '#9ff048','#f1aaa6','#c09eff','#82d0f5'] , title: { text: '' }, tooltip: { headerFormat: '', pointFormat: '{point.name}: <span class="point-value">{point.percentage:.1f}%</span>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '<span class="point-label">{point.name}</span>, {point.percentage:.1f} %', style: { color: '#666', fontSize: "12px", fontWeight: "normal" } } } }, series: [{ type: 'pie', name: '', // 数据 data: [ ['PC', parseInt("<?php echo $count_pc;?>")], ['MOBILE', parseInt("<?php echo $count_mo;?>")], ] }] }); }, "json"); //流量转化 $.get("/wp-admin/admin-ajax.php", { "action": "stats_data_uvhz", month :cur_month}, function(data){ $('.ll_moth_'+cur_month+'_moth').html(data.moth_moth); $('#ll_moth_'+cur_month+'_pv').html(data.moth_pv); $('#ll_moth_'+cur_month+'_ip').html(data.moth_ip); $('#month_cf').html(data.cf_f_count); var country_top10_html = ''; var ip_from_country = ''; $.each(data.country_top10, function(i,item){ if(i<10){ country_top10_html +="<li>"+item['show_area']+"</li>" ip_from_country += item['show_area']+"、"; } }); ip_from_country=ip_from_country.substring(0,ip_from_country.length -1); $('#ll_country_top10_'+cur_month).html(country_top10_html); $('#ip_from_country').html(ip_from_country); var data_pv = new Array(); var data_ip = new Array(); var k=0; $.each(data.moth['data'], function(i,item){ data_pv[k] = parseInt(item.pv); data_ip[k] = parseInt(item.ip); k++; }); // 各月份数据 Highcharts.chart('referrals-report-chart_ll_'+cur_month, { xAxis: { type: 'datetime', dateTimeLabelFormats: { day: '%m-%d' }, tickWidth:0, lineWidth: 0, labels:{ style:{ color:'#999' } } }, tooltip: { xDateFormat: '%Y年%m月%d日', shared:true, shadow: false, backgroundColor: '#ffffff', style:{ color: '#666666', fontSize: '12px', padding: '8px', lineHeight:'20px' } }, colors: ['#ececec','#7cb0d8'], chart:{type:'areaspline'}, plotOptions: { series: { lineWidth:1, marker: { enabled: true }, pointStart: Date.parse(getMonthfirstDay(cur_month)), // 开始时间 pointEnd: Date.parse(getMonthLastDay(cur_month)), // 结束时间 pointInterval: 24 * 3600 * 1000 } }, series:[ { name:'访客次数(PV)',lineColor:'#aaaaaa',marker: {symbol: 'circle',lineWidth: 1,lineColor: '#ffffff',fillColor: '#cccccc'}, data:eval(data_pv) // PV数据 }, { name:'独立访客(IP)',lineColor:'#3292e0',marker: {symbol: 'circle',lineWidth: 1,lineColor: '#ffffff',fillColor: '#3292e0'}, data:eval(data_ip) // UV数据 } ] }); }, "json"); //受访页面 var arr_ym = new Array(); $.get("/wp-admin/admin-ajax.php", { "action": "stats_data_uvym", month :cur_month}, function(data){ $('.ym_moth_'+cur_month+'_moth').html(data.moth_moth); $('#ym_moth_'+cur_month+'_pv').html(data.moth_pv); $('#ym_moth_'+cur_month+'_ip').html(data.moth_ip); var country_top10_html = ''; $.each(data.referrer_top15_area, function(i,item){ if(i<10){ country_top10_html +="<li><a target='_blank' href='"+item['request']+"'>"+item['request']+"</a></li>"; arr_ym[i] = new Array(i); arr_ym[i][0] = item['request']; arr_ym[i][1] = parseInt(item['num_request']); } }); $('#ym_country_top10_'+cur_month).html(country_top10_html); $('#referrals-report-chart_ym_'+cur_month).highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, colors: ['#188ae2', '#3ab74c', '#ff7373', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4','#82a6f5', '#9ff048','#f1aaa6','#c09eff','#82d0f5'] , title: { text: '' }, tooltip: { headerFormat: '', pointFormat: '{point.name}: <span class="point-value">{point.percentage:.1f}%</span>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, useHTML: true, format: '<div class="label-item"><span class="point-label">{point.name}</span><span class="point-percent">, {point.percentage:.1f} %</span></div>', style: { color: '#666', fontSize: "12px", fontWeight: "normal" } } } }, series: [{ type: 'pie', name: '', // 数据 data: arr_ym }] }); }, "json"); //地域分布 var arr_gj = new Array(); $.get("/wp-admin/admin-ajax.php", { "action": "stats_data_uvgj", month :cur_month}, function(data){ $('.gj_moth_'+cur_month+'_moth').html(data.moth_moth); $('#gj_moth_'+cur_month+'_pv').html(data.moth_pv); $('#gj_moth_'+cur_month+'_ip').html(data.moth_ip); var country_top10_html = ''; $.each(data.country_top15, function(i,item){ if(i<10){ country_top10_html +="<li>"+item['show_area']+"</li>"; arr_gj[i] = new Array(i); arr_gj[i][0] = item['show_area']; arr_gj[i][1] = parseInt(item['ip_area']); } }); $('#gj_country_top10_'+cur_month).html(country_top10_html); $('#referrals-report-chart_gj_'+cur_month).highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, colors: ['#188ae2', '#3ab74c', '#ff7373', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4','#82a6f5', '#9ff048','#f1aaa6','#c09eff','#82d0f5'] , title: { text: '' }, tooltip: { headerFormat: '', pointFormat: '{point.name}: <span class="point-value">{point.percentage:.1f}%</span>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '<span class="point-label">{point.name}</span>, {point.percentage:.1f} %', style: { color: '#666', fontSize: "12px", fontWeight: "normal" } } } }, series: [{ type: 'pie', name: '', // 数据 data: arr_gj }] }); }, "json"); //询盘数据 $.get("/wp-admin/admin-ajax.php", { "action": "stats_data_xptj", month :cur_month}, function(data){ $('#xunpan_num').html(data.cf_count); $('#xunpan_num_month').html(data.cf_count_month); var start_num = data.cf_count_month-3; if(start_num < 0){ start_num = 0; } var end_num = data.cf_count_month+3; $('#send_email_xunpan').html(start_num+"-"+end_num); var country_top10_html = ''; $.each(data.country_top20, function(i,item){ country_top10_html += item['show_area']+"、"; }); country_top10_html=country_top10_html.substring(0,country_top10_html.length -1); $('#xunp_from_country').html(country_top10_html); }, "json"); }); </script> <?php }?> <!-- PDF 文档下载 (2018-05-10) --> <script type="text/javascript" src="//www.quanqiusou.cn/admin40/js/canvg2.js"></script> <script type="text/javascript" src="//www.quanqiusou.cn/admin40/js/html2canvas.js"></script> <script type="text/javascript" src="//www.quanqiusou.cn/admin40/js/jsPdf.debug.js"></script> <script type="text/javascript"> $(function(){ $(window).on('load',function(){ $('.report-layer .btn-download-report').fadeIn(300); }) }) var downPdf = document.getElementById("renderPdf"); var layHeightArr=[]; $('.report-layer').each(function(){ var layH=parseInt($(this).height()); layHeightArr.push(layH); }) var pdfLayH=Math.max.apply(null,layHeightArr); var pdfLayW=$('.pdf-pages').width(); var actualWidth = 595.28; var actualHeight =pdfLayH/pdfLayW*595.28; var formatSize=[actualWidth,actualHeight]; var layScale=actualHeight/actualWidth; if(layScale<1){ var dfPdf=new jsPDF('l', 'mm',formatSize); } else{ var dfPdf=new jsPDF('p', 'pt',formatSize); } downPdf.onclick = function() { if($('.pdf-create-pop').length<1){ $('.pdf-pages').append('<div class="pdf-create-pop"><div class="pdf-pop-msg"><div class="pop-msg-txt"></div></div></div>'); } $('body').addClass('pdf-create'); $('.btn-download-report').hide(); $('.pdf-create-pop').fadeIn(300); var lableDiv = document.getElementById('pdf-pages').getElementsByClassName("report-layer"); createCanvas(dfPdf,lableDiv[i],0); svg2canvas($('.pdf-pages .report-layer')); } function createCanvas(pdf,lableDiv,index){ var lableDiv = document.getElementById('pdf-pages').getElementsByClassName("report-layer"); var ele=lableDiv[index]; var date=new Date(); //var pdfYear=date.getFullYear().toString(); //var pdfMonth=parseInt(date.getMonth()+1).toString(); var pdfMonth = "<?php echo $cur_month_ym;?>"; var main = { init:function(){ main.html2Canvas(); }, //获取像素密度 getPixelRatio:function(context){ var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1; return (window.devicePixelRatio || 1) / backingStore; }, //绘制dom 元素,生成截图canvas html2Canvas: function () { // svg2canvas(ele); $('.pdf-create-pop .pop-msg-txt').html('正在生成PDF文档第'+'<b>'+(parseInt(index)+1)+'</b>页'); var shareContent = $('.report-layer-'+(index+1));// 需要绘制的部分的 dom 对象 ,注意容器的宽度不要使用百分比,使用固定宽度,避免缩放问题 var width = shareContent.width(); // 获取(原生)dom 宽度 var height = shareContent.height(); // 获取(原生)dom 高 var offsetTop = shareContent.offset().top; //元素距离顶部的偏移量 var canvas = document.createElement('canvas'); //创建canvas 对象 canvas.setAttribute('class','pdf-canvas canvas'+index); var context = canvas.getContext('2d'); var scaleBy = main.getPixelRatio(context); //获取像素密度的方法 (也可以采用自定义缩放比例) canvas.width = (width+shareContent.offset().left*2) * scaleBy; canvas.height = (height + offsetTop) * scaleBy; // 注意高度问题,由于顶部有个距离所以要加上顶部的距离,解决图像高度偏移问题 context.scale(scaleBy, scaleBy); var opts = { allowTaint:false,//允许加载跨域的图片 tainttest:true, //检测每张图片都已经加载完成 scale:scaleBy, // 添加的scale 参数 canvas:canvas, //自定义 canvas logging: false, //日志开关,发布的时候记得改成false width:width, //dom 原始宽度 height:height, //dom 原始高度 background: "#fff" }; html2canvas(shareContent, opts).then(function (canvas) { var body = document.getElementsByTagName("body"); body[0].appendChild(canvas); if(index==0){ var pageData; } var pageData = canvas.toDataURL('image/jpeg', 1.0); var contentWidth = canvas.width; var contentHeight = canvas.height; var company_name = "<?php echo $company_name;?>"; var imgWidth = 595.28; var imgHeight = 595.28/contentWidth * contentHeight; pageWidth=595.28; pageHeight=contentHeight/contentWidth*pageWidth; pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight); if(index==lableDiv.length-1){ pdf.save('全球搜月度报表_'+company_name+'_'+pdfMonth+'.pdf'); $('body').removeClass('pdf-create').addClass('pdf-exited'); $('.pdf-create-pop').fadeOut(200,function(){ $('.btn-download-report').fadeIn(200); }); dfPdf=new jsPDF('l', 'mm',formatSize); //避免数据重复 } if(index<lableDiv.length){ pdf.addPage(); pageData=''; } index++; if(index < lableDiv.length){ window.setTimeout(createCanvas(pdf,lableDiv,index),200); } }); } }; //最后运行代码 main.init(); } function svg2canvas(targetElem) { var svgElem = targetElem.find('svg'); svgElem.each(function (index, node) { var parentNode = node.parentNode; //由于现在的IE不支持直接对svg标签node取内容,所以需要在当前标签外面套一层div,通过外层div的innerHTML属性来获取 var tempNode = document.createElement('div'); tempNode.appendChild(node); var svg = tempNode.innerHTML; var canvas = document.createElement('canvas'); //转换 canvg(canvas, svg); parentNode.appendChild(canvas); }); } </script> <script src = "https://cdn.polyfill.io/v2/polyfill.min.js"></script> </body> </html>