feat(cookieManager): 登录用户去掉Cookie值/域名,登录网站增加关联用户下拉

登录用户:
- 模型删除 cookie_value / domain 两列(连同 to_dict)
- 列表表头、新增/编辑表单移除对应控件;保存/更新不再校验 Cookie 值
  (改为只校验 用户名 + 网站URL)

登录网站:
- CookieSite 新增 cookie_user_id(关联 admin_cookie_user.id,可空)
- 列表新增「关联用户」列,未关联显示灰色「未关联」标签;查询栏支持按用户筛选
- 新增/编辑页用 layui 下拉框选择登录用户(lay-search 可搜索,显示
  “昵称(用户名)· 网站名”),编辑时自动回显已关联项
- Schema 增加 cookie_username 输出字段,视图一次性查用户表做映射,避免逐行查库

迁移 e5f6a7b8c9d0:
- admin_cookie_user 删 cookie_value、domain(SQLite 用 batch 重建表)
- admin_cookie_site 加 cookie_user_id
- 每步先判断列是否存在,可重复执行;downgrade 可还原

注意:升级会丢弃 admin_cookie_user.cookie_value / domain 的历史数据。

已 Playwright 真机验证(本机 :5000):
列表无 Cookie值/域名列、新增页无对应控件、保存成功;
网站新增选中用户后落库 cookie_user_id=1、列表显示“验证用户”、编辑页正确回显。
This commit is contained in:
bwstudio
2026-09-10 20:19:25 +08:00
parent 1b68363bfd
commit 6f4af8664e
11 changed files with 155 additions and 62 deletions
@@ -74,15 +74,6 @@
<input type="checkbox" name="enable" value="{{ d.id }}" lay-skin="switch" lay-text="启用|禁用"
lay-filter="cookie-user-enable" {{# if(d.enable==1){ }} checked {{# } }} />
</script>
<script type="text/html" id="col-cookie-user-value">
{{# var v = d.cookie_value || ''; }}
{{# if(v.length > 30){ }}
<span title="{{ v }}">{{ v.slice(0, 30) }}...</span>
{{# } else { }}
<span>{{ v }}</span>
{{# } }}
</script>
{% endraw %}
<script>
@@ -101,8 +92,6 @@
{title: '昵称', field: 'nickname', align: 'center'},
{title: '网站名称', field: 'website_name', align: 'center'},
{title: '网站链接', field: 'website_url', align: 'center', minWidth: 200},
{title: 'Cookie值', field: 'cookie_value', align: 'center', minWidth: 200, templet: '#col-cookie-user-value'},
{title: '域名', field: 'domain', align: 'center'},
{title: '过期时间', field: 'expiry', align: 'center'},
{title: '状态', field: 'enable', align: 'center', templet: '#cookie-user-enable', width: 100},
{title: '创建时间', field: 'create_at', align: 'center'},