/** * 订单列表 * @param $input * @return array */ function yue_admin_task_get_order_list($input) { global $task_order_obj; global $org_obj; global $order_status_config; global $login_user_id; $format_ret = yue_admin_task_format_order($input); $where = $format_ret['where']; $filter = $format_ret['filter']; if ($filter['sign_time_begin']) { $filter['sign_time_begin'] = date("Y-m-d", $filter['sign_time_begin']); } if ($filter['sign_time_end']) { $filter['sign_time_end'] = date('Y-m-d', $filter['sign_time_end']); } if ($filter['add_time_begin']) { $filter['add_time_begin'] = date("Y-m-d", $filter['add_time_begin']); } if ($filter['add_time_end']) { $filter['add_time_end'] = date("Y-m-d", $filter['add_time_end']); } if ($filter['pay_time_begin']) { $filter['pay_time_begin'] = date('Y-m-d', $filter['pay_time_begin']); } if ($filter['pay_time_end']) { $filter['pay_time_end'] = date('Y-m-d', $filter['pay_time_end']); } $filter['is_close'] = 0; /* 分页数据 */ $page_arr['page'] = empty($input['page']) || intval($input['page']) <= 0 ? 1 : intval($input['page']); if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) { $page_arr['page_size'] = intval($input['page_size']); } else { $page_arr['page_size'] = 20; } if ($filter['goods_id'] > 0) { $goods_rst = $task_order_obj->get_order_list_by_goods_ids($filter['type_id'], $filter['status'], array($filter['goods_id']), true, $where); $page_arr['page_count'] = $goods_rst['total']; } else { $page_arr['page_count'] = $task_order_obj->get_order_list($filter['type_id'], $filter['status'], true, $where); } // 分页对象 $page_obj = new show_page(); // 设置分页参数 $page_obj->setvar($filter); $page_obj->set($page_arr['page_size'], $page_arr['page_count']); $limit = $page_obj->limit(); $page = $page_obj->output(1); /* 获取订单列表 */ if ($filter['goods_id'] > 0) { $list = $task_order_obj->get_order_list_by_goods_ids($filter['type_id'], $filter['status'], array($filter['goods_id']), false, $where, 'order_id', $limit); } elseif ($filter['type_id'] == 42) { $list = $task_order_obj->get_order_full_list_for_activity($filter['type_id'], $filter['status'], false, $where, 'order_id desc', $limit); } else { $list = $task_order_obj->get_order_full_list($filter['type_id'], $filter['status'], false, $where, 'order_id desc', $limit); } /* 格式化数据 */ foreach ($list as $key => &$val) { $val['add_time'] = date("Y-m-d H:i:s", $val['add_time']); $val['type_id_str'] = $val['type_name']; $val['seller_user_name'] = get_seller_nickname_by_user_id($val['seller_user_id']) . "</br>[{$val['seller_user_id']}]"; $val['buyer_user_name'] = get_user_nickname_by_user_id($val['buyer_user_id']) . "</br>[{$val['buyer_user_id']}]"; $val['org_user_name'] = $org_obj->get_org_name_by_user_id($val['org_user_id']); $val['is_pay'] = $val['is_pay'] == 0 ? '否' : '是'; $val['is_use_coupon'] = $val['is_use_coupon'] == 0 ? '否' : '是'; $list[$key]['service_time_str'] = $val['detail_list'][0]['service_time_str']; $list[$key]['goods_id'] = $val['detail_list'][0]['goods_id']; // 活动处理 商品ID 与 面值处理 商品ID if (is_null($list[$key]['goods_id'])) { if (isset($val['activity_list'][0]['activity_id'])) { $list[$key]['goods_id'] = $val['activity_list'][0]['activity_id']; } if (isset($val['payment_list'][0]['order_payment_id'])) { $list[$key]['goods_id'] = '--'; } } $time_left = $val['detail_list'][0]['service_time'] - time(); if ($val['status'] == 2 && $time_left < 12 * 3600) { $val['is_close'] = 1; } } $filter['output'] = 1; /* 将filter数组转换为url为模板方便使用 */ $filter['url'] = http_build_query($filter); return array('list' => $list, 'filter' => $filter, 'page' => $page); }
<?php include_once './inc/init.php'; include_once './inc/db.inc.php'; require './inc/ajax_page.inc.php'; $data = new DBSQL(); $arr = array(); //分页数组构造初始化 $arr['search'] = '1'; //搜索的必要条件 $showsql = "select * from coment where 1=1 "; if ($_GET['id']) { $showsql .= "and id='{$_GET['id']}' "; //搜索类别 $arr['id'] = urlencode($_GET['id']); } $list = $data->select($showsql); $num = count($list); $p = new show_page(); $p->pvar = "p"; $p->file = "list.php"; $p->setvar($arr); $p->set(5, $num, "", 'main_div', ''); $showsql .= " ORDER BY id desc "; $showsql .= " limit " . $p->limit(); $list = $data->select($showsql); $smarty->assign("list", $list); $pages = $p->output(1); $smarty->assign('pages', $pages); $smarty->display("sublist.htm");
$p->set(3, $num, "", "itemself"); $sql_itemself .= " limit " . $p->limit(); $itemsort_result = m_query($sql_itemself); while ($row_itemself = m_fetch($itemsort_result)) { $itemselflist[] = $row_itemself; } //print_rr($itemselflist); /* $i =0; while($row=m_fetch($itemsort_result)){ $sortlist[]=$row; if($i==0){ $sql_itemself = "select sortname from item where id='$id'"; $query_itemself = m_query($sql_itemself); while($row_itemself=m_fetch($query_itemself)){ $itemselflist[]=$row_itemself; } } $i++; } $pages=$p->output(1); */ $selfpages = $p->output(1); $smarty->assign('customize', $customize); $smarty->assign('no', $no); $smarty->assign('itemselflist', $itemselflist); $smarty->assign('selfpages', $selfpages); $smarty->display("itemself.htm");