1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

add netease music

This commit is contained in:
2022-09-30 08:06:14 +08:00
parent 08f303de8f
commit 2a72b59dce
8 changed files with 346 additions and 22 deletions

View File

@@ -11,7 +11,7 @@ function createPool(database) {
...globalConfig.mysql,
database: database,
};
console.log(config);
// console.log(config);
//创建数据库连接池
pool = mysql.createPool(config);
@@ -37,14 +37,14 @@ function createPool(database) {
// });
}
async function query(sql) {
async function query(sql, params) {
if (!pool) {
console.error('Database connection pool is not initialized yet.');
return;
}
return await new Promise(function (resolve, reject) {
//pool.query()方法可以自动的帮我们在连接池中获取可用连接
pool.query(sql, function (err, data) {
pool.query(sql, params, function (err, data) {
if (err) reject(err);
// console.log(data);
resolve(data);