| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683 |
- import datetime, time
- from datetime import timedelta, date
- import pymongo
- def connect_to_mongodb():
- teleclient = pymongo.MongoClient('mongodb://127.0.0.1:27017/')
- # teleclient["admin"].authenticate("root", "xxxxx",mechanism='SCRAM-SHA-1')
- global bot, mydb, shang_text, caigou, heixiazi, shiyong, zlbbb, sdbbb, ywysf, dkzl, sdzz, designated, byzl, tjishuju, user_status, wzjdsj, zzclient, dj, cgtixian, Voting, lssj, web, miner, tjadd, supercomputing, buykuangji, buy_records, profit_records, jiangli, jlzhidu, daily_release, xsefhpz, yue_zlsshi, Rental
- mydb = teleclient['TRXNL3bot'] #数据库名
- bot = mydb['bot']
- heixiazi = mydb['heixiazi']
- shang_text = mydb['shang_text']
- Rental = mydb['Rental']
- caigou = mydb['caigou']
- shiyong = mydb['shiyong']
- zlbbb = mydb['zlbbb']
- sdbbb = mydb['sdbbb']
- ywysf = mydb['ywysf']
- dkzl = mydb['dkzl']
- sdzz = mydb['sdzz']
- byzl = mydb['byzl']
- tjishuju = mydb['tjishuju']
- designated = mydb['designated']
- user_status = mydb['user_status']
- wzjdsj = mydb['wzjdsj']
- cgtixian = mydb['cgtixian']
- zzclient = mydb['zzclient']
- Voting = mydb['Voting']
- lssj = mydb['lssj']
- miner = mydb['miner']
- tjadd = mydb['tjadd']
- buykuangji = mydb['buykuangji']
- supercomputing = mydb['supercomputing']
- buy_records = mydb['buy_records']
- profit_records = mydb['profit_records']
- jiangli = mydb['jiangli']
- jlzhidu = mydb['jlzhidu']
- daily_release = mydb['daily_release']
- xsefhpz = mydb['xsefhpz']
- yue_zlsshi = mydb['yue_zlsshi']
- mydb1 = teleclient['zhongzhuanzhan']
- dj = mydb1['dj']
- mydb2 = teleclient['wangzhan']
- web = mydb2['web']
- if shang_text.find_one({}) == None:
- shangtext('质押倍数', 2.6)
- shangtext('波场汇率', 16.63)
- shangtext('兑入差', 1)
- shangtext('兑出差', 1)
- shangtext('有U手续费', 1)
- shangtext('无U手续费', 2)
- shangtext('监控尾随按钮文本', '')
- shangtext('监控尾随按钮', b'\x80\x03]q\x00.')
- shangtext('能量单飞到网站', 0)
- shangtext('获利比例', 0)
- shangtext('预估能量', 1)
- shangtext('自动质押', 0)
- shangtext('钱包TRX余额大于多少质押', 4000)
- shangtext('预留TRX质押', 2000)
- chaosuanjiedian(1, 200, 30000, 0.05)
- chaosuanjiedian(2, 1000, 90000, 0.1)
- chaosuanjiedian(3, 5000, 300000, 0.2)
- chaosuanjiedian(4, 30000, 600000, 0.3)
- chaosuanjiedian(5, 60000, 1800000, 0.4)
- chaosuanjiedian(6, 100000, 5000000, 0.5)
- Energy_Miner('A型能量算力', 200, 300, 2, 1)
- Energy_Miner('B型能量算力', 1000, 1800, 12, 1.2)
- Energy_Miner('C型能量算力', 5000, 10000, 65, 1.3)
- Energy_Miner('D型能量算力', 30000, 70000, 450, 1.5)
- zduguize('上三代', 0.05, 0.05, 0.05)
- zduguize('上二代', 0.05, 0.05, 0.05)
- zduguize('上一代', 0.05, 0.05, 0.05)
- zduguize('下一代', 0.05, 0.05, 0.05)
- zduguize('下二代', 0.05, 0.05, 0.05)
- zduguize('下三代', 0.05, 0.05, 0.05)
- xixsefhpeiz('全球能量销售额', 0.01)
- xixsefhpeiz('全球能量算力', 0.05)
-
- Rental_duration(7, 0)
- Rental_duration(30, 0.05)
- Rental_duration(90, 0.1)
- Rental_duration(180, 0.15)
- Rental_duration(365, 0.2)
-
- def xixsefhpeiz(projectname, sl):
- xsefhpz.insert_one({
- 'projectname': projectname,
- 'sl': sl
- })
- def chaosuanjiedian(level, gerensuanli, tuanduisuanli, sl):
- supercomputing.insert_one({
- 'level': level,
- 'gerensuanli': gerensuanli,
- 'tuanduisuanli': tuanduisuanli,
- 'sl': sl
- })
- def tjadd_data(trc20, user_id, fullname, timer):
- tjadd.insert_one({
- 'trc20': trc20,
- 'user_id': user_id,
- 'fullname': fullname,
- 'timer': timer
- })
- def Rental_duration(days, sy):
- Rental.insert_one({
- 'days': days,
- 'sy': sy
- })
- def Energy_Miner(projectname, price, cz, sl, sy):
- miner.insert_one({
- 'projectname': projectname,
- 'price': price,
- 'cz': cz,
- 'sl': sl,
- 'sy': sy,
- })
- def Voting_data(TRX, piaoshu, jiangli,tranhash, timer):
- Voting.insert_one({
- 'TRX': TRX,
- 'piaoshu': piaoshu,
- 'jiangli': jiangli,
- 'tranhash': tranhash,
- 'timer': timer
- })
- def jydddatae(bianhao, user_id, money,weishu, timer):
- dj.insert_one({
- 'bianhao': bianhao,
- 'user_id': user_id,
- 'money': money,
- 'weishu': weishu,
- 'timer': timer
- })
- def user_status_time(chat_id):
- user_status.insert_one({
- 'chat_id': chat_id
- })
- def meitianshuju(timer, zong, shi, yu, shiyonglv, mtshifan):
- tjishuju.insert_one({
- 'timer': timer,
- 'zong': zong,
- 'shi': shi,
- 'yu': yu,
- 'shiyonglv': shiyonglv,
- 'mtshifan': mtshifan
- })
- def designdata(user_id, duitype, money, weisui, trc20, timer):
- designated.insert_one({
- 'user_id': user_id,
- 'duitype': duitype,
- 'money': money,
- 'weisui': weisui,
- 'trc20': trc20,
- 'timer': timer
- })
- def sdzzdata(user_id, firstname, titype, trc20, money, beizhu, timer):
- sdzz.insert_one({
- 'user_id': user_id,
- 'firstname': firstname,
- 'titype': titype,
- 'trc20': trc20,
- 'money': money,
- 'beizhu': beizhu,
- 'timer': timer
- })
- def sydata(tranhash):
- shiyong.insert_one({
- 'tranhash': tranhash
- })
- def zzdata(api, key):
- zzclient.insert_one({
- 'api': api,
- 'key': key
- })
- def kehuduanurl(api, key):
- kehuduan = mydb['kehuduan']
- kehuduan.insert_one({
- 'api': api,
- 'key': key,
- 'tcid': 0,
- })
- def blockdata(transaction_id,transferType, ownerAddress, toAddress, money, timestamp,rztext,cztext):
- qukuai = mydb['qukuai']
- qukuai.insert_one({
- 'transaction_id': transaction_id,
- 'transferType': transferType,
- 'ownerAddress': ownerAddress,
- 'toAddress': toAddress,
- 'pinjie': f'{ownerAddress},{toAddress}',
- 'money': money,
- 'timestamp': timestamp,
- 'rztext': rztext,
- 'cztext': cztext,
- 'TTYK': 0
- })
- def heixiazitrc20(trc20, trcstate, timer):
- heixiazi.insert_one({
- 'trc20': trc20,
- 'trcstate': trcstate,
- 'timer': timer
- })
- def zulinnengliangbaobiao(ywy_id,timestamp, tranhash, txid, user_id, owner, amount, money, today_money, shengmoney, resource,receiver, pencount, quantity, days, createtime, Expiration):
- zlbbb.insert_one({
- 'ywy_id': ywy_id,
- 'timestamp': timestamp,
- 'tranhash': tranhash,
- 'txid': txid,
- 'user_id': user_id,
- 'owner': owner,
- 'amount': amount,
- 'money': money,
- 'today_money': today_money,
- 'shengmoney': shengmoney,
- 'resource': resource,
- 'receiver': receiver,
- 'pencount': pencount,
- 'quantity': quantity,
- 'days': days,
- 'createtime': createtime,
- 'Expiration': Expiration,
- 'authxf': 0
- })
- def tixian_data(bianhao,money,leixing,huilv,timer):
- cgtixian.insert_one({
- 'bianhao': bianhao,
- 'money': money,
- 'leixing': leixing,
- 'huilv': huilv,
- 'timer': timer
- })
- def caigouda(bianhao,TRX,shuliang,timer):
- caigou.insert_one({
- 'bianhao': bianhao,
- 'TRX': TRX,
- 'shuliang': shuliang,
- 'timer': timer,
- 'state': 0,
- 'money': 0
- })
- def bots(token, port):
- bot.insert_one({
- 'token': token,
- 'port': port,
- 'state': 'auto'
- })
- def shangtext(projectname, text):
- shang_text.insert_one({
- 'projectname': projectname,
- 'text': text
- })
- def bdaddressdata(bot_id, user_id, today_money, creation_time):
- bdadd = mydb[f'bdadd{bot_id}']
- bdadd.insert_one({
- 'bot_id': bot_id,
- 'user_id': user_id,
- 'today_money': today_money,
- 'creation_time': creation_time
- })
- def yue_zlsshidata(bot_id, user_id, trc20, today_money, wusuijishu, shengmoney, zzmoney, timer):
- yue_zlsshi.insert_one({
- 'bot_id': bot_id,
- 'user_id': user_id,
- 'trc20': trc20,
- 'today_money': today_money,
- 'wusuijishu': wusuijishu,
- 'shengmoney': shengmoney,
- 'zzmoney': zzmoney,
- 'timer': timer
- })
- def pledge_library(bot_id, user_id, trc20, today_money, wusuijishu, shengmoney, zzmoney, timer):
- library = mydb[f'library{bot_id}']
- library.insert_one({
- 'bot_id': bot_id,
- 'user_id': user_id,
- 'trc20': trc20,
- 'today_money': today_money,
- 'wusuijishu': wusuijishu,
- 'shengmoney': shengmoney,
- 'zzmoney': zzmoney,
- 'timer': timer
- })
- def addressdata(bot_id, user_id, trc20, timer, change_timer):
- address = mydb[f'address{bot_id}']
- address.insert_one({
- 'user_id': [user_id],
- 'trc20': trc20,
- 'timer': timer,
- 'change_timer': change_timer,
- 'USDT': 0,
- 'TRX': 0,
- 'tjcs': 1,
- 'syn': False,
- 'del': False
- })
- def wallet_data(bot_id, projectname, trc20, sign, USDT, TRX, timer):
- wallet = mydb[f'wallet{bot_id}']
- wallet.insert_one({
- 'bot_id': bot_id,
- 'projectname': projectname,
- 'trc20': trc20,
- 'sign': sign,
- 'USDT': USDT,
- 'TRX': TRX,
- 'TRXstate': 0,
- 'USDTstate': 0,
- 'timer': timer
- })
- def beiyongzl(trc20, sign, USDT, TRX, timer):
- byzl.insert_one({
- 'trc20': trc20,
- 'sign': sign,
- 'USDT': USDT,
- 'TRX': TRX,
- 'TRXstate': 0,
- 'USDTstate': 0,
- 'timer': timer,
- 'zhiya': 0,
- 'shiyong': 0
- })
- def keybutton(bot_id, Row, first):
- key = mydb[f'key{bot_id}']
- key.insert_one({
- 'bot_id': bot_id,
- 'Row': Row,
- 'first': first,
- 'projectname': '点击修改内容',
- 'text': '',
- 'file_id': '',
- 'file_type': '',
- 'key_text': '',
- 'keyboard': b'\x80\x03]q\x00.',
- 'entities': b'\x80\x03]q\x00.'
- })
- def print_telegram(bot_id, transaction_id, trc20, cztext):
- print_tg = mydb[f'print_tg{bot_id}']
- print_tg.insert_one({
- 'bot_id': bot_id,
- 'transaction_id': transaction_id,
- 'trc20': trc20,
- 'text': cztext,
- })
- def ywysifa(ywy_id, projectname, text, file_id, key_text, keyboard, send_type):
- ywysf.insert_one({
- 'ywy_id': ywy_id,
- 'projectname': projectname,
- 'text': text,
- 'file_id': file_id,
- 'key_text': key_text,
- 'keyboard': keyboard,
- 'send_type': send_type,
- 'state': 1,
- 'entities': b'\x80\x03]q\x00.'
- })
- def sifatuwen(bot_id, projectname, text, file_id, key_text, keyboard, send_type):
- sftw = mydb[f'sfwt{bot_id}']
- sftw.insert_one({
- 'bot_id': bot_id,
- 'projectname': projectname,
- 'text': text,
- 'file_id': file_id,
- 'key_text': key_text,
- 'keyboard': keyboard,
- 'send_type': send_type,
- 'state': 1,
- 'entities': b'\x80\x03]q\x00.'
- })
- def shanduiywybaobiao(ywy_id, timestamp, txid, zztype, user_id, trc20, projectname, USDT, TRX, text, tranhash, timer):
- sdbbb.insert_one({
- 'ywy_id': ywy_id,
- 'timestamp': timestamp,
- 'txid': txid,
- 'zztype': zztype,
- 'user_id': user_id,
- 'trc20': trc20,
- 'projectname': projectname,
- 'USDT': USDT,
- 'TRX': TRX,
- 'text': text,
- 'tranhash': tranhash,
- 'timer': timer,
- 'zlstate': 0
- })
- def userlogdata(bot_id, order_id, timestamp, txid, zztype, user_id, trc20, projectname, USDT, TRX, text, tranhash, timer):
- user_log = mydb[f'user_log{bot_id}']
- user_log.insert({
- 'bot_id': bot_id,
- 'order_id': order_id,
- 'timestamp': timestamp,
- 'txid': txid,
- 'zztype': zztype,
- 'user_id': user_id,
- 'trc20': trc20,
- 'projectname': projectname,
- 'USDT': USDT,
- 'TRX': TRX,
- 'text': text,
- 'tranhash': tranhash,
- 'timer': timer,
- 'zlstate': 0
- })
- def user_data(bot_id, count_id, user_id, username, firstname, lastname, fullname, creation_time,
- last_contact_time,code):
- user = mydb[f'user{bot_id}']
- user.insert_one({
- 'count_id': count_id,
- 'user_id': user_id,
- 'username': username,
- 'firstname': firstname,
- 'lastname': lastname,
- 'fullname': fullname,
- 'state': '1',
- 'USDT': 0,
- 'TRX': 0,
- 'creation_time': creation_time,
- 'last_contact_time': last_contact_time,
- 'code': code,
- 'sign': 0,
- 'tycs': 0,
- 'tgtycs': 0,
- 'grade': 'ptuser',
- 'dengji': 'L0',
- 'dazhe': 1,
- 'gerensuanli': 0,
- 'tuanduisuanli': 0,
- 'lang': ''
- })
- def management(bot_id, user_id, trc20, today_money, wusuijishu, shengmoney, zzmoney, timer):
- order = mydb[f'order{bot_id}']
- order.insert_one({
- 'bot_id': bot_id,
- 'user_id': user_id,
- 'trc20': trc20,
- 'today_money': today_money,
- 'wusuijishu': wusuijishu,
- 'shengmoney': shengmoney,
- 'zzmoney': zzmoney,
- 'timer': timer
- })
- def pledge_data(projectname, bot_id, order_id, timestamp, tranhash, txid, user_id, owner, amount, money, today_money, shengmoney, resource,
- receiver, pencount, quantity, days, createtime, Expiration):
- pledge = mydb[f'pledge{bot_id}']
- pledge.insert_one({
- 'projectname': projectname,
- 'bot_id': bot_id,
- 'order_id': order_id,
- 'timestamp': timestamp,
- 'tranhash': tranhash,
- 'txid': txid,
- 'user_id': user_id,
- 'owner': owner,
- 'amount': amount,
- 'money': money,
- 'today_money': today_money,
- 'shengmoney': shengmoney,
- 'resource': resource,
- 'receiver': receiver,
- 'pencount': pencount,
- 'quantity': quantity,
- 'days': days,
- 'createtime': createtime,
- 'Expiration': Expiration,
- 'authxf': 0
- })
- def zqbdata(bot_id,projectname,transaction_id,transferType,ownerAddress,toAddress,money,timestamp):
- zqb = mydb[f'zqb{bot_id}']
- zqb.insert_one({
- 'bot_id': bot_id,
- 'projectname': projectname,
- 'transaction_id': transaction_id,
- 'transferType': transferType,
- 'ownerAddress': ownerAddress,
- 'toAddress': toAddress,
- 'money': money,
- 'timestamp': timestamp
- })
- def get_order(bot_id):
- return mydb[f'order{bot_id}']
- def get_zqb(bot_id):
- return mydb[f'zqb{bot_id}']
- def get_qukuai():
- return mydb['qukuai']
- def get_kehuduan():
- return mydb['kehuduan']
- def get_library(bot_id):
- return mydb[f'library{bot_id}']
- def get_pledge(bot_id):
- return mydb[f'pledge{bot_id}']
- def get_bdadd(bot_id):
- return mydb[f'bdadd{bot_id}']
- def get_user_log(bot_id):
- return mydb[f'user_log{bot_id}']
- def get_wallet(bot_id):
- return mydb[f'wallet{bot_id}']
- def get_sftw(bot_id):
- return mydb[f'sfwt{bot_id}']
- def get_print_tg(bot_id):
- return mydb[f'print_tg{bot_id}']
- def get_group(bot_id):
- return mydb[f'user{bot_id}']
- def get_address(bot_id):
- return mydb[f'address{bot_id}']
- def get_key(bot_id):
- return mydb[f'key{bot_id}']
- def get_tiyan(bot_id):
- return mydb[f'tylog{bot_id}']
- def tiyanlog(bot_id,bianhao, user_id, firstname,owner, receiver, amount, timer,Expiration, txid):
- tylog = mydb[f'tylog{bot_id}']
- tylog.insert_one({
- 'bot_id': bot_id,
- 'bianhao': bianhao,
- 'user_id': user_id,
- 'firstname': firstname,
- 'owner': owner,
- 'receiver': receiver,
- 'amount': amount,
- 'timer': timer,
- 'Expiration': Expiration,
- 'txid': txid,
- })
-
- def daikuanlog(bianhao, user_id, firstname,owner, receiver, timer,Expiration, txid):
- dkzl.insert_one({
- 'bianhao': bianhao,
- 'user_id': user_id,
- 'firstname': firstname,
- 'owner': owner,
- 'receiver': receiver,
- 'timer': timer,
- 'Expiration': Expiration,
- 'txid': txid,
- })
- def zduguize(projectname, energy_sales, Acceleration_bonus, Computational):
- jlzhidu.insert_one({
- 'projectname': projectname,
- 'energy_sales': energy_sales,
- 'Acceleration_bonus': Acceleration_bonus,
- 'Computational': Computational
- })
- # import string,random
- # def activation_code(id,length=10):
- # prefix = hex(int(id))[2:]+ 'L'
- # length = length - len(prefix)
- # chars=string.ascii_letters+string.digits
- # return prefix + ''.join([random.choice(chars) for i in range(length)])
- def zzhzcad(money):
- money = float(money) if str(money).count('.') > 0 else int(money)
- money = round(money, 6)
- return money
-
- if __name__ == '__main__':
- connect_to_mongodb()
- from decimal import Decimal
- Rental.delete_many({})
- # Rental_duration(7, 0)
- # Rental_duration(30, 0.05)
- # Rental_duration(90, 0.1)
- # Rental_duration(180, 0.15)
- # Rental_duration(365, 0.2)
- # get_group(5853415365).update_many({},{"$set":{"lang": 'zh'}})
- # for i in list(jiangli.find({})):
- # timer = i['timer']
- # dt = datetime.datetime.strptime(timer, "%Y-%m-%d %H:%M:%S")
-
- # # 加上24小时
- # dt_plus_24h = dt + timedelta(hours=24)
-
- # # 将结果转回时间字符串
- # new_time_str = dt_plus_24h.strftime("%Y-%m-%d %H:%M:%S")
- # ddid = i['_id']
- # jiangli.update_one({'_id': ddid},{"$set":{'midnight_tomorrow_str': new_time_str}})
-
-
-
- # uid = '5baaf819-870a-46da-a2c5-96406fed7d90'
- # xgdict = {str(5963475006): {"state": 1}}
- # jiangli.update_one({"mining_machine_id": uid}, {"$set": {f'{user_id}.state': 0}})
- # get_group(bot_id).update_many({},{"$set":{'dengji': 'L0'}})
- # supercomputing.drop({})
- # chaosuanjiedian(1, 200, 30000, 0.05)
- # chaosuanjiedian(2, 1000, 90000, 0.1)
- # chaosuanjiedian(3, 5000, 300000, 0.2)
- # chaosuanjiedian(4, 30000, 600000, 0.3)
- # chaosuanjiedian(5, 60000, 1800000, 0.4)
- # chaosuanjiedian(6, 100000, 5000000, 0.5)
- # Energy_Miner('A型能量矿机', 200, 300, 2, 1)
- # Energy_Miner('B型能量矿机', 1000, 1800, 12, 1.2)
- # Energy_Miner('C型能量矿机', 5000, 10000, 65, 1.3)
- # Energy_Miner('D型能量矿机', 30000, 70000, 450, 1.5)
- # rule = supercomputing.find_one({"gerensuanli": {"$lte": 0}, "tuanduisuanli": {"$lte": 0}},
- # sort=[("level", pyDESCENDING)])
- # print(rule)
- # buy_records.update_many({},{"$set":{"state": 0}})
|