|
@@ -88,6 +88,11 @@ try:
|
|
|
except pymysql.err.Error:
|
|
|
print("请提供正确的MySQL信息", file=sys.stderr)
|
|
|
sys.exit(1)
|
|
|
+else:
|
|
|
+ cursor.execute("USE hgssystem")
|
|
|
+
|
|
|
+from tool.login import create_uid
|
|
|
+from tool.time import mysql_time
|
|
|
|
|
|
print("是否执行数据库初始化程序?\n执行初始化程序会令你丢失所有数据.")
|
|
|
res = input("[Y/n]")
|
|
@@ -105,16 +110,12 @@ if res == 'Y' or res == 'y':
|
|
|
while len(admin_phone) != 11:
|
|
|
admin_phone = input("输入 'admin' 管理员的电话[长度=11]: ")
|
|
|
|
|
|
- from tool.login import create_uid
|
|
|
- from tool.time import mysql_time
|
|
|
-
|
|
|
# 生成基本 admin 用户
|
|
|
uid = create_uid("admin", admin_passwd)
|
|
|
cursor.execute(f"INSERT INTO user(UserID, Name, IsManager, Phone, Score, Reputation, CreateTime) "
|
|
|
f"VALUES ('{uid}', 'admin', 1, '{admin_phone}', 10, 300, {mysql_time()});")
|
|
|
sql.commit()
|
|
|
|
|
|
-
|
|
|
print("是否伪造数据?")
|
|
|
if input("[Y/n]") != "Y":
|
|
|
cursor.close()
|
|
@@ -201,7 +202,7 @@ def random_garbage_c(r_time, r_time2, cur):
|
|
|
|
|
|
def random_garbage_u(r_time, r_time2, cur):
|
|
|
user = random.choice(random_normal)
|
|
|
- random_garbage_c_to_user(user, r_time, r_time2, cur)
|
|
|
+ random_garbage_u_to_user(user, r_time, r_time2, cur)
|
|
|
|
|
|
|
|
|
def random_news(c_time, cur):
|
|
@@ -272,12 +273,12 @@ def make_fake():
|
|
|
if phone == 'x':
|
|
|
phone = fake.phone_number()
|
|
|
w_garbage = int(w_garbage)
|
|
|
- c_garbage = int(w_garbage)
|
|
|
+ c_garbage = int(c_garbage)
|
|
|
random_user(name, passwd, phone, c_time, 0, cursor, w_garbage, c_garbage)
|
|
|
|
|
|
count = int(input("步骤3, 注册随机管理员账户[输入个数]:"))
|
|
|
while count > 0:
|
|
|
- name = randomPassword()[:5]
|
|
|
+ name = fake.name()
|
|
|
passwd = randomPassword()
|
|
|
phone = fake.phone_number()
|
|
|
c_time = random_time()
|
|
@@ -286,36 +287,38 @@ def make_fake():
|
|
|
|
|
|
count = int(input("步骤3, 注册随机普通账户[输入个数]:"))
|
|
|
while count > 0:
|
|
|
- name = randomPassword()[:5]
|
|
|
+ name = fake.name()
|
|
|
passwd = randomPassword()
|
|
|
phone = fake.phone_number()
|
|
|
c_time = random_time()
|
|
|
random_user(name, passwd, phone, c_time, 0, cursor)
|
|
|
count -= 1
|
|
|
|
|
|
- count = int(input("步骤4, 注册随机已检查垃圾袋[输入个数]:"))
|
|
|
- while count > 0:
|
|
|
- count -= 1
|
|
|
- c_time2, c_time1 = random_time_double()
|
|
|
- random_garbage_u(c_time1, c_time2, cursor)
|
|
|
-
|
|
|
- count = int(input("步骤5, 注册随机待检查垃圾袋[输入个数]:"))
|
|
|
- while count > 0:
|
|
|
- count -= 1
|
|
|
- c_time2, c_time1 = random_time_double()
|
|
|
- random_garbage_c(c_time1, c_time2, cursor)
|
|
|
-
|
|
|
- count = int(input("步骤6, 注册随机未使用垃圾袋[输入个数]:"))
|
|
|
+ count = int(input("步骤4, 注册随机未使用垃圾袋[输入个数]:"))
|
|
|
while count > 0:
|
|
|
count -= 1
|
|
|
c_time = random_time()
|
|
|
random_garbage_n(c_time, cursor)
|
|
|
|
|
|
- count = int(input("步骤7, 注册随机新闻内容:"))
|
|
|
- while count > 0:
|
|
|
- count -= 1
|
|
|
- c_time = random_time()
|
|
|
- random_news(c_time, cursor)
|
|
|
+ if len(random_normal) > 0:
|
|
|
+ count = int(input("步骤5, 注册随机待检查垃圾袋[输入个数]:"))
|
|
|
+ while count > 0:
|
|
|
+ count -= 1
|
|
|
+ c_time2, c_time1 = random_time_double()
|
|
|
+ random_garbage_c(c_time1, c_time2, cursor)
|
|
|
+
|
|
|
+ if len(random_manager) > 0:
|
|
|
+ count = int(input("步骤6, 注册随机已检查垃圾袋[输入个数]:"))
|
|
|
+ while count > 0:
|
|
|
+ count -= 1
|
|
|
+ c_time2, c_time1 = random_time_double()
|
|
|
+ random_garbage_u(c_time1, c_time2, cursor)
|
|
|
+
|
|
|
+ count = int(input("步骤7, 注册随机新闻内容:"))
|
|
|
+ while count > 0:
|
|
|
+ count -= 1
|
|
|
+ c_time = random_time()
|
|
|
+ random_news(c_time, cursor)
|
|
|
|
|
|
count = int(input("步骤8, 注册随机商城内容:"))
|
|
|
while count > 0:
|