|
@@ -33,9 +33,21 @@ class Order extends Backend |
|
@@ -33,9 +33,21 @@ class Order extends Backend |
33
|
*/
|
33
|
*/
|
34
|
/**
|
34
|
/**
|
35
|
* 查看
|
35
|
* 查看
|
|
|
36
|
+ *
|
|
|
37
|
+ * @param null $ids
|
|
|
38
|
+ *
|
|
|
39
|
+ * @return string|\think\response\Json
|
|
|
40
|
+ * @throws \think\Exception
|
|
|
41
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
42
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
43
|
+ * @throws \think\exception\DbException
|
36
|
*/
|
44
|
*/
|
37
|
- public function index()
|
45
|
+ public function index($ids = NULL)
|
38
|
{
|
46
|
{
|
|
|
47
|
+
|
|
|
48
|
+ if($ids){
|
|
|
49
|
+ $this->assign("user_id", $ids);
|
|
|
50
|
+ }
|
39
|
//设置过滤方法
|
51
|
//设置过滤方法
|
40
|
$this->request->filter(['strip_tags']);
|
52
|
$this->request->filter(['strip_tags']);
|
41
|
if ($this->request->isAjax()) {
|
53
|
if ($this->request->isAjax()) {
|
|
@@ -44,6 +56,22 @@ class Order extends Backend |
|
@@ -44,6 +56,22 @@ class Order extends Backend |
44
|
return $this->selectpage();
|
56
|
return $this->selectpage();
|
45
|
}
|
57
|
}
|
46
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
58
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
59
|
+ if($ids){
|
|
|
60
|
+ $total = $this->model
|
|
|
61
|
+ ->where($where)
|
|
|
62
|
+ ->where(['user_id'=>$ids])
|
|
|
63
|
+ ->with(['user','product'])
|
|
|
64
|
+ ->order($sort, $order)
|
|
|
65
|
+ ->count();
|
|
|
66
|
+
|
|
|
67
|
+ $list = $this->model
|
|
|
68
|
+ ->where($where)
|
|
|
69
|
+ ->where(['user_id'=>$ids])
|
|
|
70
|
+ ->with(['user','product'])
|
|
|
71
|
+ ->order($sort, $order)
|
|
|
72
|
+ ->limit($offset, $limit)
|
|
|
73
|
+ ->select();
|
|
|
74
|
+ }else{
|
47
|
$total = $this->model
|
75
|
$total = $this->model
|
48
|
->where($where)
|
76
|
->where($where)
|
49
|
->with(['user','product'])
|
77
|
->with(['user','product'])
|
|
@@ -56,6 +84,8 @@ class Order extends Backend |
|
@@ -56,6 +84,8 @@ class Order extends Backend |
56
|
->order($sort, $order)
|
84
|
->order($sort, $order)
|
57
|
->limit($offset, $limit)
|
85
|
->limit($offset, $limit)
|
58
|
->select();
|
86
|
->select();
|
|
|
87
|
+ }
|
|
|
88
|
+
|
59
|
|
89
|
|
60
|
$list = collection($list)->toArray();
|
90
|
$list = collection($list)->toArray();
|
61
|
$result = array("total" => $total, "rows" => $list);
|
91
|
$result = array("total" => $total, "rows" => $list);
|