• 织梦后台表单数据提醒


    只是个简单查询:

    1 在dede/index.php 中写入一行代码:require(DEDEADMIN.'/../plus/form_alert.php');

    2 然后在 dede/templets/index2.htm 的 "<div class="sysmsg"><h3>滚动消息:</h3>" 部位改变代码:

    <h3><?php if(isset($formAddMsg)){echo $formAddMsg . '有消息';} ?></h3>
    <script type="text/javascript">
    $(function(){
    function getFormMsg() {
    $.ajax({
    type: 'get',
    url: '/plus/form_alert_ajax.php',
    data: 'getform=1',
    dataType: 'json',
    success: function(re) {
    var res = re;
    console.log(res);
    if(res != 'false'){
    $('.sysmsg>h3').text(res+'有消息');
    } else {
    $('.sysmsg>h3').text('无消息');
    }
    }
    });
    }
    var timer = setInterval(getFormMsg,120000);
    });
    </script>

    3 增加文件 ./plus/form_alert_ajax.php 代码:

     1 <?php
     2     require_once ("/../include/common.inc.php");
     3 
     4     if($dsql->IsTable('qx_diyform1')){
     5          //如果存在qx_diyform1表
     6          //-------------------
     7         $sql = "SELECT count(ifcheck) FROM qx_diyform1 WHERE ifcheck = 0";
     8         $dsql->Execute('me',$sql);
     9         if($dsql->GetArray('me')['count(ifcheck)']>0){
    10             $formAddMsg = ' qx_diyform1 ';
    11         }
    12       }
    13       if($dsql->IsTable('qx_diyform2')){
    14          //如果存在qx_diyform2表
    15          //-------------------
    16         $sql = "SELECT count(ifcheck) FROM qx_diyform2 WHERE ifcheck = 0";
    17         $dsql->Execute('me',$sql);
    18         if($dsql->GetArray('me')['count(ifcheck)']>0){
    19             $formAddMsg .= ' qx_diyform2 ';
    20         }
    21       }
    22       if($dsql->IsTable('qx_diyform3')){
    23          //如果存在qx_diyform3表
    24          //-------------------
    25         $sql = "SELECT count(ifcheck) FROM qx_diyform3 WHERE ifcheck = 0";
    26         $dsql->Execute('me',$sql);
    27         if($dsql->GetArray('me')['count(ifcheck)']>0){
    28             $formAddMsg .= ' qx_diyform3 ';
    29         }
    30       }
    31       $res = isset($formAddMsg) ? $formAddMsg : 'false';
    32       echo json_encode($res);

    结果如下:

  • 相关阅读:
    git学习笔记
    ubuntu常用命令
    hdfs[命令] fsck
    hdfs[命令] dfsadmin
    hdfs[命令] dfs
    Hadoop2.0新特性-持续追加【干货】
    Cloudera 建议使用 NTP 使 Hadoop 群集实现时间同步
    Cloudera CDH5 部署实战指南(离线安装)
    没有用户画像,别谈精准营销
    用户画像数据建模方法
  • 原文地址:https://www.cnblogs.com/init-007/p/10790847.html
Copyright © 2020-2023  润新知