diff --git a/main.py b/main.py index a6d6afd..ea3c4d0 100644 --- a/main.py +++ b/main.py @@ -49,20 +49,20 @@ class MyPlugin(Star): ,db='saipo' # 数据库名称 ,charset='utf8' # 字符编码 ) - #cur = conn.cursor() + cur = conn.cursor() time = [];V = [];a = [];b = [] for i in range(0,10): time.append(round(random.uniform(1, 600), 2)) V.append(round(random.uniform(0.01,100), 2)) a.append(time_long(time[i])) - b.append(volume(V[i])) - #sql = "INSERT INTO dajiao (openid, timelong, volume) VALUES (%s, %s, %s)" - #values = (user_name,time[i],V[i]) - #cur.execute(sql,values) - #conn.commit() - #cur.close() + b.append(volume(V[i])) + sql = "INSERT INTO dajiao (openid, timelong, volume) VALUES (%s, %s, %s),(%s, %s, %s),(%s, %s, %s),(%s, %s, %s),(%s, %s, %s),(%s, %s, %s),(%s, %s, %s),(%s, %s, %s),(%s, %s, %s),(%s, %s, %s)" + values = (user_name,time[0],V[0]),(user_name,time[1],V[1]),(user_name,time[2],V[2]),(user_name,time[3],V[3]),(user_name,time[4],V[4]),(user_name,time[5],V[5]),(user_name,time[6],V[6]),(user_name,time[7],V[7]),(user_name,time[8],V[8]),(user_name,time[9],V[9]) + cur.execute(sql,values) + conn.commit() + cur.close() conn.close() - yield event.plain_result(f"Hello,{get_user_name(event.get_sender_id())}, 第一次你坚持了{time[0]}s哦,{a[0]}.射出{V[0]}ml,{b[0]}!\n第二次你坚持了{time[1]}s哦,{a[1]}.射出{V[1]}ml,{b[1]}!\n哎呀,一点也打不出来了!") + yield event.plain_result(f"Hello,{get_user_name(event.get_sender_id())},准备开始挑战十连咯!\n第一次你坚持了{time[0]}s哦,{a[0]}.射出{V[0]}ml,{b[0]}!\n第二次你坚持了{time[1]}s哦,{a[1]}.射出{V[1]}ml,{b[1]}!\n第三次你坚持了{time[2]}s哦,{a[2]}.射出{V[2]}ml,{b[2]}!\n第四次你坚持了{time[3]}s哦,{a[3]}.射出{V[3]}ml,{b[3]}!\n第五次你坚持了{time[4]}s哦,{a[4]}.射出{V[4]}ml,{b[4]}!\n第六次你坚持了{time[5]}s哦,{a[5]}.射出{V[5]}ml,{b[5]}!\n第七次你坚持了{time[6]}s哦,{a[6]}.射出{V[6]}ml,{b[6]}!\n第八次你坚持了{time[7]}s哦,{a[7]}.射出{V[7]}ml,{b[7]}!\n第九次你坚持了{time[8]}s哦,{a[8]}.射出{V[8]}ml,{b[8]}!\n第十次你坚持了{time[9]}s哦,{a[9]}.射出{V[9]}ml,{b[9]}!\n哎呀,一点也打不出来了!杂鱼!") @filter.command("打打你的")