<?php
namespace app\admin\controller\home;

use app\admin\controller\BaseController;
use app\admin\server\home\HomeOrderServer;


class HomeOrder extends BaseController
{

    /**
     * Notes:获取订单列表
     * @return \support\Response
     * User: YCP
     * Date: 2022/11/2
     */
    public function getOrderList()
    {
        [$page, $limit] = $this->getPage();
        $keywords = $this->request->get('keywords');
        $result         = HomeOrderServer::getOrderList($page, $limit,$keywords);
        return json_success($result, '成功');
    }
    /**
     * Notes:订单详情
     * @return \support\Response
     * User: YCP
     * Date: 2022/11/2
     */
    public function getOrderInfo()
    {
        $order_id = $this->request->get('order_id');
        if(!$order_id){
            throw new \Exception('订单ID不能为空');
        }
        $result         = HomeOrderServer::orderInfo($order_id);
        if ($result){
            return json_success($result, '获取成功');
        }else{
            throw new \Exception('获取失败！');
        }

    }


}
