fix: 更新域名从 lhgy.net 到 www.lhgy.net
- 更新 .env.local 中的域名配置 - 更新 infra/deploy/.env.local - 更新 compose.local.yaml 中的环境变量 - 更新 admin-web 构建参数 VITE_API_BASE_URL - 更新小程序 app.ts 中的 apiBaseUrl
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
const mysql = require('mysql2/promise');
|
||||
|
||||
async function fixEncoding() {
|
||||
const connection = await mysql.createConnection({
|
||||
host: '172.18.0.2',
|
||||
user: 'lehuo',
|
||||
password: 'change-me-local-only',
|
||||
database: 'lehuo',
|
||||
charset: 'utf8mb4'
|
||||
});
|
||||
|
||||
try {
|
||||
// 查询当前乱码值
|
||||
const [rows] = await connection.execute(
|
||||
'SELECT user_id, display_name, HEX(display_name) FROM staff_profiles WHERE user_id = ?',
|
||||
[2]
|
||||
);
|
||||
console.log('修复前:', rows[0]);
|
||||
|
||||
// 双编码修复:latin1 -> utf8
|
||||
const [result] = await connection.execute(
|
||||
'UPDATE staff_profiles SET display_name = CONVERT(CAST(CONVERT(? USING latin1) AS BINARY), utf8mb4) WHERE user_id = ?',
|
||||
[rows[0].display_name, 2]
|
||||
);
|
||||
console.log('修复影响行数:', result.affectedRows);
|
||||
|
||||
// 复核
|
||||
const [check] = await connection.execute(
|
||||
'SELECT user_id, display_name, HEX(display_name) FROM staff_profiles WHERE user_id = ?',
|
||||
[2]
|
||||
);
|
||||
console.log('修复后:', check[0]);
|
||||
|
||||
// 检查正确HEX
|
||||
const expectedHex = Buffer.from('系统管理员').toString('hex').toUpperCase();
|
||||
const actualHex = check[0].HEX(display_name);
|
||||
console.log('期望HEX:', expectedHex);
|
||||
console.log('实际HEX:', actualHex);
|
||||
console.log('修复成功:', expectedHex === actualHex.toUpperCase());
|
||||
|
||||
} catch (error) {
|
||||
console.error('错误:', error);
|
||||
} finally {
|
||||
await connection.end();
|
||||
}
|
||||
}
|
||||
|
||||
fixEncoding();
|
||||
Reference in New Issue
Block a user