feat: 新增测试工作台+tip样式调整+tip/tab位置对调
- 新增测试·无界工作台(所有人可见) - 为所有opc_owner用户添加测试工作台权限 - 预算模块tip改淡黄色+新文案 - 预算/已发生模块tip和tab位置对调(tip在上) - 版本号 v1.2.0.12
This commit is contained in:
@@ -157,3 +157,26 @@ def migrate_rename_zong_to_overview():
|
||||
pass
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def migrate_add_test_tenant():
|
||||
"""为所有 opc_owner 用户添加 测试·无界 工作台权限"""
|
||||
from db import db, mysql
|
||||
|
||||
conn = db()
|
||||
try:
|
||||
cur = conn.cursor(dictionary=True)
|
||||
cur.execute("SELECT id, username FROM users WHERE role = 'opc_owner'")
|
||||
users = cur.fetchall()
|
||||
added = 0
|
||||
for u in users:
|
||||
cur.execute("SELECT id FROM user_tenants WHERE user_id = %s AND tenant = %s", (u["id"], "测试·无界"))
|
||||
if not cur.fetchone():
|
||||
cur.execute("INSERT INTO user_tenants (user_id, tenant) VALUES (%s, %s)", (u["id"], "测试·无界"))
|
||||
added += 1
|
||||
if added:
|
||||
conn.commit()
|
||||
print(f"[migrate] 为 {added} 个 opc_owner 用户添加了 '测试·无界' 工作台权限")
|
||||
cur.close()
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user