|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Aside\AiRemove;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Controllers\Aside\BaseController;
|
|
|
|
use App\Models\AiRemove\AiRemove;
|
|
|
|
use App\Models\Manage\Manage;
|
|
|
|
|
|
|
|
class AiRemoveController extends BaseController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 获取去AI痕迹任务列表
|
|
|
|
* @author Akun
|
|
|
|
* @date 2025/11/20 11:35
|
|
|
|
*/
|
|
|
|
public function getTaskLists()
|
|
|
|
{
|
|
|
|
$model = new AiRemove();
|
|
|
|
$lists = $model->lists($this->map, $this->page, $this->row, 'id', ['id', 'user_id', 'status', 'error_msg', 'created_at', 'updated_at']);
|
|
|
|
if (!empty($lists)) {
|
|
|
|
$manage_model = new Manage();
|
|
|
|
foreach ($lists['list'] as $k => $v) {
|
|
|
|
$lists['list'][$k]['operator_name'] = $manage_model->getName($v['user_id']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->response('success', Code::SUCCESS, $lists);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取去AI任务详情
|
|
|
|
* @author Akun
|
|
|
|
* @date 2025/11/20 11:47
|
|
|
|
*/
|
|
|
|
public function taskInfo()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'id' => 'required'
|
|
|
|
], [
|
|
|
|
'id.required' => 'ID不能为空'
|
|
|
|
]);
|
|
|
|
$model = new AiRemove();
|
|
|
|
$info = $model->read(['id' => $this->param['id']]);
|
|
|
|
$this->response('success', Code::SUCCESS, $info);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 提交去AI痕迹任务
|
|
|
|
* @throws \App\Exceptions\AsideGlobalException
|
|
|
|
* @author Akun
|
|
|
|
* @date 2025/11/20 11:41
|
|
|
|
*/
|
|
|
|
public function saveTask()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'origin_text' => 'required',
|
|
|
|
], [
|
|
|
|
'origin_text' => '需要去痕迹的内容不能为空'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
'user_id' => $this->uid,
|
|
|
|
'origin_text' => $this->param['origin_text'],
|
|
|
|
'status' => ['<', AiRemove::STATUS_FAL]
|
|
|
|
];
|
|
|
|
$model = new AiRemove();
|
|
|
|
$task_info = $model->read($data);
|
|
|
|
if ($task_info) {
|
|
|
|
$this->fail('已提交过相同任务,请勿重复提交');
|
|
|
|
}
|
|
|
|
|
|
|
|
$data['status'] = AiRemove::STATUS_UN;
|
|
|
|
$model->add($data);
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|