From 5afdf74fc29b338db63f0e1d2abf08fcff1bebc3 Mon Sep 17 00:00:00 2001 From: kaiend Date: Tue, 27 Feb 2018 13:53:52 +0800 Subject: [PATCH] order --- application/api/controller/Order.php | 44 ++++++++++++++++++---------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/application/api/controller/Order.php b/application/api/controller/Order.php index c647b8d5..e9d5a747 100644 --- a/application/api/controller/Order.php +++ b/application/api/controller/Order.php @@ -16,6 +16,11 @@ use app\common\controller\Api; */ class Order extends Api { + public function _initialize() + { + parent::_initialize(); + $this->model = model('Order'); + } /** * 插入订单 * @return mixed @@ -61,19 +66,36 @@ class Order extends Api //return $this->view->fetch(); return json('',200,[],''); } - public function index() { + //设置过滤方法 + $this->request->filter(['strip_tags']); +// if ($this->request->isAjax()) +// { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('pkey_name')) + { + return $this->selectpage(); + } - } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + $total = $this->model + ->where($where) + ->order($sort, $order) + ->count(); - /** - * 读取订单 - */ - public function read() - { + $list = $this->model + ->where($where) + ->order($sort, $order) + ->limit($offset, $limit) + ->select(); + $result = array("total" => $total, "rows" => $list); + return json($result); + // $this->success('','',json(),$result); + // } +// return $this->view->fetch(); } @@ -108,13 +130,5 @@ class Order extends Api $this->error(__('Parameter %s can not be empty', 'ids')); } - /** - * 展示订单 - */ - public function order_list() - { - - } - } \ No newline at end of file