Files
lgp-admin-plus-api/config/media_refs.php
LQ bcf54c2727 初始化
缺陷:主题配色需要优化整体的同风格
2026-08-14 23:21:21 +08:00

49 lines
3.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/*
* 媒体地址字段注册表
*
* ★ 新增任何「存文件地址」的字段后必须登记到这里 ★
*
* 素材库的引用扫描只会去这张表登记过的列里找地址。漏登一个字段,
* 那些正在被使用的文件就会被算成 ref_count = 0出现在「可回收」列表里
* 点一下回收就连远端对象一起删掉了 —— 页面上随即是一片裂图,且不可恢复。
* 宁可多登几列(多扫一遍只是慢一点),也不要漏登。
*
* connection config/database.php 里的连接名:业务表 businesscc_ 前缀)、系统表 mysqlnl_ 前缀)
* table 不带前缀的逻辑名,扫描时由 DB::connection($conn)->table($table) 自动补前缀
* field 列名;列还不存在时扫描会自动跳过,所以可以提前登记规划中的字段
* kind single 整个字段就是一个地址
* multi 逗号分隔的多个地址
* rich 富文本 / Markdown需要正则从 src、href、url() 与 ![](…) 里抽取
*/
return [
/*
* ---------------- LGP 业务表business 连接cc_ 前缀)----------------
*/
['connection' => 'business', 'table' => 'catalogue', 'field' => 'cover', 'kind' => 'single'],
['connection' => 'business', 'table' => 'catalogue', 'field' => 'pdf', 'kind' => 'single'],
// video 列在部分环境还没上线,扫描时按 hasColumn 跳过,不影响其余字段
['connection' => 'business', 'table' => 'catalogue', 'field' => 'video', 'kind' => 'single'],
['connection' => 'business', 'table' => 'image', 'field' => 'url', 'kind' => 'single'],
['connection' => 'business', 'table' => 'carousel', 'field' => 'url', 'kind' => 'single'],
['connection' => 'business', 'table' => 'category', 'field' => 'url', 'kind' => 'single'],
['connection' => 'business', 'table' => 'colorcard', 'field' => 'cover', 'kind' => 'single'],
['connection' => 'business', 'table' => 'factory_info', 'field' => 'cover', 'kind' => 'single'],
['connection' => 'business', 'table' => 'factory_image', 'field' => 'url', 'kind' => 'single'],
['connection' => 'business', 'table' => 'enterprise', 'field' => 'logo', 'kind' => 'single'],
// 微信头像多数是腾讯 CDN 地址,匹配不上任何素材;登记它是为了兜住
// 「后台替用户换成自己上传的头像」这种情况
['connection' => 'business', 'table' => 'wx_user', 'field' => 'avatar', 'kind' => 'single'],
/*
* ---------------- 系统表mysql 连接nl_ 前缀)----------------
*/
['connection' => 'mysql', 'table' => 'admin', 'field' => 'avatar', 'kind' => 'single'],
['connection' => 'mysql', 'table' => 'wechat_article', 'field' => 'cover_url', 'kind' => 'single'],
// 图文正文是 Markdown图片以 ![](url) 的形式散在全文里
['connection' => 'mysql', 'table' => 'wechat_article', 'field' => 'content_md', 'kind' => 'rich'],
// 版本流水存的是历史正文快照:回退到旧版本要能把图找回来,所以一并算引用
['connection' => 'mysql', 'table' => 'wechat_article_version', 'field' => 'content_md', 'kind' => 'rich'],
];