123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <?php
- namespace app\api\controller\shop;
- use app\admin\model\Pingjia;
- use app\api\controller\Base;
- use app\api\model\User;
- class Order extends Base
- {
- protected $noNeedLogin = [];
- protected $noNeedRight = ['*'];
-
- public function index()
- {
- $params = $this->request->post();
- $this->success('订单列表', \app\api\model\order\Order::getList($params));
- }
- public function item_list(){
- $params = $this->request->post();
- $this->success('订单列表', \app\api\model\order\Order::getItemList($params));
- }
-
- public function detail()
- {
- $params = $this->request->get();
- $this->success('订单详情', \app\api\model\order\Order::detail($params));
- }
-
- public function itemDetail()
- {
- $params = $this->request->get();
- $this->success('订单商品', \addons\shopro\model\Order::itemDetail($params));
- }
-
-
- public function statusNum()
- {
- $this->success('订单数量', \addons\shopro\model\Order::statusNum());
- }
-
- public function cancel()
- {
- $params = $this->request->post();
-
- $this->shoproValidate($params, get_class(), 'cancel');
- $this->success('取消成功', \addons\shopro\model\Order::operCancel($params));
- }
-
- public function delete()
- {
- $params = $this->request->post();
-
- $this->shoproValidate($params, get_class(), 'delete');
- $this->success('删除成功', \app\api\model\order\Order::operDelete($params));
- }
-
- public function confirm()
- {
- $params = $this->request->post();
-
- $this->shoproValidate($params, get_class(), 'confirm');
- $this->success('收货成功', \app\api\model\order\Order::operConfirm($params));
- }
-
- public function comment()
- {
- $params = $this->request->post();
- if (!isset($params['list']) || empty($params['list'])) {
- $this->error('参数错误');
- }
-
- foreach ($params['list'] as $v) {
- \app\api\model\order\Order::operComment($v);
- }
- $this->success('评价成功');
- }
-
- public function pre()
- {
- $params = $this->request->post();
-
- $this->shoproValidate($params, get_class(), 'pre');
- $result = \app\api\model\order\OrderOper::pre($params);
- if (isset($result['msg']) && $result['msg']) {
- $this->error($result['msg'], $result);
- } else {
- $this->success('计算成功', $result);
- }
- }
-
- public function createOrder()
- {
- $params = $this->request->post();
-
- $this->shoproValidate($params, get_class(), 'createOrder');
- $order = \app\api\model\order\OrderOper::createOrder($params);
- $this->success('订单添加成功', $order);
- }
- public function cancelOrder()
- {
- $params = $this->request->post();
- extract($params);
- if(!isset($id)) {
- $this->error('未知的鱼塘id');
- }
- if (!is_array($id)) {
- $id = [$id];
- }
- foreach ($id as $value) {
- $order = (new \app\admin\model\Order())->where('id', $value)->find();
- $order->save(['status' => 4]);
- }
- $this->success('修改成功');
- }
-
- }
|