1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Services\OrderBackUpService;
- use Illuminate\Http\Request;
- use Illuminate\Validation\Rule;
- class OrderBackUpController extends Controller
- {
- /**
- * 订单记账备份列表
- */
- public function index(Request $request)
- {
- $validator = \Validator::make($request->all(), [
- 'page' => 'nullable|int',
- 'pagesize' => 'nullable|int',
- 'change_month' => 'nullable|string',
- 'back_type' => 'nullable|int',
- 'task_id' => 'nullable|string',
- 'company' => 'nullable|string',
- 'customer_name' => 'nullable|string',
- 'cost_company_name' => 'nullable|string',
- 'mcn_name' => 'nullable|string'
- ], [
- 'page.required' => '页码必传',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $search = $request->all();
- $page = $request->input('page', 1);
- $pagesize = $request->input('pagesize', 20);
- list($data, $total) = OrderBackUpService::index($page, $pagesize, $search);
- return self::returnPageValue($data, $total, $pagesize, $page);
- }
- public function export(Request $request)
- {
- $validator = \Validator::make($request->all(), [
- 'change_month' => 'nullable|string',
- 'back_type' => 'nullable|int',
- 'task_id' => 'nullable|string',
- 'company' => 'nullable|string'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $search = $request->all();
- $page = $request->input('page', 1);
- $pagesize = $request->input('pagesize', 20);
- $res = OrderBackUpService::export($page, $pagesize, $search);
- return self::returnValue([], 0);
- }
- }
|