代码提交

This commit is contained in:
wong
2025-08-22 10:23:05 +08:00
parent 0681c69d67
commit d726be7d66
12 changed files with 363 additions and 23 deletions

View File

@@ -58,7 +58,7 @@ class WorkbenchController extends Controller
$workbench = new Workbench;
$workbench->name = $param['name'];
$workbench->type = $param['type'];
$workbench->status = 1;
$workbench->status = !empty($param['status']) ? 1 : 0;
$workbench->autoStart = !empty($param['autoStart']) ? 1 : 0;
$workbench->userId = $userInfo['id'];
$workbench->companyId = $userInfo['companyId'];
@@ -131,6 +131,8 @@ class WorkbenchController extends Controller
$config->maxGroupsPerDay = $param['maxGroupsPerDay'];
$config->groupNameTemplate = $param['groupNameTemplate'];
$config->groupDescription = $param['groupDescription'];
$config->poolGroups = json_encode($param['poolGroups'] ?? []);
$config->wechatGroups = json_encode($param['wechatGroups'] ?? []);
$config->createTime = time();
$config->updateTime = time();
$config->save();
@@ -201,7 +203,7 @@ class WorkbenchController extends Controller
$query->field('workbenchId,pushType,startTime,endTime,maxPerDay,pushOrder,isLoop,status,groups,contentLibraries');
},
'groupCreate' => function($query) {
$query->field('workbenchId,devices,startTime,endTime,groupSizeMin,groupSizeMax,maxGroupsPerDay,groupNameTemplate,groupDescription');
$query->field('workbenchId,devices,startTime,endTime,groupSizeMin,groupSizeMax,maxGroupsPerDay,groupNameTemplate,groupDescription,poolGroups,wechatGroups');
},
'user' => function ($query) {
$query->field('id,username');
@@ -277,7 +279,7 @@ class WorkbenchController extends Controller
$item->config->status = $item->config->status;
$item->config->groups = json_decode($item->config->groups, true);
$item->config->contentLibraries = json_decode($item->config->contentLibraries, true);
$item->config->lastPushTime = '22222';
$item->config->lastPushTime = '';
}
unset($item->groupPush, $item->group_push);
break;
@@ -285,6 +287,8 @@ class WorkbenchController extends Controller
if (!empty($item->groupCreate)) {
$item->config = $item->groupCreate;
$item->config->devices = json_decode($item->config->devices, true);
$item->config->poolGroups = json_decode($item->config->poolGroups, true);
$item->config->wechatGroups = json_decode($item->config->wechatGroups, true);
}
unset($item->groupCreate, $item->group_create);
break;
@@ -391,7 +395,7 @@ class WorkbenchController extends Controller
$query->field('workbenchId,pushType,startTime,endTime,maxPerDay,pushOrder,isLoop,status,groups,contentLibraries');
},
'groupCreate' => function($query) {
$query->field('workbenchId,devices,startTime,endTime,groupSizeMin,groupSizeMax,maxGroupsPerDay,groupNameTemplate,groupDescription');
$query->field('workbenchId,devices,startTime,endTime,groupSizeMin,groupSizeMax,maxGroupsPerDay,groupNameTemplate,groupDescription,poolGroups,wechatGroups');
}
];
$workbench = Workbench::where([
@@ -466,6 +470,8 @@ class WorkbenchController extends Controller
if (!empty($workbench->groupCreate)) {
$workbench->config = $workbench->groupCreate;
$workbench->config->deveiceGroups = json_decode($workbench->config->devices, true);
$workbench->config->poolGroups = json_decode($workbench->config->poolGroups, true);
$workbench->config->wechatGroups = json_decode($workbench->config->wechatGroups, true);
unset($workbench->groupCreate, $workbench->group_create);
}
break;
@@ -600,6 +606,21 @@ class WorkbenchController extends Controller
$workbench->config->accountGroupsOptions = [];
}
if (!empty($workbench->config->poolGroups)){
$poolGroupsOptions = Db::name('traffic_source_package')->alias('tsp')
->join('traffic_source_package_item tspi','tspi.packageId=tsp.id','left')
->whereIn('tsp.companyId', [$this->request->userInfo['companyId'],0])
->whereIn('tsp.id', $workbench->config->poolGroups)
->field('tsp.id,tsp.name,tsp.description,tsp.createTime,count(tspi.id) as num')
->group('tsp.id')
->select();
$workbench->config->poolGroupsOptions = $poolGroupsOptions;
}else{
$workbench->config->poolGroupsOptions = [];
}
return json(['code' => 200, 'msg' => '获取成功', 'data' => $workbench]);
}
@@ -636,6 +657,7 @@ class WorkbenchController extends Controller
try {
// 更新工作台基本信息
$workbench->name = $param['name'];
$workbench->status = !empty($param['status']) ? 1 : 0;
$workbench->autoStart = !empty($param['autoStart']) ? 1 : 0;
$workbench->updateTime = time();
$workbench->save();
@@ -720,6 +742,8 @@ class WorkbenchController extends Controller
$config->maxGroupsPerDay = $param['maxGroupsPerDay'];
$config->groupNameTemplate = $param['groupNameTemplate'];
$config->groupDescription = $param['groupDescription'];
$config->poolGroups = json_encode($param['poolGroups'] ?? []);
$config->wechatGroups = json_encode($param['wechatGroups'] ?? []);
$config->updateTime = time();
$config->save();
}
@@ -859,7 +883,8 @@ class WorkbenchController extends Controller
$newConfig->contentTypes = $config->contentTypes;
$newConfig->devices = $config->devices;
$newConfig->friends = $config->friends;
//$newConfig->targetGroups = $config->targetGroups;
$newConfig->createTime = time();
$newConfig->updateTime = time();
$newConfig->save();
}
break;
@@ -876,6 +901,8 @@ class WorkbenchController extends Controller
$newConfig->accountType = $config->accountType;
$newConfig->devices = $config->devices;
$newConfig->contentLibraries = $config->contentLibraries;
$newConfig->createTime = time();
$newConfig->updateTime = time();
$newConfig->save();
}
break;
@@ -893,6 +920,8 @@ class WorkbenchController extends Controller
$newConfig->status = $config->status;
$newConfig->groups = $config->groups;
$newConfig->contentLibraries = $config->contentLibraries;
$newConfig->createTime = time();
$newConfig->updateTime = time();
$newConfig->save();
}
break;
@@ -909,6 +938,8 @@ class WorkbenchController extends Controller
$newConfig->maxGroupsPerDay = $config->maxGroupsPerDay;
$newConfig->groupNameTemplate = $config->groupNameTemplate;
$newConfig->groupDescription = $config->groupDescription;
$newConfig->poolGroups = $config->poolGroups;
$newConfig->wechatGroups = $config->wechatGroups;
$newConfig->createTime = time();
$newConfig->updateTime = time();
$newConfig->save();