36 lines
707 B
JavaScript
36 lines
707 B
JavaScript
const utils = require('../utils');
|
|
const db = require('../db');
|
|
const dbhelper = require('../dbhelper');
|
|
|
|
async function search(req, rsp) {
|
|
const {err, rows} = await db.execQuery(
|
|
'SELECT * FROM t_buy_record',
|
|
[]
|
|
);
|
|
if (err) {
|
|
utils.rspErr(1, 'db error ' + err);
|
|
return;
|
|
}
|
|
const data = {
|
|
'rows': []
|
|
};
|
|
rows.forEach((row) => {
|
|
data['rows'].push({
|
|
'buyer_address': '' + row['buyer_address'],
|
|
'blobdata': '' + row['blobdata'],
|
|
'createtime': row['createtime'],
|
|
'modifytime': row['modifytime'],
|
|
});
|
|
});
|
|
utils.rspData(
|
|
rsp,
|
|
data
|
|
);
|
|
}
|
|
|
|
function init() {
|
|
utils.registerHandler('buyrecord', 'search', search);
|
|
}
|
|
|
|
exports.init = init;
|