diff --git a/app/Http/Controllers/Admin/BlacklistController.php b/app/Http/Controllers/Admin/BlacklistController.php index 21331a9..3b011a5 100644 --- a/app/Http/Controllers/Admin/BlacklistController.php +++ b/app/Http/Controllers/Admin/BlacklistController.php @@ -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('删除成功'); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/Admin/GateController.php b/app/Http/Controllers/Admin/GateController.php new file mode 100644 index 0000000..3386c75 --- /dev/null +++ b/app/Http/Controllers/Admin/GateController.php @@ -0,0 +1,125 @@ +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); + } + +} diff --git a/app/Http/Controllers/Admin/StudyController.php b/app/Http/Controllers/Admin/StudyController.php index f91574b..37adea7 100644 --- a/app/Http/Controllers/Admin/StudyController.php +++ b/app/Http/Controllers/Admin/StudyController.php @@ -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( diff --git a/app/Http/Controllers/Admin/VisitAuditController.php b/app/Http/Controllers/Admin/VisitAuditController.php index fc317f1..82d5b25 100644 --- a/app/Http/Controllers/Admin/VisitAuditController.php +++ b/app/Http/Controllers/Admin/VisitAuditController.php @@ -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) { diff --git a/app/Http/Controllers/Admin/VisitController.php b/app/Http/Controllers/Admin/VisitController.php index f8fd102..06943af 100644 --- a/app/Http/Controllers/Admin/VisitController.php +++ b/app/Http/Controllers/Admin/VisitController.php @@ -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(); diff --git a/app/Http/Controllers/Mobile/UserController.php b/app/Http/Controllers/Mobile/UserController.php index 5c938d8..127d052 100644 --- a/app/Http/Controllers/Mobile/UserController.php +++ b/app/Http/Controllers/Mobile/UserController.php @@ -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); + } + } diff --git a/app/Http/Controllers/Mobile/VisitController.php b/app/Http/Controllers/Mobile/VisitController.php new file mode 100644 index 0000000..31f86d7 --- /dev/null +++ b/app/Http/Controllers/Mobile/VisitController.php @@ -0,0 +1,131 @@ +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); + } + + +} diff --git a/app/Http/functions.php b/app/Http/functions.php index 2c97c35..92a31a8 100755 --- a/app/Http/functions.php +++ b/app/Http/functions.php @@ -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; +} diff --git a/app/Models/Blacklist.php b/app/Models/Blacklist.php index 9c9bad7..f5b9f5e 100644 --- a/app/Models/Blacklist.php +++ b/app/Models/Blacklist.php @@ -5,4 +5,13 @@ class Blacklist extends SoftDeletesModel { protected $guarded = ['id']; -} \ No newline at end of file + protected $appends = ['file_detail']; + + public function getFileDetailAttribute() + { + if (empty($this->file)) { + return []; + } + return Upload::whereIn('id', $this->file)->get(); + } +} diff --git a/app/Models/GateLog.php b/app/Models/GateLog.php new file mode 100644 index 0000000..866e119 --- /dev/null +++ b/app/Models/GateLog.php @@ -0,0 +1,18 @@ + $admin_id, + 'code' => $code, + 'remark' => $remark + ]); + } + +} diff --git a/app/Models/Study.php b/app/Models/Study.php index 9c2c3a8..86fdf41 100644 --- a/app/Models/Study.php +++ b/app/Models/Study.php @@ -1,12 +1,27 @@ '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(); + } } diff --git a/app/Models/Visit.php b/app/Models/Visit.php index 22ff511..3a8859c 100644 --- a/app/Models/Visit.php +++ b/app/Models/Visit.php @@ -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'); } } diff --git a/app/Models/VisitArea.php b/app/Models/VisitArea.php index dc355bb..8594ec2 100644 --- a/app/Models/VisitArea.php +++ b/app/Models/VisitArea.php @@ -1,8 +1,12 @@ 'array' + ]; +} diff --git a/composer.json b/composer.json index 5084cf2..0a8c29d 100644 --- a/composer.json +++ b/composer.json @@ -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 diff --git a/config/app.php b/config/app.php index 1240c3a..06c1ce7 100644 --- a/config/app.php +++ b/config/app.php @@ -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), /* |-------------------------------------------------------------------------- diff --git a/database/migrations/2023_03_08_103347_create_visits_table.php b/database/migrations/2023_03_08_103347_create_visits_table.php index 8b0f1c4..4f3ce94 100644 --- a/database/migrations/2023_03_08_103347_create_visits_table.php +++ b/database/migrations/2023_03_08_103347_create_visits_table.php @@ -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(); }); diff --git a/database/migrations/2023_03_08_104541_create_visit_audits_table.php b/database/migrations/2023_03_08_104541_create_visit_audits_table.php index 3170c06..a7b6131 100644 --- a/database/migrations/2023_03_08_104541_create_visit_audits_table.php +++ b/database/migrations/2023_03_08_104541_create_visit_audits_table.php @@ -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(); }); diff --git a/database/migrations/2023_03_09_091636_alert_visits_table.php b/database/migrations/2023_03_09_091636_alert_visits_table.php new file mode 100644 index 0000000..b897373 --- /dev/null +++ b/database/migrations/2023_03_09_091636_alert_visits_table.php @@ -0,0 +1,43 @@ +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'); + }); + } +}; diff --git a/database/migrations/2023_03_09_095237_alert_studies_table.php b/database/migrations/2023_03_09_095237_alert_studies_table.php new file mode 100644 index 0000000..1a03a0c --- /dev/null +++ b/database/migrations/2023_03_09_095237_alert_studies_table.php @@ -0,0 +1,31 @@ +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'); + }); + } +}; diff --git a/database/migrations/2023_03_09_112430_create_gate_logs_table.php b/database/migrations/2023_03_09_112430_create_gate_logs_table.php new file mode 100644 index 0000000..1c3f425 --- /dev/null +++ b/database/migrations/2023_03_09_112430_create_gate_logs_table.php @@ -0,0 +1,35 @@ +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'); + } +} diff --git a/database/migrations/2023_03_09_142624_alert_blacklists_table.php b/database/migrations/2023_03_09_142624_alert_blacklists_table.php new file mode 100644 index 0000000..3e3e921 --- /dev/null +++ b/database/migrations/2023_03_09_142624_alert_blacklists_table.php @@ -0,0 +1,36 @@ +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'); + }); + } +}; diff --git a/routes/api.php b/routes/api.php index b082df0..e800b65 100644 --- a/routes/api.php +++ b/routes/api.php @@ -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']); });