66 lines
1.5 KiB
PHP
66 lines
1.5 KiB
PHP
<?php
|
|
namespace App\Domains\Real\Http\Controllers;
|
|
|
|
use App\Core\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Domains\Real\Services\OrderService;
|
|
|
|
class OrderController extends Controller
|
|
{
|
|
protected $request;
|
|
protected $orderService;
|
|
|
|
/**
|
|
* 构造函数,自动注入.
|
|
*/
|
|
public function __construct(Request $request, OrderService $orderService)
|
|
{
|
|
$this->request = $request;
|
|
$this->orderService = $orderService;
|
|
}
|
|
|
|
/**
|
|
* 列表.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
$conditions = $this->request->all();
|
|
$conditions['limit'] = $this->request->get('limit', 10);
|
|
|
|
$orders = $this->orderService->index($conditions);
|
|
|
|
$orders->transform(function($item){
|
|
return $item->only([
|
|
'id',
|
|
'sn',
|
|
'company_name',
|
|
'package_name',
|
|
'carrier_operator_name',
|
|
'pay_channel_name',
|
|
'counts',
|
|
'shipments',
|
|
'total_price',
|
|
'order_at',
|
|
]);
|
|
});
|
|
|
|
return res($orders, '订单列表', 201);
|
|
}
|
|
|
|
/**
|
|
* 取卡
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function cards()
|
|
{
|
|
$conditions = $this->request->all();
|
|
|
|
$orders = $this->orderService->cards($conditions);
|
|
|
|
return res($orders, '卡列表', 201);
|
|
}
|
|
}
|