Files
crm-server/app/controller/TagGroupController.php
T
2025-03-26 17:13:11 +08:00

33 lines
877 B
PHP

<?php
namespace app\controller;
use app\model\TagGroup;
use app\util\Util;
use support\Request;
class TagGroupController
{
// 列表
public function list(Request $request)
{
$list = TagGroup::with('tags')->get();
$languageArr = config('translation.fallback_locale');
$language = $request->user['language'];
foreach ($list as &$item) {
$item['names'] = unserialize($item['names']);
if(in_array($language, $languageArr)){
$item['name'] = $item['names'][$language];
}
foreach ($item['tags'] as &$tag) {
$tag['names'] = unserialize($tag['names']);
if(in_array($language, $languageArr)){
$item['name'] = $item['names'][$language];
}
}
}
return Util::success($list);
}
}