| New file |
| | |
| | | -- 补回被 rekey 的操作员所缺的门店分配(只在服务器库执行)。 |
| | | -- |
| | | -- 为什么会有这个洞:合并时本机 operator 10/34/35(商户 631/632/633 的登录账号)与服务器同 id 撞车, |
| | | -- 用 --rekey 换成了新 id 37/38/39 —— 但 merchant_operator_store 是按 operator_id 关联的另一张表, |
| | | -- rekey 只处理了 merchant_operator 一张表,映射行没跟着换,于是三个账号都能过密码校验、却卡在 |
| | | -- 「当前账号未分配可操作门店」(登录要求 os.operator_id 至少连到一个 status=1 的门店)。 |
| | | -- 另外核销记录的 staff_id 还写着本机的旧 id,在服务器上会算到别的操作员头上。 |
| | | -- |
| | | -- 执行前确认门店归属(应为 572→631、573→632、574→633,status=1 deleted=0): |
| | | select id, merchant_id, store_name, status, deleted from merchant_store where id in (572, 573, 574); |
| | | |
| | | start transaction; |
| | | |
| | | insert into merchant_operator_store(operator_id, store_id) values (37, 572), (38, 573), (39, 574); |
| | | |
| | | -- 核销记录的归属:本机 staff_id 10/34 在服务器上属于别的操作员(商户 99 / 90) |
| | | update verify_record set staff_id = 37 where merchant_id = 631 and staff_id = 10; |
| | | update verify_record set staff_id = 38 where merchant_id = 632 and staff_id = 34; |
| | | |
| | | commit; |
| | | |
| | | -- 验收(三条都应有行,且门店属于对应商户): |
| | | -- select os.operator_id, os.store_id, s.merchant_id, s.store_name |
| | | -- from merchant_operator_store os join merchant_store s on s.id = os.store_id |
| | | -- where os.operator_id in (37, 38, 39) order by os.operator_id; |
| | | -- select merchant_id, staff_id, count(*) from verify_record where merchant_id in (631, 632) group by merchant_id, staff_id; |
| | | -- |
| | | -- 不在本脚本内处理的两件事: |
| | | -- * 协议接受记录(merchant_agreement_acceptance)不搬:服务器用的版本号是 1.0.0、本机是 v1.0, |
| | | -- 照搬会多出一批版本号对不上的行;登录流程本身会按当前版本自动补记(MerchantAuthService)。 |
| | | -- * 审计类日志(merchant_login_audit / operation_log / *_operation_log)里可能仍有本机旧 id 的行, |
| | | -- 属历史归属问题,不影响登录与业务,需要时再单独判读。 |