1
This commit is contained in:
@@ -49,4 +49,16 @@ class CategorieController extends BaseController
|
|||||||
return $this->error($th->getMessage().' '.$th->getLine().' '.$th->getFile());
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ class AttachmentLogic
|
|||||||
'data' => $data,
|
'data' => $data,
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
]);
|
]);
|
||||||
throw new BusinessException($e->getMessage().'工单创建失败,请稍后重试', 500);
|
throw new BusinessException('工单创建失败,请稍后重试', 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ class AttachmentLogic
|
|||||||
'data' => $data,
|
'data' => $data,
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
]);
|
]);
|
||||||
throw new BusinessException($e->getMessage().'工单创建失败,请稍后重试', 500);
|
throw new BusinessException('工单创建失败,请稍后重试', 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class CategorieLogic
|
|||||||
'data' => $data,
|
'data' => $data,
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
]);
|
]);
|
||||||
throw new BusinessException($e->getMessage().'分类创建失败,请稍后重试', 500);
|
throw new BusinessException('分类创建失败,请稍后重试', 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,21 @@ class CategorieLogic
|
|||||||
'data' => $data,
|
'data' => $data,
|
||||||
'error' => $e->getMessage()
|
'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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ class ConversationLogic
|
|||||||
'data' => $data,
|
'data' => $data,
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
]);
|
]);
|
||||||
throw new BusinessException($e->getMessage().'会话编辑失败,请稍后重试', 500);
|
throw new BusinessException('会话编辑失败,请稍后重试', 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ class TicketLogic
|
|||||||
'data' => $data,
|
'data' => $data,
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
]);
|
]);
|
||||||
throw new BusinessException($e->getMessage().'工单创建失败,请稍后重试', 500);
|
throw new BusinessException('工单创建失败,请稍后重试', 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function edit(array $data)
|
public function edit(array $data)
|
||||||
@@ -52,7 +52,7 @@ class TicketLogic
|
|||||||
'data' => $data,
|
'data' => $data,
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
]);
|
]);
|
||||||
throw new BusinessException($e->getMessage().'工单提取方法…失败,请稍后重试', 500);
|
throw new BusinessException('工单提取方法…失败,请稍后重试', 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace app\ticket\model;
|
namespace app\ticket\model;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use support\Model;
|
use support\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,9 +12,11 @@ use support\Model;
|
|||||||
* @property string $description 分类描述
|
* @property string $description 分类描述
|
||||||
* @property string $created_at 创建时间
|
* @property string $created_at 创建时间
|
||||||
* @property string $updated_at 更新时间
|
* @property string $updated_at 更新时间
|
||||||
|
* @property string $deleted_at 删除时间
|
||||||
*/
|
*/
|
||||||
class TicketCategorie extends Model
|
class TicketCategorie extends Model
|
||||||
{
|
{
|
||||||
|
use SoftDeletes;
|
||||||
protected $connection = 'mysql';
|
protected $connection = 'mysql';
|
||||||
protected $table = 'ticket_categorie';
|
protected $table = 'ticket_categorie';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
|||||||
@@ -82,4 +82,16 @@ class CategorieService
|
|||||||
throw $e;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -55,6 +55,7 @@ Route::group('/ticket', function () {
|
|||||||
Route::any('/categorie/edit', [app\ticket\controller\CategorieController::class, 'edit']);
|
Route::any('/categorie/edit', [app\ticket\controller\CategorieController::class, 'edit']);
|
||||||
Route::any('/categorie/list', [app\ticket\controller\CategorieController::class, 'index']);
|
Route::any('/categorie/list', [app\ticket\controller\CategorieController::class, 'index']);
|
||||||
Route::any('/categorie/getAll', [app\ticket\controller\CategorieController::class, 'getAll']);
|
Route::any('/categorie/getAll', [app\ticket\controller\CategorieController::class, 'getAll']);
|
||||||
|
Route::any('/categorie/delete', [app\ticket\controller\CategorieController::class, 'delete']);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user