wip
This commit is contained in:
24
app/common/middleware/CheckLogin.php
Normal file
24
app/common/middleware/CheckLogin.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\middleware;
|
||||
use app\common\Trait\ApiResponse;
|
||||
use think\facade\Session;
|
||||
class CheckLogin
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
/**
|
||||
* 处理请求
|
||||
* @param \think\Request $request
|
||||
* @param \Closure $next
|
||||
* @return Response
|
||||
*/
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
if (!Session::has('user_info')) {
|
||||
return $this->error('未登录', [], 401);
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class TicketService
|
||||
private function applyScope($query, TicketScope $scope): void
|
||||
{
|
||||
match ($scope->type) {
|
||||
'admin' => null,
|
||||
'client' => null,
|
||||
'staff' => $query->where(fn($q) => $q
|
||||
->where('status', Tickets::STATUS_UNASSIGNED)
|
||||
->where('user_id', $scope->staffId)),
|
||||
@@ -141,6 +141,8 @@ class TicketService
|
||||
throw new \Exception('工单不存在');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 提取 $allowFields 允许修改的字段
|
||||
$updateData = [];
|
||||
foreach ($allowFields as $field) {
|
||||
|
||||
Reference in New Issue
Block a user