|
@@ -109,9 +109,6 @@ class FormService implements FormServiceInterface
|
|
|
try {
|
|
|
// 构建查询
|
|
|
$query = GlobalTable::query()
|
|
|
- ->when(!empty($data['website_id']), function($q) use ($data) {
|
|
|
- return $q->where('website_id', $data['website_id']);
|
|
|
- })
|
|
|
->when(!empty($data['name']), function($q) use ($data) {
|
|
|
return $q->where('name', 'like', '%' . $data['name'] . '%');
|
|
|
});
|
|
@@ -139,18 +136,9 @@ class FormService implements FormServiceInterface
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- // 获取并合并 website 数据
|
|
|
- $websites = Db::connection('secondary')
|
|
|
- ->table('website')
|
|
|
- ->whereIn('id', $list->pluck('website_id'))
|
|
|
- ->pluck('website_name', 'id');
|
|
|
-
|
|
|
// 合并数据并返回
|
|
|
return Result::success([
|
|
|
- 'list' => $list->map(function($item) use ($websites) {
|
|
|
- $item->website_name = $websites[$item->website_id] ?? '';
|
|
|
- return $item;
|
|
|
- }),
|
|
|
+ 'list' => $list,
|
|
|
'total' => $total,
|
|
|
'page' => $page,
|
|
|
'pageSize' => $pageSize
|
|
@@ -507,7 +495,7 @@ class FormService implements FormServiceInterface
|
|
|
{
|
|
|
try {
|
|
|
$globalTable = GlobalTable::where('id',$data['table_id'])->first();
|
|
|
- $websiteInfo = Website::where('id',$globalTable['website_id'])->first();
|
|
|
+ $websiteInfo = Website::where('id',$data['website_id'])->first();
|
|
|
if(empty($websiteInfo)){
|
|
|
return Result::error('网站不存在');
|
|
|
}else{
|