liyinglin 3 years ago
parent 109b760b71
commit 4e91817e14

@ -29,7 +29,7 @@ class BlacklistController extends CommonController
* description="暂无"
* )
* )
*/
*/
public function index()
{
$all = request()->all();
@ -86,6 +86,9 @@ class BlacklistController extends CommonController
* @OA\Parameter(name="end_date", in="query", @OA\Schema(type="string"), required=false, description="结束时间"),
* @OA\Parameter(name="status", in="query", @OA\Schema(type="string"), required=false, description="状态0禁用1启用"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Parameter(name="remark", in="query", @OA\Schema(type="string"), required=true, description="备注"),
* @OA\Parameter(name="company_name", in="query", @OA\Schema(type="string"), required=true, description="单位名字"),
* @OA\Parameter(name="file", in="query", @OA\Schema(type="string"), required=true, description="附件id数组"),
* @OA\Response(
* response="200",
* description="暂无"
@ -121,7 +124,7 @@ class BlacklistController extends CommonController
DB::rollBack();
return $this->fail([$exception->getCode(), $exception->getMessage()]);
}
}
}
/**
* @OA\Get(
@ -152,4 +155,4 @@ class BlacklistController extends CommonController
Blacklist::where('id', $all['id'])->delete();
return $this->success('删除成功');
}
}
}

@ -0,0 +1,125 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Admin;
use App\Models\Blacklist;
use App\Models\GateLog;
use App\Models\Role;
use App\Models\Visit;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Helpers\ResponseCode;
/**
* 门岗
*/
class GateController extends CommonController
{
/**
* @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', '%门岗%');
});
return $this->success($admin);
}
/**
* @OA\Get(
* path="/api/admin/gate/visit-list",
* tags={"门岗-拜访记录"},
* summary="拜访记录",
* description="",
* @OA\Parameter(name="keyword", in="query", @OA\Schema(type="string"), required=false, description="关键词"),
* @OA\Parameter(name="audit_status", in="query", @OA\Schema(type="string"), required=false, description="审核状态-1待学习0待审核1通过(待进厂)2驳回3已进厂4已离厂"),
* @OA\Parameter(name="start_date", in="query", @OA\Schema(type="string"), required=false, description="开始日期"),
* @OA\Parameter(name="end_date", in="query", @OA\Schema(type="string"), required=false, description="结束日期"),
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="string"), required=false, description="每页显示的条数"),
* @OA\Parameter(name="page", in="query", @OA\Schema(type="string"), required=false, description="页码"),
* @OA\Parameter(name="sort_name", in="query", @OA\Schema(type="string"), required=false, description="排序字段名字"),
* @OA\Parameter(name="sort_type", in="query", @OA\Schema(type="string"), required=false, description="排序类型"),
* @OA\Parameter(name="is_export", in="query", @OA\Schema(type="string"), required=false, description="是否导出0否1是默认0"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Response(
* response="200",
* description="暂无"
* )
* )
*/
public function visitList()
{
$all = request()->all();
$list = Visit::with('visitTime')->where(function ($query) use ($all) {
if (isset($all['keyword'])) {
$query->where('name', 'like', '%' . $all['keyword'] . '%');
}
if (isset($all['audit_status'])) {
$query->where('audit_status', $all['audit_status']);
}
if (isset($all['start_date']) && isset($all['end_date'])) {
$query->whereBetween('date', [$all['start_date'], $all['end_date']]);
}
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc')->paginate($all['page_size'] ?? 20);;
return $this->success($list);
}
/**
* @OA\Get(
* path="/api/admin/gate/use-code",
* tags={"门岗-核销"},
* 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="type", in="query", @OA\Schema(type="string"), required=false, description="1进厂2离厂"),
* @OA\Response(
* response="200",
* description="暂无"
* )
* )
*/
public function useCode()
{
$all = \request()->all();
$messages = [
'code.required' => '编号必填',
'type.required' => '类型必填',
'admin_id.required' => '操作人必填'
];
$validator = Validator::make($all, [
'code' => 'required',
'type' => 'required',
'admin_id' => 'required'
], $messages);
if ($validator->fails()) {
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
}
$remark = '进厂';
if ($all['type'] == 2) {
$remark = '离厂';
}
$gateLog = GateLog::add($all['admin_id'], $all['code'], $remark);
if ($all['type'] == 1) {
Visit::where('code', $all['code'])->update(['audit_status' => 3]);
}
if ($all['type'] == 2) {
Visit::where('code', $all['code'])->update(['audit_status' => 4]);
}
return $this->success($gateLog);
}
}

@ -87,6 +87,7 @@ class StudyController extends CommonController
* @OA\Parameter(name="rate", in="query", @OA\Schema(type="string"), required=false, description="通过正确率"),
* @OA\Parameter(name="minute", in="query", @OA\Schema(type="string"), required=false, description="最低学习分钟数"),
* @OA\Parameter(name="content", in="query", @OA\Schema(type="string"), required=false, description="内容"),
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=false, description="类型1访客2施工3车辆"),
* @OA\Parameter(name="file", in="query", @OA\Schema(type="string"), required=false, description="文件id数组"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Response(

@ -2,6 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Models\Visit;
use App\Models\VisitAudit;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
@ -19,6 +20,10 @@ class VisitAuditController extends CommonController
* tags={"拜访审核"},
* summary="列表",
* description="",
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=false, description="类型1访客2施工3车辆"),
* @OA\Parameter(name="myself_accept", in="query", @OA\Schema(type="string"), required=false, description="是否只看自己的被访数据0否1是"),
* @OA\Parameter(name="myself_audit", in="query", @OA\Schema(type="string"), required=false, description="是否只看自己的审核数据0否1是"),
* @OA\Parameter(name="audit_status", in="query", @OA\Schema(type="string"), required=false, description="审核状态-1待学习0待审核1通过(待进厂)2驳回3已进厂4已离厂"),
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="string"), required=false, description="每页显示的条数"),
* @OA\Parameter(name="page", in="query", @OA\Schema(type="string"), required=false, description="页码"),
* @OA\Parameter(name="sort_name", in="query", @OA\Schema(type="string"), required=false, description="排序字段名字"),
@ -34,8 +39,20 @@ class VisitAuditController extends CommonController
{
$all = request()->all();
$list = VisitAudit::with('visit')->where(function ($query) use ($all) {
$query->where('audit_admin_id', $this->getUserId());
if (isset($all['myself_audit']) && !empty($all['myself_audit'])) {
$query->where('audit_admin_id', $this->getUserId());
}
$query->whereHas('visit', function ($q) use ($all) {
if (isset($all['audit_status'])) {
$q->where('audit_status', $all['audit_status']);
}
if (isset($all['type'])) {
$q->where('type', $all['type']);
}
if (isset($all['myself_accept']) && !empty($all['myself_accept'])) {
$q->where('accept_admin_id', $this->getUserId());
}
});
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc')
->paginate($all['page_size'] ?? 20);
return $this->success($list);
@ -84,6 +101,7 @@ class VisitAuditController extends CommonController
* @OA\Parameter(name="audit_admin_id", in="query", @OA\Schema(type="string"), required=true, description="审核人员id"),
* @OA\Parameter(name="status", in="query", @OA\Schema(type="string"), required=false, description="状态0待审核1通过2驳回"),
* @OA\Parameter(name="reason", in="query", @OA\Schema(type="string"), required=false, description="原因"),
* @OA\Parameter(name="level", in="query", @OA\Schema(type="string"), required=false, description="审核次序"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Response(
* response="200",
@ -114,6 +132,9 @@ class VisitAuditController extends CommonController
}
$model->fill($all);
$model->save();
// 如果全部审核通过则拜访通过
$noPass = VisitAudit::where('visit_id', $all['visit_id'])->whereIn('status', [0, 2])->count();
if (empty($noPass)) Visit::where('id', $all['visit_id'])->update(['audit_status' => 1]);
DB::commit();
return $this->success('更新成功');
} catch (\Exception $exception) {

@ -21,7 +21,7 @@ class VisitController extends CommonController
* summary="列表",
* description="",
* @OA\Parameter(name="keyword", in="query", @OA\Schema(type="string"), required=false, description="关键词"),
* @OA\Parameter(name="audit_status", in="query", @OA\Schema(type="string"), required=false, description="审核状态0待审核1通过2驳回"),
* @OA\Parameter(name="audit_status", in="query", @OA\Schema(type="string"), required=false, description="审核状态-1待学习0待审核1通过(待进厂)2驳回3已进厂4已离厂"),
* @OA\Parameter(name="start_date", in="query", @OA\Schema(type="string"), required=false, description="开始日期"),
* @OA\Parameter(name="end_date", in="query", @OA\Schema(type="string"), required=false, description="结束日期"),
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="string"), required=false, description="每页显示的条数"),
@ -132,6 +132,11 @@ class VisitController extends CommonController
* @OA\Parameter(name="plate", in="query", @OA\Schema(type="string"), required=false, description="车牌号"),
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=false, description="类型1访客2施工3车辆"),
* @OA\Parameter(name="long_time", in="query", @OA\Schema(type="string"), required=false, description="是否长期0否1是"),
* @OA\Parameter(name="accept_admin_sign", in="query", @OA\Schema(type="string"), required=false, description="被访人签字图片id"),
* @OA\Parameter(name="file", in="query", @OA\Schema(type="string"), required=false, description="附件数组"),
* @OA\Parameter(name="accept_goods_admin_id", in="query", @OA\Schema(type="string"), required=false, description="收货人id"),
* @OA\Parameter(name="work_start_time", in="query", @OA\Schema(type="string"), required=false, description="施工开始时间"),
* @OA\Parameter(name="work_end_time", in="query", @OA\Schema(type="string"), required=false, description="施工结束时间"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Response(
* response="200",
@ -159,6 +164,7 @@ class VisitController extends CommonController
$model = new Visit();
$all['admin_id'] = $this->getUserId();
$all['department_id'] = $this->getUser()->department_id;
$all['code'] = randStr(6,true);
}
$model->fill($all);
$model->save();

@ -5,6 +5,8 @@ namespace App\Http\Controllers\Mobile;
use App\Helpers\ResponseCode;
use App\Helpers\StarterResponseCode;
use App\Models\User;
use App\Models\Visit;
use EasyWeChat\Factory;
use Illuminate\Support\Facades\Validator;
class UserController extends CommonController
@ -138,4 +140,65 @@ class UserController extends CommonController
return $this->success($this->guard()->user());
}
/**
* @OA\Get(
* path="/api/mobile/user/my-visit",
* tags={"小程序-拜访列表"},
* summary="列表",
* description="",
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=false, description="类型1访客2施工3车辆"),
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="string"), required=false, description="每页显示的条数"),
* @OA\Parameter(name="page", in="query", @OA\Schema(type="string"), required=false, description="页码"),
* @OA\Parameter(name="sort_name", in="query", @OA\Schema(type="string"), required=false, description="排序字段名字"),
* @OA\Parameter(name="sort_type", in="query", @OA\Schema(type="string"), required=false, description="排序类型"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Response(
* response="200",
* description="暂无"
* )
* )
*/
public function myVisit()
{
$all = request()->all();
$list = Visit::where('user_id', $this->getUserId())
->where(function ($query) use ($all) {
if (isset($all['type'])) {
$query->where('type', $all['type']);
}
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc')
->paginate($all['page_size'] ?? 20);
return $this->success($list);
}
/**
* @OA\Get(
* path="/api/mobile/user/my-visit-detail",
* tags={"小程序-拜访详情"},
* summary="列表",
* description="",
* @OA\Parameter(name="id", in="query", @OA\Schema(type="string"), required=false, description="id"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Response(
* response="200",
* description="暂无"
* )
* )
*/
public function myVisitDetail()
{
$all = \request()->all();
$messages = [
'id.required' => 'Id必填',
];
$validator = Validator::make($all, [
'id' => 'required'
], $messages);
if ($validator->fails()) {
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
}
$detail = Visit::with('visitTime')->find($all['id']);
return $this->success($detail);
}
}

@ -0,0 +1,131 @@
<?php
namespace App\Http\Controllers\Mobile;
use App\Helpers\ResponseCode;
use App\Models\Study;
use App\Models\Visit;
use App\Models\VisitArea;
use App\Models\VisitAudit;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
class VisitController extends CommonController
{
/**
* @OA\Post(
* path="/api/mobile/visit/visit-save",
* tags={"小程序-保存拜访"},
* summary="更新",
* description="",
* @OA\Parameter(name="id", in="query", @OA\Schema(type="int"), required=true, description="Id(存在更新,不存在新增)"),
* @OA\Parameter(name="date", in="query", @OA\Schema(type="string"), required=true, description="到访日期"),
* @OA\Parameter(name="visit_time_id", in="query", @OA\Schema(type="string"), required=false, description="时间段id"),
* @OA\Parameter(name="visit_area_id", in="query", @OA\Schema(type="string"), required=false, description="区域id"),
* @OA\Parameter(name="reason", in="query", @OA\Schema(type="string"), required=false, description="事由"),
* @OA\Parameter(name="remark", in="query", @OA\Schema(type="string"), required=false, description="备注"),
* @OA\Parameter(name="name", in="query", @OA\Schema(type="string"), required=false, description="名字"),
* @OA\Parameter(name="mobile", in="query", @OA\Schema(type="string"), required=false, description="电话"),
* @OA\Parameter(name="credent", in="query", @OA\Schema(type="string"), required=false, description="证件类型1身份证2护照"),
* @OA\Parameter(name="idcard", in="query", @OA\Schema(type="string"), required=false, description="证件号码"),
* @OA\Parameter(name="company_name", in="query", @OA\Schema(type="string"), required=false, description="单位名称"),
* @OA\Parameter(name="follw_people", in="query", @OA\Schema(type="string"), required=false, description="随访人员"),
* @OA\Parameter(name="cars", in="query", @OA\Schema(type="string"), required=false, description="到访车辆"),
* @OA\Parameter(name="start_date", in="query", @OA\Schema(type="string"), required=false, description="开始时间"),
* @OA\Parameter(name="end_date", in="query", @OA\Schema(type="string"), required=false, description="结束时间"),
* @OA\Parameter(name="accpet_department_id", in="query", @OA\Schema(type="string"), required=false, description="接待部门"),
* @OA\Parameter(name="accept_admin_id", in="query", @OA\Schema(type="string"), required=false, description="接待人员"),
* @OA\Parameter(name="plate", in="query", @OA\Schema(type="string"), required=false, description="车牌号"),
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=false, description="类型1访客2施工3车辆"),
* @OA\Parameter(name="long_time", in="query", @OA\Schema(type="string"), required=false, description="是否长期0否1是"),
* @OA\Parameter(name="audit_status", in="query", @OA\Schema(type="string"), required=false, description="审核状态-1待学习0待审核1通过(待进厂)2驳回3已进厂4已离厂"),
* @OA\Parameter(name="file", in="query", @OA\Schema(type="string"), required=false, description="附件数组"),
* @OA\Parameter(name="accept_goods_admin_id", in="query", @OA\Schema(type="string"), required=false, description="收货人id"),
* @OA\Parameter(name="work_start_time", in="query", @OA\Schema(type="string"), required=false, description="施工开始时间"),
* @OA\Parameter(name="work_end_time", in="query", @OA\Schema(type="string"), required=false, description="施工结束时间"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Response(
* response="200",
* description="暂无"
* )
* )
*/
public function visitSave()
{
$all = \request()->all();
$messages = [
'name.required' => '名称必填',
'visit_area_id.required' => '区域id必填'
];
$validator = Validator::make($all, [
'name' => 'required',
'visit_area_id' => 'required'
], $messages);
if ($validator->fails()) {
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
}
DB::beginTransaction();
try {
if (isset($all['id'])) {
$model = Visit::find($all['id']);
} else {
$model = new Visit();
$all['user_id'] = $this->getUserId();
$all['code'] = randStr(6, true);
}
$model->fill($all);
$model->save();
// 创建时候审核流程写入
$area = VisitArea::find($all['visit_area_id']);
if ($area->audit_admin && !isset($all['id'])) {
$audit_admin = collect($area->audit_admin)->sortBy('level');
foreach ($audit_admin as $item) {
VisitAudit::create([
'visit_id' => $model->id,
'audit_admin_id' => $item->admin_id,
'status' => 0,
'level' => $item->level
]);
}
}
DB::commit();
return $this->success('更新成功');
} catch (\Exception $exception) {
DB::rollBack();
return $this->fail([$exception->getCode(), $exception->getMessage()]);
}
}
/**
* @OA\Get(
* path="/api/mobile/visit/get-ask",
* tags={"小程序-获取学习内容"},
* summary="列表",
* description="",
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=false, description="类型1访客2施工3车辆"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Response(
* response="200",
* description="暂无"
* )
* )
*/
public function getAsk()
{
$all = \request()->all();
$messages = [
'type.required' => '类型必填'
];
$validator = Validator::make($all, [
'type' => 'required'
], $messages);
if ($validator->fails()) {
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
}
$detail = Study::with('asks')->where('type', $all['type'])->first();
return $this->success($detail);
}
}

@ -498,3 +498,24 @@ function getHttp(){
}
return 'http';
}
/**
* 生成随机字符串
* @param int $num
* @param false $numc
* @return string
*/
function randStr($num = 6, $numc = false)
{
$str = '1234567890abcdefghijklmnopqrstuvwxyz';
$w = 35;
if ($numc) {
$str = '1234567890';
$w = 9;
}
$encrypt = '';
for ($i = 0; $i < $num; $i++) {
$encrypt .= $str[mt_rand(0, $w)];
}
return $encrypt;
}

@ -5,4 +5,13 @@ class Blacklist extends SoftDeletesModel
{
protected $guarded = ['id'];
}
protected $appends = ['file_detail'];
public function getFileDetailAttribute()
{
if (empty($this->file)) {
return [];
}
return Upload::whereIn('id', $this->file)->get();
}
}

@ -0,0 +1,18 @@
<?php
namespace App\Models;
class GateLog extends SoftDeletesModel
{
protected $guarded = ['id'];
public static function add($admin_id, $code = '', $remark = '')
{
return self::create([
'admin_id' => $admin_id,
'code' => $code,
'remark' => $remark
]);
}
}

@ -1,12 +1,27 @@
<?php
namespace App\Models;
class Study extends SoftDeletesModel
{
protected $guarded = ['id'];
protected $guarded = ['id'];
protected $casts = [
'file' => 'array'
];
protected $appends = ['file_detail'];
public function asks()
{
return $this->hasMany(StudyAsk::class, 'study_id', 'id');
}
public function asks(){
return $this->hasMany(StudyAsk::class,'study_id','id');
}
public function getFileDetailAttribute()
{
if (empty($this->file)) {
return [];
}
return Upload::whereIn('id', $this->file)->get();
}
}

@ -6,13 +6,22 @@ class Visit extends SoftDeletesModel
{
protected $guarded = ['id'];
protected $appends = ['type_text', 'audit_status_text'];
protected $appends = ['type_text', 'audit_status_text', 'file_detail'];
protected $casts = [
'follw_people' => 'array',
'cars' => 'array'
'cars' => 'array',
'file' => 'array'
];
public function getFileDetailAttribute()
{
if (empty($this->file)) {
return [];
}
return Upload::whereIn('id', $this->file)->get();
}
public function getTypeTextAttribute()
{
$array = [1 => '普通访客', 2 => '施工访客', 3 => '物流访客'];
@ -21,16 +30,18 @@ class Visit extends SoftDeletesModel
public function getAuditStatusTextAttribute()
{
$array = [0 => '待审核', 1 => '通过', 2 => '驳回'];
$array = [-1 => '待学习', 0 => '待审核', 1 => '通过', 2 => '驳回', 3 => '已进厂', 4 => '已离厂'];
return $array[$this->type] ?? '';
}
public function visitTime(){
return $this->hasOne(VisitTime::class,'id','visit_time_id');
public function visitTime()
{
return $this->hasOne(VisitTime::class, 'id', 'visit_time_id');
}
public function admin(){
return $this->hasOne(Admin::class,'id','admin_id');
public function admin()
{
return $this->hasOne(Admin::class, 'id', 'admin_id');
}
}

@ -1,8 +1,12 @@
<?php
namespace App\Models;
class VisitArea extends SoftDeletesModel
{
protected $guarded = ['id'];
protected $guarded = ['id'];
}
protected $casts = [
'audit_admin' => 'array'
];
}

@ -13,6 +13,7 @@
"laravel/framework": "^9.2",
"laravel/sanctum": "^2.15",
"laravel/tinker": "^2.7",
"overtrue/wechat": "~5.0",
"rap2hpoutre/fast-excel": "^5.1",
"spatie/laravel-permission": "^5.5",
"zircote/swagger-php": "^4.2"
@ -66,7 +67,10 @@
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"easywechat-composer/easywechat-composer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true

@ -4,6 +4,8 @@ use Illuminate\Support\Facades\Facade;
return [
'wechat_appid' => '',
'wechat_appsecret' => '',
/*
|--------------------------------------------------------------------------
| Application Name
@ -41,7 +43,7 @@ return [
|
*/
'debug' => (bool) env('APP_DEBUG', false),
'debug' => (bool)env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------

@ -36,7 +36,7 @@ class CreateVisitsTable extends Migration
$table->string('plate')->comment('车牌号')->nullable();
$table->string('type')->default('1')->comment('类型1访客2施工3车辆')->nullable();
$table->boolean('long_time')->comment('是否长期0否1是')->nullable();
$table->boolean('audit_status')->comment('审核状态0待审核1通过2驳回')->nullable()->default(0);
$table->boolean('audit_status')->comment('审核状态-1待学习0待审核1通过(待进厂)2驳回3已进厂4已离厂')->nullable()->default(0);
$table->timestamps();
$table->softDeletes();
});

@ -21,6 +21,7 @@ class CreateVisitAuditsTable extends Migration
$table->integer('audit_admin_id')->comment('审核人员id');
$table->integer('status')->comment('状态0待审核1通过2驳回')->nullable();
$table->string('reason')->comment('原因')->nullable();
$table->boolean('level')->comment('等级')->nullable()->default(1);
$table->timestamps();
$table->softDeletes();
});

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('visits', function (Blueprint $table) {
$table->integer('user_id')->comment('用户id')->nullable();
$table->string('code')->comment('编号')->nullable();
$table->string('accept_admin_sign')->comment('被访人签字图片id')->nullable();
$table->json('file')->nullable()->comment('附件id数组');
$table->string('accept_goods_admin_id')->comment('收货人id')->nullable();
$table->date('work_start_time')->comment('施工开始时间')->nullable();
$table->date('work_end_time')->comment('施工结束时间')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('visits', function (Blueprint $table) {
$table->dropColumn('user_id');
$table->dropColumn('code');
$table->dropColumn('accept_admin_sign');
$table->dropColumn('file');
$table->dropColumn('accept_goods_admin_id');
$table->dropColumn('work_start_time');
$table->dropColumn('work_end_time');
});
}
};

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('studies', function (Blueprint $table) {
$table->string('type')->default('1')->comment('类型1访客2施工3车辆')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('studies', function (Blueprint $table) {
$table->dropColumn('type');
});
}
};

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateGateLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('gate_logs', function (Blueprint $table) {
$table->increments('id');
$table->integer('admin_id')->nullable();
$table->string('code', 50)->nullable();
$table->string('remark')->nullable();
$table->dateTime('created_at')->nullable();
$table->dateTime('updated_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('gate_logs');
}
}

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('blacklists', function (Blueprint $table) {
$table->string('remark')->nullable()->comment('备注');
$table->string('company_name')->nullable()->comment('单位名字');
$table->json('file')->nullable()->comment('附件');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('blacklists', function (Blueprint $table) {
$table->dropColumn('remark');
$table->dropColumn('company_name');
$table->dropColumn('file');
});
}
};

@ -19,6 +19,11 @@ Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
});
// 门岗管理
Route::get("admin/gate/user-list", [\App\Http\Controllers\Admin\GateController::class, "uerList"]);
Route::get("admin/gate/visit-list", [\App\Http\Controllers\Admin\GateController::class, "visitList"]);
Route::get("admin/gate/use-code", [\App\Http\Controllers\Admin\GateController::class, "useCode"]);
// 后台
Route::group(["namespace" => "Admin", "prefix" => "admin", "middleware" => "sanctum.jwt:admin,rbac"], function () {
// 配置管理
@ -72,11 +77,13 @@ Route::group(["namespace" => "Admin", "prefix" => "admin", "middleware" => "sanc
// 前台
Route::group(["namespace" => "Mobile", "prefix" => "mobile"], function () {
// 用户管理
Route::get('user/login', [\App\Http\Controllers\Mobile\UserController::class, 'login']);
Route::post('user/save', [\App\Http\Controllers\Mobile\UserController::class, 'save']);
Route::get('user/mobile', [\App\Http\Controllers\Mobile\UserController::class, 'mobile']);
Route::get('user/show', [\App\Http\Controllers\Mobile\UserController::class, 'show']);
Route::get('user/my-visit', [\App\Http\Controllers\Mobile\UserController::class, 'myVisit']);
Route::get('user/my-visit-detail', [\App\Http\Controllers\Mobile\UserController::class, 'myVisitDetail']);
Route::post('user/visit-save', [\App\Http\Controllers\Mobile\UserController::class, 'visitSave']);
Route::get('user/get-ask', [\App\Http\Controllers\Mobile\UserController::class, 'getAsk']);
});

Loading…
Cancel
Save