群创建 代码优化

This commit is contained in:
wong
2025-08-29 09:51:00 +08:00
parent e050da41e5
commit 26e519bec0
6 changed files with 570 additions and 82 deletions

View File

@@ -248,7 +248,7 @@ class WorkbenchController extends Controller
if (!empty($item->momentsSync)) {
$item->config = $item->momentsSync;
$item->config->devices = json_decode($item->config->devices, true);
$item->config->contentLibraries = json_decode($item->config->contentLibraries, true);
$item->config->contentGroups = json_decode($item->config->contentLibraries, true);
//同步记录
$sendNum = Db::name('workbench_moments_sync_item')->where(['workbenchId' => $item->id])->count();
$item->syncCount = $sendNum;
@@ -257,15 +257,14 @@ class WorkbenchController extends Controller
// 获取内容库名称
if (!empty($item->config->contentLibraries)) {
$libraryNames = ContentLibrary::whereIn('id', $item->config->contentLibraries)
->column('name');
$item->config->contentLibraryNames = $libraryNames;
if (!empty($item->config->contentGroups)) {
$libraryNames = ContentLibrary::where('id', 'in', $item->config->contentGroups)->select();
$item->config->contentGroupsOptions = $libraryNames;
} else {
$item->config->contentLibraryNames = [];
$item->config->contentGroupsOptions = [];
}
}
unset($item->momentsSync, $item->moments_sync);
unset($item->momentsSync, $item->moments_sync,$item->config->contentLibraries);
break;
case self::TYPE_GROUP_PUSH:
if (!empty($item->groupPush)) {