This commit is contained in:
2025-07-04 14:38:00 +08:00
parent 345e2391b1
commit 1b73974d46
8 changed files with 49 additions and 7 deletions
@@ -49,4 +49,16 @@ class CategorieController extends BaseController
return $this->error($th->getMessage().' '.$th->getLine().' '.$th->getFile());
}
}
public function delete(Request $request)
{
try {
$result = (new CategorieService())->delete($request->get('id'));
return $result
? $this->success($result)
: $this->error();
} catch (\Throwable $th) {
return $this->error($th->getMessage().' '.$th->getLine().' '.$th->getFile());
}
}
}
+2 -2
View File
@@ -29,7 +29,7 @@ class AttachmentLogic
'data' => $data,
'error' => $e->getMessage()
]);
throw new BusinessException($e->getMessage().'工单创建失败,请稍后重试', 500);
throw new BusinessException('工单创建失败,请稍后重试', 500);
}
}
@@ -67,7 +67,7 @@ class AttachmentLogic
'data' => $data,
'error' => $e->getMessage()
]);
throw new BusinessException($e->getMessage().'工单创建失败,请稍后重试', 500);
throw new BusinessException('工单创建失败,请稍后重试', 500);
}
}
+16 -2
View File
@@ -32,7 +32,7 @@ class CategorieLogic
'data' => $data,
'error' => $e->getMessage()
]);
throw new BusinessException($e->getMessage().'分类创建失败,请稍后重试', 500);
throw new BusinessException('分类创建失败,请稍后重试', 500);
}
}
@@ -46,7 +46,21 @@ class CategorieLogic
'data' => $data,
'error' => $e->getMessage()
]);
throw new BusinessException($e->getMessage().'分类编辑失败,请稍后重试', 500);
throw new BusinessException('分类编辑失败,请稍后重试', 500);
}
}
public function delete(int $id)
{
try {
$categorie = TicketCategorie::where(['id'=>$id])->delete();
return $categorie;
} catch (\Throwable $e) {
Log::error('分类删除失败', [
'id' => $id,
'error' => $e->getMessage()
]);
throw new BusinessException('分类删除失败,请稍后重试', 500);
}
}
}
+1 -1
View File
@@ -40,7 +40,7 @@ class ConversationLogic
'data' => $data,
'error' => $e->getMessage()
]);
throw new BusinessException($e->getMessage().'会话编辑失败,请稍后重试', 500);
throw new BusinessException('会话编辑失败,请稍后重试', 500);
}
}
}
+2 -2
View File
@@ -38,7 +38,7 @@ class TicketLogic
'data' => $data,
'error' => $e->getMessage()
]);
throw new BusinessException($e->getMessage().'工单创建失败,请稍后重试', 500);
throw new BusinessException('工单创建失败,请稍后重试', 500);
}
}
public function edit(array $data)
@@ -52,7 +52,7 @@ class TicketLogic
'data' => $data,
'error' => $e->getMessage()
]);
throw new BusinessException($e->getMessage().'工单提取方法…失败,请稍后重试', 500);
throw new BusinessException('工单提取方法…失败,请稍后重试', 500);
}
}
+3
View File
@@ -2,6 +2,7 @@
namespace app\ticket\model;
use Illuminate\Database\Eloquent\SoftDeletes;
use support\Model;
/**
@@ -11,9 +12,11 @@ use support\Model;
* @property string $description 分类描述
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
* @property string $deleted_at 删除时间
*/
class TicketCategorie extends Model
{
use SoftDeletes;
protected $connection = 'mysql';
protected $table = 'ticket_categorie';
protected $primaryKey = 'id';
+12
View File
@@ -82,4 +82,16 @@ class CategorieService
throw $e;
}
}
public function delete(int $id)
{
if(empty($id)){
throw new BusinessException('id不能为空');
}
try {
$result = (new CategorieLogic())->delete($id);
return $result;
} catch (\Throwable $e) {
throw $e;
}
}
}
+1
View File
@@ -55,6 +55,7 @@ Route::group('/ticket', function () {
Route::any('/categorie/edit', [app\ticket\controller\CategorieController::class, 'edit']);
Route::any('/categorie/list', [app\ticket\controller\CategorieController::class, 'index']);
Route::any('/categorie/getAll', [app\ticket\controller\CategorieController::class, 'getAll']);
Route::any('/categorie/delete', [app\ticket\controller\CategorieController::class, 'delete']);
});