public function syn_data()
 {
     set_time_limit(0);
     es_session::close();
     //同步,supplier_location表, deal表, youhui表, event表 , supplier 表
     //总数
     $page = intval($_REQUEST['p']) == 0 ? 1 : intval($_REQUEST['p']);
     if ($page == 1) {
         syn_dealing();
     }
     $page_size = 5;
     $location_total = M("SupplierLocation")->count();
     $deal_total = M("Deal")->count();
     $youhui_total = M("Youhui")->count();
     $event_total = M("Event")->count();
     $supplier_total = M("Supplier")->count();
     $rebid_total = M("Rebid_submit")->where("status=1")->count();
     $count = max(array($location_total, $deal_total, $youhui_total, $event_total, $supplier_total, $rebid_total));
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $location_list = M("SupplierLocation")->limit($limit)->findAll();
     foreach ($location_list as $v) {
         syn_supplier_location_match($v['id']);
     }
     $supplier_list = M("Supplier")->limit($limit)->findAll();
     foreach ($supplier_list as $v) {
         syn_supplier_match($v['id']);
     }
     $deal_list = M("Deal")->limit($limit)->findAll();
     foreach ($deal_list as $v) {
         syn_deal_match($v['id']);
     }
     $youhui_list = M("Youhui")->limit($limit)->findAll();
     foreach ($youhui_list as $v) {
         syn_youhui_match($v['id']);
     }
     $event_list = M("Event")->limit($limit)->findAll();
     foreach ($youhui_list as $v) {
         syn_event_match($v['id']);
     }
     $rebid_list = M("Rebid_submit")->where("status=1")->limit($limit)->findAll();
     foreach ($rebid_list as $v) {
         syn_rebid_match($v['id']);
     }
     if ($page * $page_size >= $count) {
         $this->assign("jumpUrl", U("Cache/index"));
         $ajax = intval($_REQUEST['ajax']);
         clear_auto_cache("cache_deal_cart");
         $data['status'] = 1;
         $data['info'] = "<div style='line-height:50px; text-align:center; color:#f30;'>同步成功</div><div style='text-align:center;'><input type='button' onclick='\$.weeboxs.close();' class='button' value='关闭' /></div>";
         header("Content-Type:text/html; charset=utf-8");
         exit(json_encode($data));
     } else {
         $total_page = ceil($count / $page_size);
         $data['status'] = 0;
         $data['info'] = "共" . $total_page . "页,当前第" . $page . "页,等待更新下一页记录";
         $data['url'] = U("Cache/syn_data", array("p" => $page + 1));
         header("Content-Type:text/html; charset=utf-8");
         exit(json_encode($data));
     }
 }
示例#2
0
function syn_rebiding()
{
    $rebid_list = $GLOBALS['db']->getAll("select id from " . DB_PREFIX . "rebid_submit where status =3 and is_delete = 0");
    foreach ($rebid_list as $v) {
        syn_rebid_match($v['id']);
    }
}