| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace app\admin\controller;
- use app\common\model\OrderModel;
- use app\common\model\StoreModel;
- use app\Request;
- use think\App;
- use think\facade\View;
- class Order extends \app\BaseController
- {
- private $model;
- private $storeModel;
- public function __construct(App $app)
- {
- $this->model = new OrderModel();
- $this->storeModel = new StoreModel();
- parent::__construct($app);
- }
- public function index(Request $request) {
- $params = $request->param();
- $format_params = [
- 'store_id' => format_string($params['store_id'] ?? null),
- 'type' => format_string($params['type'] ?? null) != null ? (int)$params['type']: null,
- ];
- $orders = $this->model->findByPaginate($format_params);
- View::assign([
- 'list' => $orders,
- 'all_store' =>$this->storeModel->findAllStore(),
- 'params' => $format_params
- ]);
- return view();
- }
- public function edit(Request $request) {
- $params = $request->param();
- if(!isset($params['id']))
- return $this->fail(lang('ID not exist'));
- $order = $this->model->findById($params['id']);
- View::assign([
- 'order' => $order,
- ]);
- return view();
- }
- }
|