mirror of
https://github.com/Kakune55/PyGetGPT.git
synced 2025-06-29 00:08:04 +08:00
将数据库的配置转移到外置文件保存
This commit is contained in:
parent
1a4ea051e3
commit
daeaee2d41
@ -1,13 +1,13 @@
|
|||||||
import pymysql
|
import pymysql , config
|
||||||
|
|
||||||
|
|
||||||
def userSurplus(userkey):
|
def userSurplus(userkey):
|
||||||
#打开数据库连接
|
#打开数据库连接
|
||||||
db = pymysql.connect(host='www.kakuweb.top',
|
db = pymysql.connect(host=config.readConf()["db"]["host"],
|
||||||
port=33306,
|
port=config.readConf()["db"]["port"],
|
||||||
user='root',
|
user=config.readConf()["db"]["user"],
|
||||||
password='KAku3.14159..',
|
password=config.readConf()["db"]["passwd"],
|
||||||
database='AIapi')
|
database=config.readConf()["db"]["database"])
|
||||||
# 使用 cursor() 方法创建一个游标对象 cursor
|
# 使用 cursor() 方法创建一个游标对象 cursor
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user