|
|
|
|
@ -25,6 +25,25 @@ class GateController extends Controller
|
|
|
|
|
{
|
|
|
|
|
use ApiResponse;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/admin/gate/user-list",
|
|
|
|
|
* tags={"门岗端接口"},
|
|
|
|
|
* summary="门岗用户列表",
|
|
|
|
|
* description="",
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="暂无"
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function uerList()
|
|
|
|
|
{
|
|
|
|
|
$admin = Admin::whereHas('role', function ($query) {
|
|
|
|
|
$query->where('name', 'like', '%门岗%');
|
|
|
|
|
})->get();
|
|
|
|
|
return $this->success($admin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
@ -35,7 +54,7 @@ class GateController extends Controller
|
|
|
|
|
* @OA\Parameter(name="date", in="query", @OA\Schema(type="string"), required=false, description="查询日期,格式:Y-m-d,默认今天"),
|
|
|
|
|
* @OA\Parameter(name="status", in="query", @OA\Schema(type="string"), required=false, description="状态筛选:1通过(待进厂)3已进厂4已离厂"),
|
|
|
|
|
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=false, description="类型筛选:1访客2访客车辆3物流车辆"),
|
|
|
|
|
* @OA\Parameter(name="keyword", in="query", @OA\Schema(type="string"), required=false, description="关键词搜索(姓名、手机号、车牌号)"),
|
|
|
|
|
* @OA\Parameter(name="keyword", in="query", @OA\Schema(type="string"), required=false, description="关键词搜索(人牌,身份证,核销码)"),
|
|
|
|
|
* @OA\Parameter(name="page", in="query", @OA\Schema(type="integer"), required=false, description="页码,默认1"),
|
|
|
|
|
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="integer"), required=false, description="每页数量,默认20"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
@ -88,10 +107,9 @@ class GateController extends Controller
|
|
|
|
|
// 关键词搜索
|
|
|
|
|
if ($keyword) {
|
|
|
|
|
$query->where(function ($q) use ($keyword) {
|
|
|
|
|
$q->where('name', 'like', "%{$keyword}%")
|
|
|
|
|
->orWhere('mobile', 'like', "%{$keyword}%")
|
|
|
|
|
->orWhere('plate', 'like', "%{$keyword}%")
|
|
|
|
|
->orWhere('code', 'like', "%{$keyword}%");
|
|
|
|
|
$q->where('person_no', "{$keyword}")
|
|
|
|
|
->orWhere('idcard', "{$keyword}")
|
|
|
|
|
->orWhere('code', "{$keyword}");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -106,12 +124,17 @@ class GateController extends Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/gate/visits/{id}",
|
|
|
|
|
* @OA\Post(
|
|
|
|
|
* path="/api/gate/visits/detail",
|
|
|
|
|
* tags={"门岗端接口"},
|
|
|
|
|
* summary="拜访详情信息",
|
|
|
|
|
* description="获取指定拜访的详细信息",
|
|
|
|
|
* @OA\Parameter(name="id", in="path", @OA\Schema(type="integer"), required=true, description="拜访ID"),
|
|
|
|
|
* @OA\RequestBody(
|
|
|
|
|
* required=true,
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* @OA\Property(property="id", type="integer", description="拜访ID")
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="成功获取拜访详情",
|
|
|
|
|
@ -123,9 +146,15 @@ class GateController extends Controller
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function visitDetail($id)
|
|
|
|
|
public function visitDetail(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$id = $request->input('id');
|
|
|
|
|
|
|
|
|
|
if (!$id) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, __('gate.visit_id_required')]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$visit = Visit::with([
|
|
|
|
|
'visitArea',
|
|
|
|
|
'visitTime',
|
|
|
|
|
@ -151,14 +180,14 @@ class GateController extends Controller
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Post(
|
|
|
|
|
* path="/api/gate/visits/{id}/update",
|
|
|
|
|
* path="/api/gate/visits/update",
|
|
|
|
|
* tags={"门岗端接口"},
|
|
|
|
|
* summary="更新拜访信息",
|
|
|
|
|
* description="门岗端更新拜访信息(绑定ID卡、修改状态、上传货车图片等)",
|
|
|
|
|
* @OA\Parameter(name="id", in="path", @OA\Schema(type="integer"), required=true, description="拜访ID"),
|
|
|
|
|
* @OA\RequestBody(
|
|
|
|
|
* required=true,
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* @OA\Property(property="id", type="integer", description="拜访ID"),
|
|
|
|
|
* @OA\Property(property="action", type="string", description="操作类型:bind_card绑定ID卡,enter进厂,leave离厂,upload_vehicle上传货车图片"),
|
|
|
|
|
* @OA\Property(property="person_no", type="string", description="人牌号(绑定ID卡时必填)"),
|
|
|
|
|
* @OA\Property(property="car_no", type="string", description="停车牌号(绑定ID卡时必填)"),
|
|
|
|
|
@ -177,9 +206,15 @@ class GateController extends Controller
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function updateVisit(Request $request, $id)
|
|
|
|
|
public function updateVisit(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$id = $request->input('id');
|
|
|
|
|
|
|
|
|
|
if (!$id) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, __('gate.visit_id_required')]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$visit = Visit::find($id);
|
|
|
|
|
if (!$visit) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_BUSINESS, __('gate.visit_not_found')]);
|
|
|
|
|
@ -318,10 +353,7 @@ class GateController extends Controller
|
|
|
|
|
* summary="核销",
|
|
|
|
|
* description="",
|
|
|
|
|
* @OA\Parameter(name="admin_id", in="query", @OA\Schema(type="string"), required=false, description="管理员id"),
|
|
|
|
|
* @OA\Parameter(name="code", in="query", @OA\Schema(type="string"), required=false, description="编码(二选一)"),
|
|
|
|
|
* @OA\Parameter(name="idcard", in="query", @OA\Schema(type="string"), required=false, description="身份证(二选一)"),
|
|
|
|
|
* @OA\Parameter(name="car_no", in="query", @OA\Schema(type="string"), required=false, description="停车牌"),
|
|
|
|
|
* @OA\Parameter(name="person_no", in="query", @OA\Schema(type="string"), required=false, description="人牌"),
|
|
|
|
|
* @OA\Parameter(name="keyword", in="query", @OA\Schema(type="string"), required=false, description="关键词(人牌,身份证,核销码)"),
|
|
|
|
|
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=false, description="1进厂2离厂"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
@ -333,10 +365,12 @@ class GateController extends Controller
|
|
|
|
|
{
|
|
|
|
|
$all = \request()->all();
|
|
|
|
|
$messages = [
|
|
|
|
|
'keyword.required' => __('关键词'),
|
|
|
|
|
'type.required' => __('gate.validation.type_required'),
|
|
|
|
|
'admin_id.required' => __('gate.validation.admin_id_required')
|
|
|
|
|
];
|
|
|
|
|
$validator = Validator::make($all, [
|
|
|
|
|
'keyword' => 'required',
|
|
|
|
|
'type' => 'required',
|
|
|
|
|
'admin_id' => 'required'
|
|
|
|
|
], $messages);
|
|
|
|
|
@ -348,13 +382,10 @@ class GateController extends Controller
|
|
|
|
|
if (empty($idcard) && empty($code)) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, __('gate.validation.code_or_idcard_required')]);
|
|
|
|
|
}
|
|
|
|
|
$check = Visit::where(function ($query) use ($idcard, $code) {
|
|
|
|
|
if (!empty($idcard)) {
|
|
|
|
|
$query->where('idcard', $idcard);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($code)) {
|
|
|
|
|
$query->where('code', $code);
|
|
|
|
|
}
|
|
|
|
|
$check = Visit::where(function ($query) use ($all) {
|
|
|
|
|
$query->where('person_no', "{$all['keyword']}")
|
|
|
|
|
->orWhere('idcard', "{$all['keyword']}")
|
|
|
|
|
->orWhere('code', "{$all['keyword']}");
|
|
|
|
|
})->first();
|
|
|
|
|
if (empty($check)) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_BUSINESS, __('gate.business.visit_not_found')]);
|
|
|
|
|
|