// +---------------------------------------------------------------------- namespace app\controller\store\order; use app\controller\store\AuthController; use app\services\order\StoreDeliveryOrderServices; use think\facade\App; /** * 配送订单 * Class StoreDeliveryOrder * @package app\controller\store\order */ class StoreDeliveryOrder extends AuthController { /** * StoreDeliveryOrder constructor. * @param App $app * @param StoreDeliveryOrderServices $services */ public function __construct(App $app, StoreDeliveryOrderServices $services) { parent::__construct($app); $this->services = $services; } /** * 显示资源列表 * * @return \think\Response */ public function index() { $where = $this->request->getMore([ ['keyword', ''], ['status', ''], ['data', '', '', 'time'], ['station_type', ''] ]); $where['type'] = 1; $where['relation_id'] = $this->storeId; return $this->success($this->services->systemPage($where)); } /** * 详情 * @param $id * @return mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function detail($id) { if (!$id) { return app('json')->fail('缺少参数ID'); } $data = $this->services->detail($id); return app('json')->success($data); } public function cancelForm($id) { if (!$id) { return app('json')->fail('缺少参数ID'); } return app('json')->success($this->services->cancelForm($id)); } /** * 取消发单 * @param $id * @return mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function cancel($id) { $reason = $this->request->getMore([ ['reason', ''], ['cancel_reason', ''] ]); if (!$id) { return app('json')->fail('缺少参数ID'); } if (empty($reason['reason'])) return app('json')->fail('取消理由不能为空'); $this->services->cancel($id, $reason); return app('json')->success('取消成功'); } /** * @param $id * @return mixed */ public function delete($id) { if (!$id) { return app('json')->fail('缺少参数ID'); } $this->services->delete((int)$id); return app('json')->success('删除成功'); } }