Compare commits
3 Commits
944870496a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3580f89552 | ||
|
|
25aafd57c8 | ||
|
|
cdddfac609 |
@@ -387,6 +387,7 @@ async def parse_loop():
|
||||
dpg430_addr=wave.addr,
|
||||
remain_count=wave.remain_count,
|
||||
relay_code=wave.relay_out,
|
||||
relay_out=relay_info,
|
||||
work_freq=wave.work_freq,
|
||||
curr_dist=wave.curr_dist,
|
||||
speed=wave.speed,
|
||||
|
||||
@@ -152,7 +152,7 @@ async def _create_tables(pool: aiomysql.Pool):
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`username` VARCHAR(45) UNIQUE NOT NULL,
|
||||
`password_hash` VARCHAR(256) NOT NULL,
|
||||
`role` VARCHAR(20) DEFAULT 'operator' COMMENT 'admin/operator',
|
||||
`role` VARCHAR(20) DEFAULT 'operator' COMMENT 'admin/manager/operator/analyst',
|
||||
`is_active` TINYINT DEFAULT 1,
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
|
||||
@@ -344,6 +344,15 @@ async def _create_tables(pool: aiomysql.Pool):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# V2.3.0 迁移:tb_user 角色增加 manager
|
||||
try:
|
||||
await cur.execute(
|
||||
"ALTER TABLE tb_user MODIFY COLUMN `role` VARCHAR(20) DEFAULT 'operator' "
|
||||
"COMMENT 'admin/manager/operator/analyst'"
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
logger.info("数据库表初始化完成")
|
||||
|
||||
|
||||
@@ -522,7 +531,8 @@ async def insert_wave_data(dnt_id: int, dpg430_addr: int,
|
||||
remain_count: int, relay_code: int,
|
||||
work_freq: float, curr_dist: int, speed: int,
|
||||
near_dist: int, far_dist: int,
|
||||
enter_dist: int, leave_dist: int):
|
||||
enter_dist: int, leave_dist: int,
|
||||
relay_out: str = ""):
|
||||
"""插入 0xB4 波动测试上报数据到 tb_state_tst"""
|
||||
coil_id, simulate_car_id = await get_fixture_coil_car_ids(dnt_id)
|
||||
dev_type = await get_fixture_dev_type(dnt_id)
|
||||
@@ -542,7 +552,7 @@ async def insert_wave_data(dnt_id: int, dpg430_addr: int,
|
||||
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
|
||||
(dnt_id, dpg430_addr, dev_type, str_type,
|
||||
1, "B4",
|
||||
"", relay_code,
|
||||
relay_out, relay_code,
|
||||
remain_count, work_freq, curr_dist, speed,
|
||||
near_dist, far_dist, enter_dist, leave_dist,
|
||||
coil_id, simulate_car_id),
|
||||
|
||||
Reference in New Issue
Block a user