|
@@ -16,7 +16,7 @@ const createTransactionTable = async () => {
|
|
|
amount DECIMAL(10,2) NOT NULL,
|
|
|
time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
|
remark VARCHAR(255) DEFAULT NULL COMMENT '备注',
|
|
|
- operator_id INT NOT NULL COMMENT '操作人ID',
|
|
|
+ operator_id VARCHAR(50) NOT NULL COMMENT '操作人ID',
|
|
|
fee_rate DECIMAL(5,2) DEFAULT NULL COMMENT '费率',
|
|
|
exchange_rate DECIMAL(10,4) DEFAULT NULL COMMENT '汇率',
|
|
|
INDEX idx_group_time (group_id, time),
|
|
@@ -119,6 +119,11 @@ const Transaction = {
|
|
|
const feeRate = transactionData.feeRate || defaultFeeRate;
|
|
|
const exchangeRate = transactionData.exchangeRate || defaultExchangeRate;
|
|
|
|
|
|
+ // 使用群内操作人的ID作为operator_id
|
|
|
+ const operatorId = transactionData.operatorId || 1;
|
|
|
+
|
|
|
+ console.log(operatorId);
|
|
|
+
|
|
|
const [result] = await pool.query(
|
|
|
'INSERT INTO transactions (group_id, group_name, type, amount, remark, operator_id, fee_rate, exchange_rate) VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
|
|
|
[
|
|
@@ -127,7 +132,7 @@ const Transaction = {
|
|
|
transactionData.type,
|
|
|
transactionData.amount,
|
|
|
transactionData.remark || null,
|
|
|
- transactionData.operatorId,
|
|
|
+ operatorId, // 使用群内操作人的ID
|
|
|
feeRate,
|
|
|
exchangeRate
|
|
|
]
|