Thinkphp项目结合JS消息提醒
这里简略贴下项目目录结构,请根据实际情况应用
案例链接下载
接下来就是项目实际应用代码
- index.html
消息提示框
- msg_tip.js
checkmsg();function checkmsg() { var url = "index.php?s=/Admin/public/ajax_box.html"; $.ajax({ type: "GET", url: url, dataType: "json", success: function(msg) { var num = msg; var opentip_num = $('#opentip_num').val(); if (num != opentip_num) { html = ''; $.each(msg, function(i, data) { html += '
' + data + '
-
yuyue_manage下就是图片啦
-
PublicController.class.php
public function ajax_box() { $info = I('ex'); $id = session('admin_id'); $map['status'] = 1; $count = M('OrderInfo')->where($map)->count(); $where_g['status'] = 0; $goods = M('Goods')->where($where_g)->count(); $where_sh['status'] = 0; $shops = M('Shops')->where($where_sh)->count(); //$where_jie['money_status'] = 0; $where_jie['status'] = array('GT', 0); // pe($where_jie); $order = M('OrderInfo')->where($where_jie)->count(); $data['count'] = '新订单' . $count . '个'; $data['goods'] = '未审核商品' . $goods . '个'; $data['shops'] = '未审核店铺' . $shops . '个'; $data['order'] = '订单列表' . $order . '个'; $this->ajaxReturn($data); }