55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
namespace app\mobile\controller;
|
|
|
|
use app\common\controller\BaseController;
|
|
use app\common\traits\crud\CrudControllerTrait;
|
|
use app\common\service\InvRequisitionService;
|
|
use support\Request;
|
|
|
|
class InvRequisitionController extends BaseController
|
|
{
|
|
use CrudControllerTrait;
|
|
|
|
protected $service;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->service = new InvRequisitionService();
|
|
}
|
|
|
|
/**
|
|
* 提交物品申请
|
|
*
|
|
* @param Request $request
|
|
* @return mixed
|
|
*/
|
|
public function apply(Request $request)
|
|
{
|
|
try {
|
|
// 验证申请数据
|
|
$data = $this->validate($this->service->getValidator(), $request->post(), 'apply');
|
|
|
|
// 处理申请逻辑
|
|
$result = $this->service->serviceStore($request, $data, 'apply');
|
|
|
|
return $this->success($result, '申请提交成功');
|
|
} catch (\Throwable $e) {
|
|
return $this->error($e->getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 列表页数据格式化
|
|
*
|
|
* @param array $data
|
|
* @return array
|
|
*/
|
|
// protected function indexFormat($data)
|
|
// {
|
|
// if (isset($data['created_at']))
|
|
// $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
|
// if (isset($data['updated_at']))
|
|
// $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
|
// return $data;
|
|
// }
|
|
} |