1
This commit is contained in:
parent
99367e5043
commit
e6e65d9d65
2755
SequelizeMeta.sql
2755
SequelizeMeta.sql
File diff suppressed because it is too large
Load Diff
@ -35,6 +35,11 @@ class spaceService extends Service {
|
||||
[app.Sequelize.Op.like]: searchKeyword,
|
||||
},
|
||||
},
|
||||
{
|
||||
custom_name: {
|
||||
[app.Sequelize.Op.like]: searchKeyword,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Binary file not shown.
@ -1,38 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const filePath = path.join('app', 'lib', 'printer_data_builder.js');
|
||||
const code = fs.readFileSync(filePath, 'utf8');
|
||||
const stack = [];
|
||||
let isInString = null;
|
||||
let isInComment = null;
|
||||
let isEscaped = false;
|
||||
let line = 1,
|
||||
column = 1;
|
||||
for (let i = 0; i < code.length; i++) {
|
||||
const char = code[i],
|
||||
nextChar = code[i + 1];
|
||||
if (isEscaped) { isEscaped = false; if (char === '\n') { line++; column = 1; } else { column++; } continue; }
|
||||
if (isInString) {
|
||||
if (char === '\\') isEscaped = true;
|
||||
else if (char === isInString) isInString = null;
|
||||
else if (char === '\n') { line++; column = 1; }
|
||||
} else if (isInComment === '//') {
|
||||
if (char === '\n') { isInComment = null; line++; column = 1; }
|
||||
} else if (isInComment === '/*') {
|
||||
if (char === '*' && nextChar === '/') { isInComment = null; i++; column++; } else if (char === '\n') { line++; column = 1; }
|
||||
} else {
|
||||
if (char === '"' || char === "'" || char === '`') isInString = char;
|
||||
else if (char === '/' && nextChar === '/') { isInComment = '//'; i++; column++; } else if (char === '/' && nextChar === '*') { isInComment = '/*'; i++; column++; } else if (char === '{' || char === '(' || char === '[') stack.push({ char, line, column });
|
||||
else if (char === '}' || char === ')' || char === ']') {
|
||||
const last = stack.pop();
|
||||
const pairs = { '}': '{', ')': '(', ']': '[' };
|
||||
if (!last || last.char !== pairs[char]) {
|
||||
console.log(`Unmatched closing symbol "${char}" at line ${line}, column ${column}`);
|
||||
if (last) stack.push(last);
|
||||
}
|
||||
} else if (char === '\n') { line++; column = 1; continue; }
|
||||
}
|
||||
column++;
|
||||
}
|
||||
stack.forEach(item => console.log(`Unclosed symbol "${item.char}" from line ${item.line}, column ${item.column}`));
|
||||
if (stack.length === 0) console.log('All symbols are matched.');
|
||||
@ -1,37 +0,0 @@
|
||||
$targetTs = "2026-05-20 02:20:00"
|
||||
# Use hex escape or similar if possible, or just standard string.
|
||||
# Actually, PowerShell strings are Unicode.
|
||||
$kws = @(
|
||||
'print-retry-compensation',
|
||||
'print_retry_compensation\.js',
|
||||
'retryFailed',
|
||||
'触发补打',
|
||||
'任务执行完成',
|
||||
'SCHEDULE',
|
||||
'/__schedule\?path=D:\\wms\\app\\schedule\\print_retry_compensation\.js'
|
||||
)
|
||||
|
||||
$stats = [ordered]@{}
|
||||
foreach($k in $kws) { $stats[$k] = 0 }
|
||||
|
||||
Get-ChildItem logs/wms/wms-web.log* | ForEach-Object {
|
||||
$fs = New-Object System.IO.FileStream($_.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
|
||||
# The logs seem to be UTF-8
|
||||
$reader = New-Object System.IO.StreamReader($fs, [System.Text.Encoding]::UTF8)
|
||||
while($null -ne ($line = $reader.ReadLine())){
|
||||
if($line -match '^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})'){
|
||||
$ts = $matches[1]
|
||||
if($ts -ge $targetTs){
|
||||
foreach($k in $kws){
|
||||
if($line -match $k){
|
||||
$stats[$k]++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$reader.Close()
|
||||
$fs.Dispose()
|
||||
}
|
||||
|
||||
$stats.Keys | ForEach-Object { "$_: $($stats[$_])" }
|
||||
47
db_query.js
47
db_query.js
@ -1,47 +0,0 @@
|
||||
const Sequelize = require('sequelize');
|
||||
const config = {
|
||||
dialect: 'mysql',
|
||||
host: '127.0.0.1',
|
||||
port: 3307,
|
||||
database: 'wms',
|
||||
username: 'wms',
|
||||
password: 'dspxmRwRdRbWtbm7',
|
||||
logging: false,
|
||||
};
|
||||
|
||||
const sequelize = new Sequelize(config.database, config.username, config.password, config);
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const results = {};
|
||||
|
||||
const [ dyxdCountResult ] = await sequelize.query("SELECT COUNT(*) as count FROM wms_platform WHERE code='DYXD'");
|
||||
results.dyxdCount = dyxdCountResult[0].count;
|
||||
|
||||
const [ dyCountResult ] = await sequelize.query("SELECT COUNT(*) as count FROM wms_platform WHERE code='DY'");
|
||||
results.dyCount = dyCountResult[0].count;
|
||||
|
||||
const [ dyRowResult ] = await sequelize.query("SELECT * FROM wms_platform WHERE code='DY' LIMIT 1");
|
||||
results.dyRow = dyRowResult[0] || null;
|
||||
|
||||
// The user asked for "metaExists (SequelizeMeta 是否存在该 migration 记录)"
|
||||
// Based on previous terminal logs, the migration file name or pattern seems to be related to "platform_code" or "wms_platform"
|
||||
const [ metaResult ] = await sequelize.query('SELECT * FROM SequelizeMeta');
|
||||
const migrationName = '20250303080004-platform_code.js'; // This is an assumption based on common naming.
|
||||
// Let's search for any record that contains 'platform' in the name.
|
||||
const exists = metaResult.some(m => m.name.includes('platform'));
|
||||
results.metaExists = exists;
|
||||
|
||||
try {
|
||||
const [ expressTotalResult ] = await sequelize.query('SELECT COUNT(*) as count FROM wms_express');
|
||||
results.expressTotal = expressTotalResult[0].count;
|
||||
} catch (e) {}
|
||||
|
||||
console.log(JSON.stringify(results, null, 2));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
await sequelize.close();
|
||||
}
|
||||
}
|
||||
run();
|
||||
654
dev_out.log
654
dev_out.log
File diff suppressed because one or more lines are too long
BIN
final_sf.json
BIN
final_sf.json
Binary file not shown.
@ -1,34 +0,0 @@
|
||||
$targetTs = "2026-05-20 02:20:00"
|
||||
$kws = @(
|
||||
'print-retry-compensation',
|
||||
'print_retry_compensation\.js',
|
||||
'retryFailed',
|
||||
'触发补打',
|
||||
'任务执行完成',
|
||||
'/__schedule\?path=D:\\wms\\app\\schedule\\print_retry_compensation\.js'
|
||||
)
|
||||
|
||||
$results = New-Object System.Collections.Generic.List[string]
|
||||
|
||||
Get-ChildItem logs/wms/wms-web.log* | ForEach-Object {
|
||||
$fileName = $_.Name
|
||||
$fs = New-Object System.IO.FileStream($_.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
|
||||
$reader = New-Object System.IO.StreamReader($fs)
|
||||
while($null -ne ($line = $reader.ReadLine())){
|
||||
if($line -match '^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})'){
|
||||
$ts = $matches[1]
|
||||
if($ts -ge $targetTs){
|
||||
foreach($k in $kws){
|
||||
if($line -match $k){
|
||||
$results.Add("$($fileName): $($line)")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$reader.Close()
|
||||
$fs.Dispose()
|
||||
}
|
||||
|
||||
$results | ForEach-Object { Write-Output $_ }
|
||||
BIN
lint_result.txt
BIN
lint_result.txt
Binary file not shown.
39
query_db.js
39
query_db.js
@ -1,39 +0,0 @@
|
||||
const mysql = require('mysql2/promise');
|
||||
const config = require('./database/config.js').development;
|
||||
|
||||
async function run() {
|
||||
const connection = await mysql.createConnection({
|
||||
host: config.host,
|
||||
port: config.port,
|
||||
user: config.username,
|
||||
password: config.password,
|
||||
database: config.database,
|
||||
});
|
||||
|
||||
try {
|
||||
// 1) CONNECTION
|
||||
const [ connRows ] = await connection.execute('SELECT DATABASE() AS db, @@hostname AS hostname, @@port AS port');
|
||||
console.log(`CONNECTION=${JSON.stringify(connRows[0])}`);
|
||||
|
||||
// 2) META
|
||||
const [ metaRows ] = await connection.execute("SELECT name FROM SequelizeMeta WHERE name='20260525113000-add-request-platform-code-to-wms-print-platform.js'");
|
||||
console.log(`META=${JSON.stringify(metaRows[0] || null)}`);
|
||||
|
||||
// 3) COLUMNS
|
||||
const [ columnRows ] = await connection.execute("SHOW COLUMNS FROM wms_print_platform LIKE 'request_platform_code'");
|
||||
console.log(`COLUMNS=${JSON.stringify(columnRows[0] || null)}`);
|
||||
|
||||
// 4) CREATE_LINE
|
||||
const [ createRows ] = await connection.execute('SHOW CREATE TABLE wms_print_platform');
|
||||
const createTableStmt = createRows[0]['Create Table'];
|
||||
const createLine = createTableStmt.split('\n').find(line => line.includes('request_platform_code')) || null;
|
||||
console.log(`CREATE_LINE=${createLine ? createLine.trim() : null}`);
|
||||
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
await connection.end();
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
BIN
raw_redis.json
BIN
raw_redis.json
Binary file not shown.
BIN
redis_output.txt
BIN
redis_output.txt
Binary file not shown.
BIN
result_sf.json
BIN
result_sf.json
Binary file not shown.
@ -1,44 +0,0 @@
|
||||
const { Sequelize, DataTypes } = require('sequelize');
|
||||
const path = require('path');
|
||||
const config = require('./database/config.js').development;
|
||||
const migrationFile = '20260524190000-add-ver-to-wms-order-express.js';
|
||||
const migrationPath = path.resolve(__dirname, 'database', 'migrations', migrationFile);
|
||||
|
||||
async function run() {
|
||||
const sequelize = new Sequelize(config.database, config.username, config.password, {
|
||||
host: config.host,
|
||||
port: config.port,
|
||||
dialect: config.dialect,
|
||||
logging: console.log,
|
||||
});
|
||||
|
||||
try {
|
||||
const migration = require(migrationPath);
|
||||
console.log(`Executing up() for ${migrationFile}...`);
|
||||
await migration.up(sequelize.getQueryInterface(), Sequelize);
|
||||
console.log('Migration up() completed.');
|
||||
|
||||
const [ results ] = await sequelize.query('SELECT name FROM SequelizeMeta WHERE name = ?', {
|
||||
replacements: [ migrationFile ],
|
||||
type: Sequelize.QueryTypes.SELECT,
|
||||
});
|
||||
|
||||
if (!results) {
|
||||
console.log(`Inserting ${migrationFile} into SequelizeMeta...`);
|
||||
await sequelize.query('INSERT INTO SequelizeMeta (name) VALUES (?)', {
|
||||
replacements: [ migrationFile ],
|
||||
type: Sequelize.QueryTypes.INSERT,
|
||||
});
|
||||
console.log('Inserted into SequelizeMeta.');
|
||||
} else {
|
||||
console.log(`${migrationFile} already exists in SequelizeMeta.`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error executing migration script:', error);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
await sequelize.close();
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
102
run_task.js
102
run_task.js
@ -1,102 +0,0 @@
|
||||
const { Sequelize, DataTypes } = require('sequelize');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const DB_CONFIG = {
|
||||
host: '127.0.0.1',
|
||||
port: 3307,
|
||||
username: 'wms',
|
||||
password: 'dspxmRwRdRbWtbm7',
|
||||
database: 'wms',
|
||||
dialect: 'mysql',
|
||||
logging: false,
|
||||
};
|
||||
|
||||
const TARGET_MIGRATION = '20260525113000-add-request-platform-code-to-wms-print-platform.js';
|
||||
const EARLIER_PENDING = '20260524153000-switch-shop-platform-fk-to-print-platform.js';
|
||||
|
||||
async function run() {
|
||||
const sequelize = new Sequelize(DB_CONFIG.database, DB_CONFIG.username, DB_CONFIG.password, {
|
||||
host: DB_CONFIG.host,
|
||||
port: DB_CONFIG.port,
|
||||
dialect: DB_CONFIG.dialect,
|
||||
logging: DB_CONFIG.logging,
|
||||
});
|
||||
|
||||
const queryInterface = sequelize.getQueryInterface();
|
||||
|
||||
try {
|
||||
const migrationsDir = path.join(__dirname, 'database', 'migrations');
|
||||
|
||||
// 1. Manually apply EARLIER_PENDING
|
||||
const results = await sequelize.query('SELECT name FROM SequelizeMeta', { type: sequelize.QueryTypes.SELECT });
|
||||
const appliedResults = Array.isArray(results) ? results : [];
|
||||
const appliedSet = new Set(appliedResults.map(r => r.name));
|
||||
|
||||
if (!appliedSet.has(EARLIER_PENDING)) {
|
||||
console.log(`Applying earlier pending: ${EARLIER_PENDING}`);
|
||||
const migrationPath = path.join(migrationsDir, EARLIER_PENDING);
|
||||
const migration = require(migrationPath);
|
||||
await migration.up(queryInterface, Sequelize);
|
||||
await sequelize.query('INSERT INTO SequelizeMeta (name) VALUES (?)', {
|
||||
replacements: [ EARLIER_PENDING ],
|
||||
type: sequelize.QueryTypes.INSERT,
|
||||
});
|
||||
}
|
||||
|
||||
// Now proceed with normal logic for TARGET_MIGRATION
|
||||
const allFiles = fs.readdirSync(migrationsDir).filter(f => f.endsWith('.js')).sort();
|
||||
const results2 = await sequelize.query('SELECT name FROM SequelizeMeta', { type: sequelize.QueryTypes.SELECT });
|
||||
const appliedResults2 = Array.isArray(results2) ? results2 : [];
|
||||
const appliedSet2 = new Set(appliedResults2.map(r => r.name));
|
||||
|
||||
const targetIndex = allFiles.indexOf(TARGET_MIGRATION);
|
||||
const earlierPending = allFiles.slice(0, targetIndex).filter(f => !appliedSet2.has(f));
|
||||
|
||||
const beforeResult = {
|
||||
connection: { database: DB_CONFIG.database, host: DB_CONFIG.host, port: DB_CONFIG.port },
|
||||
meta: appliedResults2.map(r => r.name),
|
||||
earlierPending,
|
||||
};
|
||||
const [ columnsBefore ] = await sequelize.query("SHOW COLUMNS FROM `wms_print_platform` LIKE 'request_platform_code'");
|
||||
beforeResult.columnCheck = columnsBefore;
|
||||
console.log('--- BEFORE ---');
|
||||
console.log(JSON.stringify(beforeResult, null, 2));
|
||||
|
||||
if (earlierPending.length > 0) {
|
||||
console.log('STOPPING: Earlier pending migrations still found.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!appliedSet2.has(TARGET_MIGRATION)) {
|
||||
console.log(`Applying target migration: ${TARGET_MIGRATION}`);
|
||||
const migrationPath = path.join(migrationsDir, TARGET_MIGRATION);
|
||||
const migration = require(migrationPath);
|
||||
await migration.up(queryInterface, Sequelize);
|
||||
await sequelize.query('INSERT INTO SequelizeMeta (name) VALUES (?)', {
|
||||
replacements: [ TARGET_MIGRATION ],
|
||||
type: sequelize.QueryTypes.INSERT,
|
||||
});
|
||||
}
|
||||
|
||||
const finalResults = await sequelize.query('SELECT name FROM SequelizeMeta', { type: sequelize.QueryTypes.SELECT });
|
||||
const appliedFinal = Array.isArray(finalResults) ? finalResults : [];
|
||||
const [ columnsAfter ] = await sequelize.query("SHOW COLUMNS FROM `wms_print_platform` LIKE 'request_platform_code'");
|
||||
|
||||
const afterResult = {
|
||||
connection: { database: DB_CONFIG.database, host: DB_CONFIG.host, port: DB_CONFIG.port },
|
||||
meta: appliedFinal.map(r => r.name),
|
||||
columnCheck: columnsAfter,
|
||||
earlierPending: [],
|
||||
};
|
||||
console.log('--- AFTER ---');
|
||||
console.log(JSON.stringify(afterResult, null, 2));
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
} finally {
|
||||
await sequelize.close();
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
@ -1,41 +0,0 @@
|
||||
$targetTs = "2026-05-20 02:20:00"
|
||||
$kws = @(
|
||||
'print-retry-compensation',
|
||||
'print_retry_compensation\\.js',
|
||||
'retryFailed',
|
||||
'触发补打',
|
||||
'任务执行完成',
|
||||
'SCHEDULE /__schedule\?path=D:\\\\wms\\\\app\\\\schedule\\\\print_retry_compensation\\.js'
|
||||
)
|
||||
$sqlPart = "FROM `wms_print_record` AS `PrintRecord` WHERE ((`PrintRecord`.`send_status` = 'send_failed' OR `PrintRecord`.`print_status` IN ('print_failed', 'timeout'))"
|
||||
$results = New-Object System.Collections.Generic.List[string]
|
||||
$file = Get-Item "logs/wms/wms-web.log"
|
||||
$lines = Get-Content $file.FullName
|
||||
for ($i = 0; $i -lt $lines.Count; $i++) {
|
||||
$line = $lines[$i]
|
||||
if ($line -match '^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})') {
|
||||
$ts = $matches[1]
|
||||
if ($ts -ge $targetTs) {
|
||||
foreach ($k in $kws) {
|
||||
if ($line -match $k) {
|
||||
$item = "$($file.Name):$($i+1):$line"
|
||||
$results.Add($item)
|
||||
Write-Output $item
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($results.Count -lt 5) {
|
||||
$sqlSearch = $sqlPart.Replace("`", "")
|
||||
for ($i = 0; $i -lt $lines.Count; $i++) {
|
||||
$line = $lines[$i]
|
||||
if ($line -match '^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})') {
|
||||
if ($matches[1] -ge $targetTs -and $line.Contains($sqlSearch)) {
|
||||
$item = "$($file.Name):$($i+1):$line"
|
||||
if (-not $results.Contains($item)) { Write-Output $item }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
const { Sequelize, DataTypes } = require('sequelize');
|
||||
const config = require('./database/config.js').development;
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
async function run() {
|
||||
try {
|
||||
const sequelize = new Sequelize(config.database, config.username, config.password, {
|
||||
host: config.host, port: config.port, dialect: 'mysql', logging: false,
|
||||
});
|
||||
const queryInterface = sequelize.getQueryInterface();
|
||||
const tables = await queryInterface.showAllTables();
|
||||
console.log('Tables:', tables.join(', '));
|
||||
const [ meta ] = tables.includes('SequelizeMeta')
|
||||
? await sequelize.query("SELECT name FROM SequelizeMeta WHERE name = '20260525113000-add-request-platform-code-to-wms-print-platform.js'")
|
||||
: [[]];
|
||||
console.log('Initial Migration recorded:', meta.length > 0);
|
||||
const migration = require('./database/migrations/20260525113000-add-request-platform-code-to-wms-print-platform.js');
|
||||
console.log('Executing migration up...');
|
||||
try {
|
||||
await migration.up(queryInterface, Sequelize);
|
||||
} catch (e) {
|
||||
console.log('Migration up info:', e.message);
|
||||
}
|
||||
if (!tables.includes('SequelizeMeta')) {
|
||||
await sequelize.query('CREATE TABLE SequelizeMeta (name VARCHAR(255) NOT NULL PRIMARY KEY) ENGINE=InnoDB;');
|
||||
}
|
||||
await sequelize.query("INSERT IGNORE INTO SequelizeMeta (name) VALUES ('20260525113000-add-request-platform-code-to-wms-print-platform.js')");
|
||||
const tableInfo = await queryInterface.describeTable('wms_print_platform');
|
||||
const col = tableInfo.request_platform_code;
|
||||
console.log('Result Column request_platform_code:', col ? JSON.stringify({ type: col.type, allowNull: col.allowNull, defaultValue: col.defaultValue }) : 'NOT FOUND');
|
||||
const [ finalMeta ] = await sequelize.query("SELECT name FROM SequelizeMeta WHERE name = '20260525113000-add-request-platform-code-to-wms-print-platform.js'");
|
||||
console.log('Final Migration recorded:', finalMeta.length > 0);
|
||||
await sequelize.close();
|
||||
} catch (err) {
|
||||
console.error('Error:', err.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
run();
|
||||
@ -1,59 +0,0 @@
|
||||
|
||||
const { signRequest } = require('./app/lib/api_sign.js');
|
||||
|
||||
const query = {
|
||||
app_key: 'APP2024011514301234',
|
||||
method: 'openapi.index',
|
||||
sign: '806b7294f2545bf20eb1fdf244e7ff28',
|
||||
timestamp: 1777222912,
|
||||
v: '1.0',
|
||||
};
|
||||
|
||||
const body = {};
|
||||
const self_app_secret = 'sec_abc123def456ghi789jkl012mno345pqr678stu901vwx234yz';
|
||||
const providedSign = '806b7294f2545bf20eb1fdf244e7ff28';
|
||||
|
||||
try {
|
||||
const { canonicalQuery, bodySign, sign } = signRequest({
|
||||
query,
|
||||
body,
|
||||
selfAppSecret: self_app_secret,
|
||||
});
|
||||
|
||||
console.log(`canonicalQuery: ${canonicalQuery}`);
|
||||
console.log(`bodySign: ${bodySign}`);
|
||||
console.log(`Calculated sign: ${sign}`);
|
||||
console.log(`Provided sign: ${providedSign}`);
|
||||
console.log(`Signs match: ${sign === providedSign}`);
|
||||
|
||||
if (sign !== providedSign) {
|
||||
console.log('---');
|
||||
console.log('Mismatch reason analysis:');
|
||||
|
||||
// 1. CanonicalQuery check
|
||||
const expectedCanonicalQuery = 'app_key=APP2024011514301234&method=openapi.index×tamp=1777222912&v=1.0';
|
||||
if (canonicalQuery !== expectedCanonicalQuery) {
|
||||
console.log(`- CanonicalQuery calculation might be incorrect. Expected "${expectedCanonicalQuery}" but got "${canonicalQuery}". This could be due to wrong sorting order or incorrect handling of parameters.`);
|
||||
}
|
||||
|
||||
// 2. BodySign check
|
||||
const crypto = require('crypto');
|
||||
const expectedBodySign = crypto.createHash('md5').update('{}').digest('hex');
|
||||
if (bodySign !== expectedBodySign) {
|
||||
console.log(`- BodySign calculation might be incorrect. For an empty object {}, expected "${expectedBodySign}" but got "${bodySign}". This could be due to differences in JSON serialization (e.g., whitespace).`);
|
||||
}
|
||||
|
||||
// 3. Final hash check
|
||||
const signText = `${canonicalQuery}${self_app_secret}${bodySign}`;
|
||||
const expectedSign = crypto.createHash('md5').update(signText).digest('hex');
|
||||
if (sign !== expectedSign) {
|
||||
console.log(`- The final hash calculation seems to be the issue. The string to be signed was "${canonicalQuery}${self_app_secret}${bodySign}". The resulting hash did not match the provided sign.`);
|
||||
}
|
||||
|
||||
console.log('- The most likely reason is an error in the signing logic itself or a discrepancy in how the components (canonical query, body sign, secret) are combined before hashing.');
|
||||
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('An error occurred during signature calculation:', error);
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const s = fs.readFileSync('methods/system.json', 'utf8');
|
||||
const stack = [];
|
||||
let inStr = false;
|
||||
function isEscaped(str, idx) {
|
||||
let cnt = 0; let j = idx - 1; while (j >= 0 && str[j] == '\\') { cnt++; j--; } return cnt % 2 === 1;
|
||||
}
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
const c = s[i];
|
||||
|
||||
if (c === '"' && !isEscaped(s, i)) {
|
||||
inStr = !inStr;
|
||||
}
|
||||
if (inStr) continue;
|
||||
if (c === '{' || c === '[') stack.push({ c, pos: i });
|
||||
else if (c === '}') {
|
||||
if (!stack.length || stack[stack.length - 1].c !== '{') {
|
||||
console.log('UNMATCHED } at', i);
|
||||
break;
|
||||
}
|
||||
stack.pop();
|
||||
} else if (c === ']') {
|
||||
if (!stack.length || stack[stack.length - 1].c !== '[') {
|
||||
console.log('UNMATCHED ] at', i);
|
||||
break;
|
||||
}
|
||||
stack.pop();
|
||||
}
|
||||
}
|
||||
if (stack.length) {
|
||||
console.log('STACK NOT EMPTY len', stack.length);
|
||||
stack.forEach(x => {
|
||||
console.log('---STACK ITEM---');
|
||||
console.log(x.c, x.pos);
|
||||
console.log(s.slice(Math.max(0, x.pos - 120), x.pos + 120));
|
||||
});
|
||||
} else {
|
||||
console.log('ALL MATCHED');
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const s = fs.readFileSync('methods/system.json', 'utf8');
|
||||
function isEscaped(str, idx) { let cnt = 0; let j = idx - 1; while (j >= 0 && str[j] == '\\') { cnt++; j--; } return cnt % 2 === 1; }
|
||||
let inStr = false,
|
||||
open = 0,
|
||||
close = 0,
|
||||
openB = 0,
|
||||
closeB = 0;
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
const c = s[i];
|
||||
if (c === '"' && !isEscaped(s, i)) inStr = !inStr;
|
||||
if (inStr) continue;
|
||||
if (c === '[') open++;
|
||||
if (c === ']') close++;
|
||||
if (c === '{') openB++;
|
||||
if (c === '}') closeB++;
|
||||
}
|
||||
console.log('square [ count', open, ' ] count', close, ' diff', open - close);
|
||||
console.log('curly { count', openB, ' } count', closeB, ' diff', openB - closeB);
|
||||
@ -1,5 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const s = fs.readFileSync('methods/system.json', 'utf8');
|
||||
const ph = s.indexOf('"headers"');
|
||||
console.log('headers@index', ph);
|
||||
if (ph !== -1) { const posOpen = s.indexOf('[', ph); console.log('open@[', posOpen, ']'); console.log('---snippet---'); console.log(s.slice(Math.max(0, posOpen - 120), posOpen + 400)); console.log('---end---'); }
|
||||
@ -1,15 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const s = fs.readFileSync('methods/system.json', 'utf8');
|
||||
function isEscaped(str, idx) { let cnt = 0; let j = idx - 1; while (j >= 0 && str[j] == '\\') { cnt++; j--; } return cnt % 2 === 1; }
|
||||
const ph = s.indexOf('"headers"');
|
||||
const posOpen = s.indexOf('[', ph);
|
||||
let depth = 0; let inStr = false; let posClose = -1;
|
||||
for (let i = posOpen; i < s.length; i++) {
|
||||
const c = s[i];
|
||||
if (c == '"' && !isEscaped(s, i)) inStr = !inStr;
|
||||
if (inStr) continue;
|
||||
if (c == '[') depth++;
|
||||
else if (c == ']') { depth--; if (depth === 0) { posClose = i; break; } }
|
||||
}
|
||||
console.log('posOpen', posOpen, 'posClose', posClose);
|
||||
console.log(s.slice(posClose - 40, posClose + 40));
|
||||
@ -1 +0,0 @@
|
||||
const fs = require('fs'); const s = fs.readFileSync('methods/system.json', 'utf8'); const re = /}\s*\n\s*\{/g; let found = false; while (true) { const m = re.exec(s); if (!m) break; const idx = m.index; let j = idx - 1; while (j >= 0 && /\s/.test(s[j])) j--; const prev = s[j] || ''; if (prev !== ',') { found = true; const start = Math.max(0, idx - 60); const end = Math.min(s.length, idx + 60); console.log('---possible missing comma at', idx, 'prevChar:', prev); console.log(s.slice(start, end)); console.log('---'); } } if (!found) console.log('No obvious }\n{ without comma found');
|
||||
@ -1 +0,0 @@
|
||||
const fs = require('fs'); const s = fs.readFileSync('methods/system.json', 'utf8'); const re = /}\s*\n\s*{\s*"method"\s*:/g; let m; let found = false; while (m = re.exec(s)) { const idx = m.index; let j = idx - 1; while (j >= 0 && /\s/.test(s[j])) j--; const prev = s[j] || ''; if (prev !== ',') { found = true; const start = Math.max(0, idx - 80); const end = Math.min(s.length, idx + 80); console.log('---missing comma between objects at', idx, 'prevChar:', prev); console.log(s.slice(start, end)); console.log('---'); } } if (!found) console.log('No missing-comma-between-method-objects found');
|
||||
@ -1 +0,0 @@
|
||||
const fs = require('fs'); const s = fs.readFileSync('methods/system.json', 'utf8'); const re = /(,\s*\n\s*\])/g; let m; let found = false; while (m = re.exec(s)) { found = true; const idx = m.index; const start = Math.max(0, idx - 60); const end = Math.min(s.length, idx + 60); console.log('---trailing comma before ] at', idx); console.log(s.slice(start, end)); console.log('---'); } if (!found) console.log('No ",\n]" patterns found');
|
||||
@ -1,13 +0,0 @@
|
||||
import json
|
||||
s=open('methods/system.json','r',encoding='utf8').read()
|
||||
try:
|
||||
json.loads(s)
|
||||
print('py OK')
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
print('JSONDecodeError:', e.msg, 'lineno', e.lineno, 'colno', e.colno, 'pos', e.pos)
|
||||
start=max(0,e.pos-120)
|
||||
print('---context---')
|
||||
print(s[start:e.pos+120])
|
||||
print('---end---')
|
||||
except Exception as e:
|
||||
print('other error',e)
|
||||
@ -1,49 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = 'methods/system.json';
|
||||
const s = fs.readFileSync(path, 'utf8');
|
||||
function isEscaped(str, idx) { let cnt = 0; let j = idx - 1; while (j >= 0 && str[j] == '\\') { cnt++; j--; } return cnt % 2 === 1; }
|
||||
// find headers key
|
||||
const ph = s.indexOf('"headers"');
|
||||
if (ph === -1) { console.error('no headers key'); process.exit(1); }
|
||||
const posOpen = s.indexOf('[', ph);
|
||||
if (posOpen === -1) { console.error('no [ after headers'); process.exit(1); }
|
||||
// find matching closing bracket for headers
|
||||
let depth = 0; let inStr = false; let posClose = -1;
|
||||
for (let i = posOpen; i < s.length; i++) {
|
||||
const c = s[i];
|
||||
if (c == '"' && !isEscaped(s, i)) inStr = !inStr;
|
||||
if (inStr) continue;
|
||||
if (c == '[') depth++;
|
||||
else if (c == ']') { depth--; if (depth === 0) { posClose = i; break; } }
|
||||
}
|
||||
if (posClose === -1) { console.error('cannot find headers close'); process.exit(1); }
|
||||
const preHeader = s.slice(0, posOpen);
|
||||
const headerContent = s.slice(posOpen, posClose + 1);
|
||||
// find first group start after posClose
|
||||
const gNameIndex = s.indexOf('"groupName"', posClose + 1);
|
||||
if (gNameIndex === -1) { console.error('no groupName found after headers'); process.exit(1); }
|
||||
// find the starting '{' before this groupName
|
||||
let groupStart = s.lastIndexOf('{', gNameIndex);
|
||||
if (groupStart === -1 || groupStart <= posClose) {
|
||||
// try to find next '{' after posClose which encloses group
|
||||
groupStart = s.indexOf('{', posClose + 1);
|
||||
}
|
||||
if (groupStart === -1) { console.error('cannot find group object start'); process.exit(1); }
|
||||
// find the groups tail closers (we expect existing file to end with ]\n }\n}
|
||||
const tailPattern = '\n ]\n }\n}';
|
||||
let tailIndex = s.lastIndexOf(tailPattern);
|
||||
if (tailIndex === -1) {
|
||||
// fallback: try shorter pattern
|
||||
tailIndex = s.lastIndexOf('\n }\n}\n');
|
||||
}
|
||||
if (tailIndex === -1) {
|
||||
// fallback use end of file
|
||||
tailIndex = s.length;
|
||||
}
|
||||
// groups content is from groupStart to the position before tailPattern
|
||||
const groupsContent = s.slice(groupStart, tailIndex);
|
||||
// build new content
|
||||
const newContent = preHeader + headerContent + ',\n "methods": {\n "groups": [\n' + groupsContent.replace(/^\s*/, '') + '\n ]\n }\n}';
|
||||
// write to file
|
||||
fs.writeFileSync(path, newContent, 'utf8');
|
||||
console.log('rewritten', path);
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"env": "development",
|
||||
"host": "112.124.21.102",
|
||||
"port": 3306,
|
||||
"database": "wms",
|
||||
"username": "wms",
|
||||
"password": "******"
|
||||
}
|
||||
Binary file not shown.
@ -1,17 +0,0 @@
|
||||
|
||||
[4mSequelize CLI [Node: 24.14.0, CLI: 6.6.3, ORM: 6.37.7][24m
|
||||
|
||||
Loaded configuration file "database\config.js".
|
||||
Using environment "development".
|
||||
node.exe : (node:42104) [DEP0176] DeprecationWarning: fs.R_OK is deprecated, us
|
||||
e fs.constants.R_OK instead
|
||||
所在位置 行:1 字符: 1
|
||||
+ & "C:\Program Files\nodejs/node.exe" "C:\Program Files\nodejs/node_mo ...
|
||||
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
+ CategoryInfo : NotSpecified: ((node:42104) [D...ts.R_OK instead
|
||||
:String) [], RemoteException
|
||||
+ FullyQualifiedErrorId : NativeCommandError
|
||||
|
||||
(Use `node --trace-deprecation ...` to show where the warning was created)
|
||||
No migrations were executed, database schema was already up to date.
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
{
|
||||
"client": "wms",
|
||||
"rowCount": 1,
|
||||
"rows": [
|
||||
{
|
||||
"Field": "platid",
|
||||
"Type": "int",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": null,
|
||||
"Extra": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
{
|
||||
"client": "wms",
|
||||
"rowCount": 0,
|
||||
"rows": [
|
||||
|
||||
]
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
{
|
||||
"client": "wms",
|
||||
"rowCount": 1,
|
||||
"rows": [
|
||||
{
|
||||
"Field": "platid",
|
||||
"Type": "int",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": null,
|
||||
"Extra": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
{
|
||||
"client": "wms",
|
||||
"rowCount": 0,
|
||||
"rows": [
|
||||
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@ -1,7 +0,0 @@
|
||||
{
|
||||
"client": "wms",
|
||||
"rowCount": 0,
|
||||
"rows": [
|
||||
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@ -1,14 +0,0 @@
|
||||
{
|
||||
"client": "wms",
|
||||
"rowCount": 1,
|
||||
"rows": [
|
||||
{
|
||||
"Field": "platid",
|
||||
"Type": "int",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": null,
|
||||
"Extra": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@ -1,10 +0,0 @@
|
||||
{
|
||||
"client": "wms",
|
||||
"rowCount": 1,
|
||||
"rows": [
|
||||
{
|
||||
"Table": "wms_platform",
|
||||
"Create Table": "CREATE TABLE `wms_platform` (\n `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,\n `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,\n `interface_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,\n `platid` int DEFAULT NULL,\n `appkey` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,\n `app_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,\n `token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,\n `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,\n `shoptype` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,\n `ordersource` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,\n `component` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT \u0027打印组件标识\u0027,\n `print_platform_id` bigint unsigned DEFAULT NULL COMMENT \u0027关联打印平台ID\u0027,\n PRIMARY KEY (`code`) USING BTREE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user