commit | author | age
|
19351a
|
1 |
<?php |
B |
2 |
|
|
3 |
/** |
|
4 |
检查订单 API |
|
5 |
* ============================================================================ |
|
6 |
* |
|
7 |
|
|
8 |
* ---------------------------------------------------------------------------- |
|
9 |
|
|
10 |
* ============================================================================ |
|
11 |
|
|
12 |
* $Id: checkorder.php 17217 2011-01-19 06:29:08Z $ |
|
13 |
*/ |
|
14 |
|
|
15 |
define('IN_ECS', true); |
|
16 |
|
|
17 |
require('./init.php'); |
|
18 |
require_once(ROOT_PATH . 'includes/lib_order.php'); |
|
19 |
require_once('../includes/cls_json.php'); |
|
20 |
|
|
21 |
$json = new JSON; |
|
22 |
|
|
23 |
$res = array('error' => 0, 'new_orders' => 0, 'new_paid' => 0); |
|
24 |
$_REQUEST['username'] = urlencode(serialize(json_str_iconv($_REQUEST['username']))); |
|
25 |
|
|
26 |
/* 检查密码是否正确 */ |
|
27 |
$sql = "SELECT COUNT(*) ". |
|
28 |
" FROM " . $ecs->table('admin_user') . |
|
29 |
" WHERE user_name = '" . trim($_REQUEST['username']). "' AND password = '" . md5(trim($_REQUEST['password'])) . "'"; |
|
30 |
|
|
31 |
if ($db->getOne($sql)) |
|
32 |
{ |
|
33 |
/* 新订单 */ |
|
34 |
$sql = 'SELECT COUNT(*) FROM ' . $ecs->table('order_info'). |
|
35 |
" WHERE order_status = " . OS_UNCONFIRMED; |
|
36 |
$res['new_orders'] = $db->getOne($sql); |
|
37 |
|
|
38 |
/* 待发货的订单: */ |
|
39 |
$sql = 'SELECT COUNT(*)'. |
|
40 |
' FROM ' .$ecs->table('order_info') . |
|
41 |
" WHERE 1 ". order_query_sql('await_ship'); |
|
42 |
$res['new_paid'] = $db->getOne($sql); |
|
43 |
} |
|
44 |
else |
|
45 |
{ |
|
46 |
$res['error'] = 1; |
|
47 |
} |
|
48 |
|
|
49 |
$val = $json->encode($res); |
|
50 |
|
|
51 |
die($val); |
|
52 |
|
|
53 |
?> |