1
This commit is contained in:
parent
05bdceb14a
commit
059a285aaf
@ -10,9 +10,7 @@ function add(clsName, modName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
add('Transaction', 'transaction');
|
|
||||||
add('Log', 'log');
|
add('Log', 'log');
|
||||||
add('UsedTokenId', 'used_tokenid');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function create(name, session) {
|
function create(name, session) {
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
const utils = require('j7/utils');
|
|
||||||
const BaseModel = require('./basemodel');
|
|
||||||
|
|
||||||
class Transaction extends BaseModel {
|
|
||||||
|
|
||||||
async add(account, data, netId) {
|
|
||||||
const result = {
|
|
||||||
err: null,
|
|
||||||
seqId: 0
|
|
||||||
};
|
|
||||||
const nowTime = utils.getUtcTime();
|
|
||||||
const lastId = await this.getSession().bcEventConn
|
|
||||||
(
|
|
||||||
'insertEx',
|
|
||||||
't_transaction',
|
|
||||||
[
|
|
||||||
['account', account],
|
|
||||||
['data', data],
|
|
||||||
['net_id', netId],
|
|
||||||
['createtime', nowTime],
|
|
||||||
['modifytime', nowTime],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
result['seqId'] = lastId;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
async update(idx, fields) {
|
|
||||||
const err = await this.getSession().bcEventConn
|
|
||||||
(
|
|
||||||
'update',
|
|
||||||
't_transaction',
|
|
||||||
[
|
|
||||||
['idx', idx]
|
|
||||||
],
|
|
||||||
fields
|
|
||||||
);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Transaction;
|
|
@ -1,39 +0,0 @@
|
|||||||
const utils = require('j7/utils');
|
|
||||||
const BaseModel = require('./basemodel');
|
|
||||||
|
|
||||||
class UsedTokenId extends BaseModel {
|
|
||||||
|
|
||||||
async add(account, tokenId, transId, netId) {
|
|
||||||
const nowTime = utils.getUtcTime();
|
|
||||||
const fields = [
|
|
||||||
['account', account],
|
|
||||||
['token_id', tokenId],
|
|
||||||
['trans_id', transId],
|
|
||||||
['net_id', netId],
|
|
||||||
['confirmed', 1],
|
|
||||||
['createtime', nowTime],
|
|
||||||
['modifytime', nowTime],
|
|
||||||
];
|
|
||||||
await this.getSession().bcEventConn
|
|
||||||
(
|
|
||||||
'insert',
|
|
||||||
't_used_token_id',
|
|
||||||
fields
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async find(tokenId) {
|
|
||||||
const {err, row} = await this.getSession().bcEventConn
|
|
||||||
(
|
|
||||||
'ormSelectOne',
|
|
||||||
't_used_token_id',
|
|
||||||
[
|
|
||||||
['token_id', tokenId]
|
|
||||||
]
|
|
||||||
);
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = UsedTokenId;
|
|
Loading…
x
Reference in New Issue
Block a user