<?php

namespace app\admin\controller;

use think\Validate;
use think\Lang;

class Order extends AdminControl
{

    public function _initialize()
    {
        parent::_initialize();
        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/order.lang.php');
    }

    /**
     * 用户列表
     * @return mixed
     */
    public function index()
    {
        $model_order = Model('Order');
        $order_identity = input('order_identity', '');
        $user_id = intval(input('user_id', 0));
        $product_id = intval(input('product_id', 0));

        $where = [];
        if ($order_identity != '') {
            $where['order_identity'] = $order_identity;
        }

        if ($user_id) {
            $where['user_id'] = $user_id;
        }

        if ($product_id) {
            $where['product_id'] = $product_id;
        }

        $order_list = $model_order->getOrdList($where, '*', 10);
        $this->assign('order_list', $order_list);
        $this->assign('show_page', $order_list->render());
        $this->setAdminCurItem('index');
        $this->assign('oinput', ['order_identity' => input("order_identity",''), 'user_id' => input("user_id",''), 'product_id' => input("product_id","")]);
        return $this->fetch();
    }

}
