fix: 修改文件名大小写

This commit is contained in:
2025-04-24 12:03:19 +08:00
parent 2d46b89d28
commit 9db06fa737
7 changed files with 1095 additions and 27 deletions

1047
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

20
package.json Normal file
View 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"
}
}

View 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 // 连接池大小
}
};

View File

@@ -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 // 连接池大小
};

View File

@@ -1,5 +1,5 @@
import express from 'express';
import roleRoutes from './routes/role.routes';
const express = require('express');
const roleRoutes = require('./routes/role.routes');
const app = express();
const port = 3000;

View File

@@ -1,5 +1,5 @@
import express from 'express';
import { getConnection, query } from '../utils/db.util';
const express = require('express');
const { getConnection, query } = require('../utils/db.util');
const router = express.Router();
@@ -27,4 +27,4 @@ router.get('/recharges', async (req, res) => {
}
});
export default router;
module.exports = router;

View File

@@ -1,11 +1,11 @@
import mysql from 'mysql';
import { cdkDbConfig } from '../config/db.config';
const mysql = require('mysql');
const { cdkDbConfig } = require('../config/db.config');
// 创建连接池
const pool = mysql.createPool(cdkDbConfig);
// 获取数据库连接
export const getConnection = (): Promise<mysql.PoolConnection> => {
exports.getConnection = () => {
return new Promise((resolve, reject) => {
pool.getConnection((err, connection) => {
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) {
connection = await getConnection()
connection = await exports.getConnection();
}
return new Promise((resolve, reject) => {
connection.query(sql, values, (err, results) => {