<?php
define(
'NUM_PER_PAGE'
, 15);
class
NowaMagicApp
extends
MallbaseApp
{
public
function
index()
{
$page
=
$this
->_get_page(NUM_PER_PAGE);
$page
[
'item_count'
] =
$stats
[
'total_count'
];
$this
->_format_page(
$page
);
$this
->assign(
'page_info'
,
$page
);
$this
->display(
'gorder.index.html'
);
}
function
orderslog()
{
$goods_id
=
empty
(
$_GET
[
'id'
]) ? 0 :
intval
(
$_GET
[
'id'
]);
if
(!
$goods_id
)
{
$this
->show_warning(
'Hacking Attempt'
);
return
;
}
$data
=
$this
-> get_order_data(
$goods_id
);
if
(
$data
=== false)
{
return
;
}
$this
->assign(
'order'
,
$data
);
$this
->display(
'gorder.index.html'
);
}
function
get_order_data(
$goods_id
)
{
$cache_server
=& cache_server();
$key
=
'order_'
.
$goods_id
;
$r
=
$cache_server
->get(
$key
);
$cached
= true;
$db
= &db();
$sql
= "select
count
(*)
from shop_order a, shop_order_extm b, shop_order_goods c
where a.order_id = b.order_id
and
b.order_id = c.order_id
and
c.goods_id =
'".$goods_id."'
and
a.status !=
'11'
and
a.status !=
'0'
and
a.status !=
'20'
order by a.add_time desc ";
$num
=
$db
-> getone(
$sql
);
$page
=
$this
->_get_page(NUM_PER_PAGE);
$page
[
'item_count'
] =
$num
;
$this
->_format_page(
$page
);
$sql2
= "select a.order_id, a.buyer_name, a.add_time, a.status, b.phone_tel, b.phone_mob, b.consignee, c.price, c.quantity, c.goods_id
from shop_order a, shop_order_extm b, shop_order_goods c
where a.order_id = b.order_id
and
b.order_id = c.order_id
and
c.goods_id =
'".$goods_id."'
and
a.status !=
'11'
and
a.status !=
'0'
and
a.status !=
'20'
order by a.add_time desc limit ".
$page
[
'limit'
];
$result
=
$db
-> query(
$sql2
);
$this
-> assign(
'page_info'
,
$page
);
$this
-> assign(
'que'
,
$sql2
);
while
(
$myrow
=
$db
-> fetch_array(
$result
))
{
$r
[] =
$myrow
;
}
$cache_server
->set(
$key
,
$r
, 1);
return
$r
;
}
}
?>