全局配置服务功能提交

This commit is contained in:
wong
2026-01-15 14:24:25 +08:00
parent cec64b889b
commit 430b8eee91
11 changed files with 443 additions and 13 deletions

View File

@@ -79,6 +79,8 @@ class WorkbenchController extends Controller
$workbench->type = $param['type'];
$workbench->status = !empty($param['status']) ? 1 : 0;
$workbench->autoStart = !empty($param['autoStart']) ? 1 : 0;
// 计划类型0=全局1=独立默认1
$workbench->planType = isset($param['planType']) ? intval($param['planType']) : 1;
$workbench->userId = $userInfo['id'];
$workbench->companyId = $userInfo['companyId'];
$workbench->createTime = time();
@@ -133,7 +135,6 @@ class WorkbenchController extends Controller
case self::TYPE_GROUP_CREATE: // 自动建群
$config = new WorkbenchGroupCreate;
$config->workbenchId = $workbench->id;
$config->planType = !empty($param['planType']) ? $param['planType'] : 0;
$config->executorId = !empty($param['executorId']) ? $param['executorId'] : 0;
$config->devices = json_encode($param['deviceGroups'] ?? [], JSON_UNESCAPED_UNICODE);
@@ -295,7 +296,7 @@ class WorkbenchController extends Controller
$list = Workbench::where($where)
->with($with)
->field('id,companyId,name,type,status,autoStart,userId,createTime,updateTime')
->field('id,companyId,name,type,status,autoStart,planType,userId,createTime,updateTime')
->order('id', 'desc')
->page($page, $limit)
->select()
@@ -474,7 +475,7 @@ class WorkbenchController extends Controller
break;
case self::TYPE_IMPORT_CONTACT:
if (!empty($item->importContact)) {
if (!empty($item->importContact)) {
$item->config = $item->importContact;
$item->config->devices = json_decode($item->config->devices, true);
$item->config->poolGroups = json_decode($item->config->pools, true);
@@ -568,7 +569,7 @@ class WorkbenchController extends Controller
$workbench = Workbench::where($where)
->field('id,name,type,status,autoStart,createTime,updateTime,companyId')
->field('id,name,type,status,autoStart,planType,createTime,updateTime,companyId')
->with($with)
->find();
@@ -1187,6 +1188,12 @@ class WorkbenchController extends Controller
$workbench->name = $param['name'];
$workbench->status = !empty($param['status']) ? 1 : 0;
$workbench->autoStart = !empty($param['autoStart']) ? 1 : 0;
// 更新计划类型0=全局1=独立默认保留原值或1
if (isset($param['planType'])) {
$workbench->planType = intval($param['planType']);
} elseif (!isset($workbench->planType) || $workbench->planType === null) {
$workbench->planType = 1;
}
$workbench->updateTime = time();
$workbench->save();
@@ -1457,6 +1464,12 @@ class WorkbenchController extends Controller
$newWorkbench->type = $workbench->type;
$newWorkbench->status = 1; // 新拷贝的默认启用
$newWorkbench->autoStart = $workbench->autoStart;
// 复制计划类型0=全局1=独立默认1
if (isset($workbench->planType)) {
$newWorkbench->planType = intval($workbench->planType);
} else {
$newWorkbench->planType = 1;
}
$newWorkbench->userId = $this->request->userInfo['id'];
$newWorkbench->companyId = $this->request->userInfo['companyId'];
$newWorkbench->save();