<?php

namespace App\Http\Controllers\API\Admin\YeWu;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class OrderController extends Controller
{
    public function GetList()
    {
      $page = request('page');
      $pageSize = request('pageSize');
      $searchInfo = request('searchInfo');
      $list=DB::table('orders');
      if(isset($searchInfo['name'])){
        $list = $list->where('name', 'like', '%' . $searchInfo['name'] . '%');
      }
      if(isset($searchInfo['id_number'])){
        $list = $list->where('id_number', $searchInfo['id_number'] );
      }
      if(isset($searchInfo['order_number'])){
        $list = $list->where('order_number', $searchInfo['order_number'] );
      }
      $count=$list->count();
      $list=$list
        ->skip(($page-1)*$pageSize) // 跳过前9999条记录
        ->take($pageSize)->get();
      return \Yz::Return(true,"查询完成",['list'=>$list,'count'=>$count]);
    }
}
