fix: 修改文件名大小写
This commit is contained in:
1047
package-lock.json
generated
Normal file
1047
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
package.json
Normal file
20
package.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "pmrx-gm",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "飘渺儒仙GM管理平添",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"node",
|
||||||
|
"vue"
|
||||||
|
],
|
||||||
|
"author": "kubbo",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.8.4",
|
||||||
|
"express": "^5.1.0",
|
||||||
|
"mysql": "^2.18.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
18
server/src/config/db.config.js
Normal file
18
server/src/config/db.config.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
module.exports = {
|
||||||
|
cdkDbConfig: {
|
||||||
|
host: '192.168.25.110', // MySQL服务器地址
|
||||||
|
user: 'root', // 数据库用户名
|
||||||
|
password: 'mysql_tr2Few', // 数据库密码
|
||||||
|
database: 'cdk', // 数据库名称
|
||||||
|
port: 23306, // MySQL端口号
|
||||||
|
connectionLimit: 10 // 连接池大小
|
||||||
|
},
|
||||||
|
gameDbConfig: {
|
||||||
|
host: '192.168.25.110', // MySQL服务器地址
|
||||||
|
user: 'root', // 数据库用户名
|
||||||
|
password: 'mysql_tr2Few', // 数据库密码
|
||||||
|
database: 'tafang_game_zjy', // 数据库名称
|
||||||
|
port: 23306, // MySQL端口号
|
||||||
|
connectionLimit: 10 // 连接池大小
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
export const cdkDbConfig = {
|
|
||||||
host: '192.168.25.110', // MySQL服务器地址
|
|
||||||
user: 'root', // 数据库用户名
|
|
||||||
password: 'mysql_tr2Few', // 数据库密码
|
|
||||||
database: 'cdk', // 数据库名称
|
|
||||||
port: 23306, // MySQL端口号
|
|
||||||
connectionLimit: 10 // 连接池大小
|
|
||||||
};
|
|
||||||
|
|
||||||
export const gameDbConfig = {
|
|
||||||
host: '192.168.25.110', // MySQL服务器地址
|
|
||||||
user: 'root', // 数据库用户名
|
|
||||||
password: 'mysql_tr2Few', // 数据库密码
|
|
||||||
database: 'tafang_game_zjy', // 数据库名称
|
|
||||||
port: 23306, // MySQL端口号
|
|
||||||
connectionLimit: 10 // 连接池大小
|
|
||||||
};
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import express from 'express';
|
const express = require('express');
|
||||||
import roleRoutes from './routes/role.routes';
|
const roleRoutes = require('./routes/role.routes');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = 3000;
|
const port = 3000;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import express from 'express';
|
const express = require('express');
|
||||||
import { getConnection, query } from '../utils/db.util';
|
const { getConnection, query } = require('../utils/db.util');
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
@@ -27,4 +27,4 @@ router.get('/recharges', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
module.exports = router;
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import mysql from 'mysql';
|
const mysql = require('mysql');
|
||||||
import { cdkDbConfig } from '../config/db.config';
|
const { cdkDbConfig } = require('../config/db.config');
|
||||||
|
|
||||||
// 创建连接池
|
// 创建连接池
|
||||||
const pool = mysql.createPool(cdkDbConfig);
|
const pool = mysql.createPool(cdkDbConfig);
|
||||||
|
|
||||||
// 获取数据库连接
|
// 获取数据库连接
|
||||||
export const getConnection = (): Promise<mysql.PoolConnection> => {
|
exports.getConnection = () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
pool.getConnection((err, connection) => {
|
pool.getConnection((err, connection) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -18,9 +18,9 @@ export const getConnection = (): Promise<mysql.PoolConnection> => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 执行查询
|
// 执行查询
|
||||||
export const query = async (sql: string, values?: any[], connection?: mysql.PoolConnection): Promise<any> => {
|
exports.query = async (sql, values = [], connection) => {
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
connection = await getConnection()
|
connection = await exports.getConnection();
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
connection.query(sql, values, (err, results) => {
|
connection.query(sql, values, (err, results) => {
|
||||||
Reference in New Issue
Block a user