forked from ccqstark/WoZaiXiaoYuanPuncher-Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.py
24 lines (22 loc) · 957 Bytes
/
init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import datetime
from utils.sqlliteUtil import EasySqlite
username = input("请输入username:")
connection = EasySqlite("database.sqlite")
# 判断用户是否存在
result = connection.execute("select * from jwsession where username=?", [username])
if len(result) == 0:
print("用户不存在!")
choice = input("是否创建此用户(y/n):")
if choice == 'y':
jwsession = input("请输入jwsession:")
connection.execute("insert into jwsession values (?,?,?,?)",
[username, jwsession,
datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d-%H-%M'), 1])
print("创建用户成功!")
else:
print("操作取消")
else:
# 用户如果存在则跟新jwsession
jwsession = input("请输入jwsession:")
connection.execute("update jwsession set jwsession=? where username=?", [jwsession, username])
print("jwsession更新成功!")