我的工单

This commit is contained in:
2025-07-11 15:13:44 +08:00
parent d60fc49022
commit 890ddff34b
3 changed files with 23 additions and 0 deletions
@@ -17,6 +17,24 @@ class TicketController extends BaseController
return $this->error($e->getMessage());
}
}
/**
* 我的工单
* @param Request $request
* @return \support\Response
*/
public function self(Request $request)
{
try {
$request->setGet('user_id',$request->user->uid);
$result = (new TicketService())->list($request->all());
return $this->success($result);
// return $this->success($this->page($result));
} catch (\Throwable $e) {
return $this->error($e->getMessage().' '.$e->getLine().' '.$e->getFile().' '.$e->getTraceAsString());
}
}
public function add(Request $request)
{
try {
+4
View File
@@ -20,11 +20,15 @@ class TicketLogic
if(!empty($params['categorie_id'])){
$where[] = ['categorie_id', '=', $params['categorie_id']];
}
if(!empty($params['user_id'])){
$where[] = ['user_id', '=', $params['user_id']];
}
if(!empty($params['status'])){
$where[] = ['status', '=', $params['status']];
}
$size = $params['size'];
$current = $params['current'];
return Ticket::with('attachments')->with('categorie')->with('categorie.translation')->where($where)->orderBy('id','desc')->paginate($size, ['*'], 'page', $current);
}
public function add(array $data)
+1
View File
@@ -59,6 +59,7 @@ Route::group('/ticket', function () {
Route::any('/ticket/add', [app\ticket\controller\TicketController::class, 'add']);
Route::any('/ticket/edit', [app\ticket\controller\TicketController::class, 'edit']);
Route::any('/ticket/list', [app\ticket\controller\TicketController::class, 'index']);
Route::any('/ticket/self', [app\ticket\controller\TicketController::class, 'self']);
Route::any('/ticket/status', [app\ticket\controller\TicketController::class, 'status']);
Route::any('/ticket/getStatus', [app\ticket\controller\TicketController::class, 'getStatus']);