<?php
/**
 * 定时弹窗
 * @Copyright (C) 2017 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author chang <13331202938@126.com>
 */
namespace Common\Vendor\Cron;
class Popup{	
	/**
     * 定时弹窗
     */
    public function index($config_info){
		
		$id = session('admin_id');
        $map['status'] = 1;
        $count[1] = M('OrderInfo')->where($map)->count();
        $where_g['status'] = 1;
        $where_g['is_delete'] = 0;
        $where_g['shop_id'] = array('gt',0);
        $where_g['publish_wait'] = array('neq',1);
        $count[3] = M('Goods')->where($where_g)->count();
        $where_sh['status'] = 0;
        $count[2] = M('Shops')->where($where_sh)->count();
        $list = array();
        if ($count[1]) {//新订单
            $list[] = '<a onclick="openwindowleft(\'' . U('OrderInfo/index') . '\')"><p style="border-bottom:1px dotted #eee; padding-bottom:8px;"><font style="font-size:16px; font-weight:600; color:#F00; padding-right:5px;">·</font>新订单<strong style="color:#ff0000; padding-left:8px;" id="spanNewOrder">' . $count[1] . '个</strong></p></a>';
        }
        if ($count[3]) {//未审核商品
            $list[] = '<a onclick="openwindowleft(\'' . U('Audit/goods_shops') . '\')"><p style="border-bottom:1px dotted #eee; padding-bottom:8px;"><font style="font-size:16px; font-weight:600; color:#F00; padding-right:5px;">·</font>未审核商品<strong style="color:#ff0000; padding-left:8px;" id="spanNewOrder">' . $count[3] . '个</strong></p></a>';
        }
        if ($count[2]) {//未审核店铺
            $list[] = '<a onclick="openwindowleft(\'' . U('Audit/index') . '\')"><p style="border-bottom:1px dotted #eee; padding-bottom:8px;"><font style="font-size:16px; font-weight:600; color:#F00; padding-right:5px;">·</font>未审核店铺<strong style="color:#ff0000; padding-left:8px;" id="spanNewOrder">' . $count[2] . '个</strong></p></a>';
        }
        $real = array_filter($count);
        $numstr = empty($real) ? '' : implode('-', $count);
        $notice['num'] = $numstr . '-' . date('Ymd');
        $notice['data'] = $list;
		$notice['code']='ajax_box';
		//更新计划任务
		updatetask($config_info);
        return $notice;
	}
}
?>