fix: openapi 产品详情不输出links->platform问题

This commit is contained in:
2025-07-04 17:42:23 +08:00
parent f7ced51c4d
commit 90508c8c37
2 changed files with 5 additions and 3 deletions

View File

@@ -83,7 +83,9 @@ class Product
->hidden(['id', 'product_id']),
// 关联购买链接
'links' => fn($query) => $query->field(['product_id', 'platform_id', 'link'])
->with(['platform' => fn($query) => $query->field(['id', 'platform'])])
->with([
'platforms' => fn($query) => $query->field(['id', 'platform'])
])
->hidden(['product_id', 'platform_id']),
// 关联相关产品
'related' => fn($query) => $query->field(['product_id', 'related_product_id'])
@@ -110,7 +112,7 @@ class Product
->bypk($id)
->hidden(['category_id'])
->find();
// dump($product);exit;
// 处理封面图
if (!empty($product['cover_image']) && !str_starts_with($product['cover_image'], 'http')) {
$product['cover_image'] = image_domain_concat($product['cover_image']);