-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathorders.master.php
executable file
·103 lines (97 loc) · 2.86 KB
/
orders.master.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/*
* This file is part of the phpems/phpems.
*
* (c) oiuv <[email protected]>
*
* 项目维护:oiuv(QQ:7300637) | 定制服务:火眼(QQ:278768688)
*
* This source file is subject to the MIT license that is bundled.
*/
class action extends app
{
public function display()
{
$action = $this->ev->url(3);
if (!method_exists($this, $action)) {
$action = 'index';
}
$this->$action();
exit;
}
private function remove()
{
$oid = $this->ev->get('ordersn');
$order = $this->orders->getOrderById($oid);
if (1 == $order['orderstatus'] || 99 == $order['orderstatus']) {
$this->orders->delOrder($oid);
$message = [
'statusCode' => 200,
'message' => '订单删除成功',
'callbackType' => 'forward',
'forwardUrl' => 'reload',
];
} else {
$message = [
'statusCode' => 300,
'message' => '订单操作失败',
];
}
exit(json_encode($message));
}
private function batremove()
{
$delids = $this->ev->get('delids');
foreach ($delids as $oid => $p) {
$order = $this->orders->getOrderById($oid);
if (1 == $order['orderstatus'] || 99 == $order['orderstatus']) {
$this->orders->delOrder($oid);
}
}
$message = [
'statusCode' => 200,
'message' => '订单删除成功',
'callbackType' => 'forward',
'forwardUrl' => 'reload',
];
exit(json_encode($message));
}
private function change()
{
$ordersn = $this->ev->get('ordersn');
$orderstatus = $this->ev->get('orderstatus');
$args = ['orderstatus' => $orderstatus];
$this->orders->modifyOrderById($ordersn, $args);
$message = [
'statusCode' => 200,
'message' => '操作成功',
'target' => '',
'rel' => '',
'callbackType' => 'forward',
'forwardUrl' => 'reload',
];
exit(json_encode($message));
}
private function index()
{
$search = $this->ev->get('search');
$page = intval($this->ev->get('page'));
$u = '';
if ($search) {
$this->tpl->assign('search', $search);
foreach ($search as $key => $arg) {
$u .= "&search[{$key}]={$arg}";
}
}
$this->tpl->assign('u', $u);
$this->tpl->assign('page', $page);
if ($search) {
$args = [];
} else {
$args = 1;
}
$orders = $this->orders->getOrderList($args, $page);
$this->tpl->assign('orders', $orders);
$this->tpl->display('orders');
}
}