import random import datetime # 生成200条记录 for i in range(5): # user_id 8-110随机 # user_id = random.randint(8, 110) user_id = 8 # 生成随机日期 (2025年) start_date = datetime.datetime(2025, 1, 1) end_date = datetime.datetime(2025, 6, 28) random_date = start_date + datetime.timedelta(days=random.randint(0, 364)) random_time = datetime.time(random.randint(0, 23), random.randint(0, 59), random.randint(0, 59)) datetime_str = datetime.datetime.combine(random_date, random_time) # 订单号 order_time = datetime_str.strftime("%Y%m%d%H%M%S") random_suffix = str(random.randint(100000, 999999)) order_no = order_time + random_suffix # 相关订单号 related_order_no = order_no[:-1] + str((int(order_no[-1]) + 1) % 10) # 随机金额 amount = round(random.uniform(6000, 12000), 2) # 日期时间字符串 date_str = datetime_str.strftime("%Y-%m-%d %H:%M:%S") # 打印SQL语句 print(f"INSERT INTO `usdt_mall`.`recharge_withdraw_record` (`user_id`, `order_no`, `type`, `payment_method`, `amount`, `status`, `proof_image`, `auditor_id`, `audit_time`, `remark`, `create_time`, `update_time`, `receiving_address`, `is_read`, `related_order_no`) VALUES ({user_id}, '{order_no}', 3, 'BALANCE', {amount}, 1, NULL, NULL, '{date_str}', NULL, '{date_str}', '{date_str}', NULL, 1, '{related_order_no}');")