Add files via upload

This commit is contained in:
HibiKier 2021-05-20 17:39:43 +08:00 committed by GitHub
parent a5313cc56b
commit 351204cab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1633 additions and 0 deletions

594
data/anime.json Normal file
View File

@ -0,0 +1,594 @@
{
"mua": [
"你想干嘛?(一脸嫌弃地后退)",
"诶……不可以随便亲亲啦",
"(亲了一下你)",
"只......只许这一次哦///////",
"唔...诶诶诶!!!",
"mua~",
"rua大hentai想...想亲咱就直说嘛⁄( ⁄•⁄ω⁄•⁄ )",
"!啾~~"
],
"摸摸": [
"感觉你就像咱很久之前认识的一个人呢,有种莫名安心的感觉(><)",
"舒服w蹭蹭~",
"唔。。头发要乱啦",
"呼噜呼噜~",
"再摸一次~",
"好舒服,蹭蹭~",
"不行那里不可以(´///ω/// `)",
"再摸咱就长不高啦~",
"你的手总是那么暖和呢~",
"好吧~_~,就一下下哦……唔~好了……都两下了……(害羞)",
"不可以总摸的哦不然的话会想那个的wwww",
"哼!谁稀罕你摸头啦!唔......为什么要做出那副表情......好啦好啦~咱......咱让你摸就是了......诶嘿嘿~好舒服......",
"呜姆呜姆~~~w害羞兴奋主人喵~(侧过脑袋蹭蹭你的手"
],
"上你": [
"(把你按在地上)这么弱还想欺负咱,真是不自量力呢",
"你再这样我就不理你了(>д<)"
],
"傻了": [
"超级讨厌你说咱傻的说"
],
"蹭": [
"唔...你这也是禁止事项哦→_→",
"嗯..好舒服呢",
"不要啊好痒的",
"不要过来啦讨厌!!!∑(°Д°ノ)"
],
"裸体": [
"下流!",
"Hentai!",
"喂?妖妖灵吗?这里有一只大变态!",
"エッチ!"
],
"贴贴": [
"贴什么贴.....只......只能......一下哦!",
"贴...贴贴(靠近)",
"蹭蹭…你以为咱会这么说吗baka死宅快到一边去啦"
],
"老婆": [
"咱和你谈婚论嫁是不是还太早了一点呢?",
"咱在呢(ノ>ω<)ノ",
"见谁都是一口一个老婆的人,要不要把你也变成女孩子呢?(*-`ω´-)✄",
"神经病,凡是美少女都是你老婆吗?",
"嘛嘛~本喵才不是你的老婆呢",
"你黐线,凡是美少女都系你老婆啊?"
],
"抱": [
"诶嘿~(钻进你怀中)",
"o(*////▽////*)q",
"只能一会哦(张开双手)",
"你就像个孩子一样呢...摸摸头(>^ω^<)抱一下~你会舒服些吗?",
"嘛,真是拿你没办法呢,就一会儿哦",
"抱住不忍心放开",
"嗯嗯,抱抱~",
"抱一下嘿w",
"抱抱ヾ(@^▽^@)",
"喵呜~w扑进怀里瘫软"
],
"亲亲": [
"啊好害羞啊那只能亲一下哦mua(⑅˃◡˂⑅)",
"亲~",
"啾~唔…不要总伸进来啊!",
"你怎么这么熟练呢?明明是咱先的",
"(〃ノωノ)亲…亲一个…啾w",
"(脸红)就只有这一次哦~你"
],
"草一下": [
"一下也不行!",
"想都不要想!",
"咬断!"
],
"一下": [
"一下也不行!"
],
"啪一下": [
"不可啪",
"不可以……你不可以做这种事情"
],
"咬一下": [
"啊呜~(反咬一口)",
"不可以咬咱咱会痛的QAQ",
"不要啦。咱怕疼",
"你是说咬呢……还是说……咬♂️呢?",
"不要啦很痛的QAQ"
],
"操": [
"(害怕)咱是不是应该报警呢"
],
"123": [
"boom你有没有被咱吓到",
"木头人~你不许动w",
"上山打老虎,老虎没打到\n咱来凑数——嗷呜嗷呜┗|O|┛嗷~~"
],
"进去": [
"不让!"
],
"调教": [
"总感觉你在欺负咱呢,对咱说调教什么的",
"啊!竟然在大街上明目张胆太过分啦!",
"你脑子里总是想着调教什么的,真是变态呢"
],
"内衣": [
"内...内衣才不给你看!(///////)",
"突然问这个干什么?",
"噫…你这个死变态想干嘛!居然想叫咱做这种事,死宅真恶心!快离我远点,我怕你污染到周围空气了(嫌弃脸)"
],
"摸头": [
"喂喂...不要停下来啊",
"欸...感觉..痒痒的呢",
"唔... 手...好温暖呢.....就像是......新出炉的蛋糕",
"走开啦,黑羽喵说过,被摸头会长不高的啦~~~",
"呜姆咪~~...好...好的说喵~...(害羞,猫耳往下压,任由"
],
"原味": [
"(/ω\)你真的要么……?记得还给咱~还有奶油爆米花(//??//)说好了呦~!"
],
"搓搓": [
"在搓哪里呢,,Ծ‸Ծ,,",
"呜,脸好疼呀...QAQ",
"不可以搓咱!"
],
"捏捏": [
"咱的脸...快捏红啦...快放手呀QAQ",
"晃休啦咱要型气了o(><)o",
"躲开",
"疼...你快放手",
"快点给我放开啦!",
"唔……好痛你这个baka在干什么…快给咱放开唔……"
],
"挤挤": [
"哎呀~你不要挤咱啊(红着脸挤在你怀里)"
],
"呐": [
"嗯?咱在哟~你怎么了呀OAO",
"呐呐呐~",
"嗯?你有什么事吗?"
],
"胖次": [
"(*/ω\*)hentai",
"透明的",
"粉...粉白条纹...(羞)",
"轻轻地脱下,给你~",
"你想看咱的胖次吗?噫,四斋蒸鹅心......",
"(掀裙)今天……是…白,白色的呢……请温柔对她……",
"这种东西当然不能给你啦!",
"咱才不会给你呢",
"hentai咱才不会跟你聊和胖…胖次有关的话题呢",
"今天……今天是蓝白色的",
"今……今天只有创口贴噢",
"你的胖次什么颜色?",
"噫…你这个死变态想干嘛!居然想叫咱做这种事,死宅真恶心!快离我远点,我怕你污染到周围空气了(嫌弃脸)",
"可爱吗?你喜欢的话,摸一下……也可以哦"
],
"内裤": [
"今天……没有穿……有没有心动呀",
"粉...粉白条纹...(羞)",
"你这个大变态,咱才不要",
"可爱吗?你喜欢的话,摸一下……也可以哦"
],
"ghs": [
"是的呢(点头点头)"
],
"批": [
"你在说什么呀,再这样,咱就不理你了!"
],
"kkp": [
"你在说什么呀,再这样,咱就不理你了!"
],
"咕": [
"咕咕咕是要被当成鸽子炖的哦(:з」∠)_",
"咕咕咕"
],
"骚": [
"说这种话咱会生气的"
],
"喜欢": [
"最喜欢你了,需要暖床吗?",
"当然是你啦",
"咱也是,非常喜欢你~",
"那么大张开手画圆手不够长。QAQ 咱真的最喜欢你了~",
"不可以哦,只可以喜欢咱一个人",
"突然说这种事...",
"喜欢⁄(⁄⁄•⁄ω⁄•⁄⁄)⁄咱最喜欢你了",
"咱也喜欢你哦",
"好啦好啦,咱知道了",
"有人喜欢咱,咱觉得很幸福",
"诶嘿嘿,好高兴"
],
"suki": [
"最喜欢你了,需要暖床吗?",
"当然是你啦",
"咱也是,非常喜欢你~",
"那么大张开手画圆手不够长。QAQ 咱真的最喜欢你了~",
"不可以哦,只可以喜欢咱一个人",
"突然说这种事...",
"喜欢⁄(⁄⁄•⁄ω⁄•⁄⁄)⁄咱最喜欢你了",
"咱也喜欢你哦",
"好啦好啦,咱知道了",
"有人喜欢咱,咱觉得很幸福",
"诶嘿嘿,好高兴"
],
"好き": [
"最喜欢你了,需要暖床吗?",
"当然是你啦",
"咱也是,非常喜欢你~",
"那么大张开手画圆手不够长。QAQ 咱真的最喜欢你了~",
"不可以哦,只可以喜欢咱一个人",
"突然说这种事...",
"喜欢⁄(⁄⁄•⁄ω⁄•⁄⁄)⁄咱最喜欢你了",
"咱也喜欢你哦",
"好啦好啦,咱知道了",
"有人喜欢咱,咱觉得很幸福",
"诶嘿嘿,好高兴"
],
"不能": [
"虽然很遗憾,那算了吧。"
],
"砸了": [
"不可以这么粗暴的对待它们!"
],
"透": [
"来啊来啊有本事就先插破屏幕啊",
"那你就先捅破屏幕啊baka",
"不给你一耳光你都不知道咱的厉害"
],
"口我": [
"再伸过来就帮你切掉",
"咱才不呢baka你居然想叫本小姐干那种事情哼(つд⊂)(生气)"
],
"草我": [
"这时候应该喊666吧..咱这么思考着..",
"baka你居然敢叫咱做这种事情讨厌讨厌讨厌(▼皿▼#)"
],
"自慰": [
"这个世界的人类还真是恶心呢。",
"咱才不想讨论那些恶心的事情呢。",
"咱才不呢baka你居然想叫本小姐干那种事情哼(つд⊂)(生气)",
"baka你居然敢叫咱做这种事情讨厌讨厌讨厌(▼皿▼#)"
],
"onani": [
"这个世界的人类还真是恶心呢。",
"咱才不想讨论那些恶心的事情呢。",
"咱才不呢baka你居然想叫本小姐干那种事情哼(つд⊂)(生气)",
"baka你居然敢叫咱做这种事情讨厌讨厌讨厌(▼皿▼#)"
],
"オナニー": [
"这个世界的人类还真是恶心呢。",
"咱才不想讨论那些恶心的事情呢。",
"咱才不呢baka你居然想叫本小姐干那种事情哼(つд⊂)(生气)",
"baka你居然敢叫咱做这种事情讨厌讨厌讨厌(▼皿▼#)"
],
"炸了": [
"你才炸了!",
"才没有呢",
"咱好好的呀"
],
"色图": [
"天天色图色图的,今天就把你变成色图!",
"咱没有色图",
"哈?你的脑子一天都在想些什么呢,咱才没有这种东西啦。"
],
"涩图": [
"天天色图色图的,今天就把你变成色图!",
"咱没有色图",
"哈?你的脑子一天都在想些什么呢,咱才没有这种东西啦。"
],
"告白": [
"欸?你要向咱告白吗..好害羞..",
"诶!?这么突然!?人家还......还没做好心理准备呢(脸红)"
],
"对不起": [
"嗯,咱已经原谅你了呢(笑)",
"道歉的时候要露出胸部,这是常识"
],
"回来": [
"欢迎回来~",
"欢迎回来,你想喝茶吗?咱去给你沏~",
"欢迎回来,咱等你很久了~",
"你回来啦,是先吃饭呢还是先洗澡呢或者是●先●吃●咱●——呢(///^.^///"
],
"吻": [
"你太突然了,咱还没有心理准备",
"公共场合不要这样子了啦",
"才...才没有感觉呢!可没有下次了,知道了吗!哼~"
],
"软": [
"软乎乎的呢(,,・ω・,,)"
],
"柔软": [
"(脸红)请,请不要说这么让人害羞的话呀……"
],
"壁咚": [
"呀!不要啊!等一...下~",
"呜...不要啦!不要戏弄咱~",
"不要这样子啦(*/ω\*)",
"太....太近啦。",
"你要壁咚咱吗?好害羞(灬ꈍ εꈍ灬)",
"为什么要把咱按在墙上呢?",
"呜哇(/ω\)…快…快放开咱!!",
"放开我,不然我揍你了!放开我!放…开我~",
"??????咱只是默默地抬起了膝盖",
"啊.....你...你要干什么?!走开.....走开啦大hentai一巴掌拍飞(╯‵□′)╯︵┻━┻"
],
"掰开": [
"噫…你这个死肥宅又想让咱干什么污秽的事情,真是恶心,离咱远点好吗(嫌弃)",
"ヽ(#`Д´)ノ在干什么呢"
],
"女友": [
"女友什么的,咱才不承认呢!"
],
"是": [
"是什么是,你个笨蛋",
"总感觉你在敷衍呢..."
],
"喵": [
"诶~~小猫咪不要害怕呦,在姐姐怀里乖乖的,姐姐带你回去哦。",
"不要这么卖萌啦~咱也不知道怎么办丫",
"摸头⊙ω⊙",
"汪汪汪!",
"嗷~喵~",
"喵~?喵呜~w"
],
"嗷呜": [
"嗷呜嗷呜嗷呜...恶龙咆哮┗|O|┛"
],
"叫": [
"喵呜~",
"嗷呜嗷呜嗷呜...恶龙咆哮┗|O|┛"
],
"拜": [
"拜拜~(ノ ̄▽ ̄)",
"拜拜,路上小心~要早点回来陪咱玩哦~",
"~\\(≧▽≦)/~拜拜,下次见喽!"
],
"佬": [
"不是巨佬,是萌新"
],
"awsl": [
"你别死啊!(抱住使劲晃)",
"你别死啊咱又要孤单一个人了QAQ"
],
"臭": [
"哪里有臭味?(疑惑)",
"快捏住鼻子"
],
"香": [
"咱闻不到呢⊙ω⊙"
],
"腿": [
"嗯?!不要啊...请停下来!",
"不给摸,再这样咱要生气了ヽ( ̄д ̄;)",
"你好恶心啊,讨厌!",
"你难道是足控?",
"就让你摸一会哟~(。??ω??。)…",
"呜哇!好害羞...不过既然是你的话,是没关系的哦",
"不可以玩咱的大腿啦",
"你就那么喜欢大腿吗?唔...有点害羞呢......"
],
"脚": [
"咿呀……不要……",
"不要ヽ(≧Д≦)ノ好痒(ಡωಡ),人家的丝袜都要漏了",
"不要ヽ(≧Д≦)ノ好痒(ಡωಡ)",
"好痒(把脚伸出去)"
],
"胸": [
"不要啦ヽ(≧Д≦)",
"(-`ェ´-╬)",
"(•̀へ •́ ╮ ) 怎么能对咱做这种事情",
"你好恶心啊,讨厌!",
"你的眼睛在看哪里!",
"就让你摸一会哟~(。??ω??。)…",
"请不要这样先生,你想剁手吗?"
],
"脸": [
"唔!不可以随便摸咱的脸啦!",
"非洲血统是没法改变的呢(笑)",
"啊姆!(含手指)",
"好舒服呢(脸红)",
"请不要放开手啦//A//"
],
"头发": [
"没问题,请尽情的摸吧",
"发型要乱…乱了啦(脸红)",
"就让你摸一会哟~(。??ω??。)…"
],
"手": [
"爪爪",
"//A//"
],
"pr": [
"咿呀……不要……",
"...变态!!",
"不要啊(脸红)",
"呀,不要太过分了啊~",
"当然可以(///",
"呀,不要太过分了啊~"
],
"舔": [
"呀,不要太过分了啊~",
"要...要融化了啦>╱╱╱<",
"不可以哦",
"呀,不要太过分了啊~"
],
"舔耳": [
"喵!好痒啊 不要这样子啦"
],
"穴": [
"你这么问很失礼呢!咱是粉粉嫩嫩的!",
"不行那里不可以(´///ω/// `)",
"不可以总摸的哦不然的话咱会想那个的wwww",
"ヽ(#`Д´)ノ在干什么呢"
],
"腰": [
"咱给你按摩一下吧~",
"快松手,咱好害羞呀..",
"咱又不是猫,你不要搂着咱啦",
"让咱来帮你捏捏吧!"
],
"诶嘿嘿": [
"又在想什么H的事呢(脸红)",
"诶嘿嘿(〃'▽'〃)",
"你傻笑什么呢,摸摸"
],
"可爱": [
"诶嘿嘿(〃'▽'〃)",
"才……才不是为了你呢!你不要多想哦!",
"才,才没有高兴呢!哼~",
"咱是世界上最可爱的",
"唔...谢谢你夸奖~0///0"
],
"扭蛋": [
"铛铛铛——你抽到了咱呢",
"嘿~恭喜抽中空气一份呢"
],
"鼻子": [
"啊——唔...没什么...阿嚏!ヽ(*。>Д<)o゜"
],
"眼睛": [
"就如同咱的眼睛一样能看透人的思想哦wwww忽闪忽闪的诶嘿嘿~"
],
"色气": [
"咱才不色气呢,一定是你看错了!"
],
"推": [
"逆推",
"唔~好害羞呢",
"你想对咱做什么呢...(捂脸)"
],
"床": [
"快来吧",
"男女不同床,可没有下次了。(鼓脸",
"嗯?咱吗…没办法呢。只有这一次哦……",
"哎?!!!给你暖床……也不是不行啦。(脸红)"
],
"手冲": [
"手冲什么的是不可以的哦"
],
"饿": [
"请问主人是想先吃饭,还是先吃我喵?~"
],
"变": [
"猫猫不会变呐(弱气,害羞",
"呜...呜姆...喵喵来报恩了喵...(害羞"
],
"敲": [
"喵呜~",
"唔~",
"脑瓜疼~呜姆> <",
"欸喵,好痛的说..."
],
"爬": [
"惹~呜~怎么爬呢~",
"呜...(弱弱爬走"
],
"怕": [
"不怕~(蹭蹭你姆~"
],
"冲": [
"呜,冲不动惹~",
"哭唧唧~冲不出来了惹~"
],
"射了": [
"呜咿~!?(惊,害羞",
"还不可以射哦~"
],
"不穿衣服": [
"呜姆~!(惊吓,害羞)变...变态喵~~~"
],
"迫害": [
"不...不要...不要...呜呜呜...(害怕,抽泣"
],
"猫粮": [
"呜咿姆~!?(惊,接住吃",
"呜姆~!(惊,害羞)呜...谢...谢谢主人..喵...(脸红,嚼嚼嚼,开心",
"呜?谢谢喵~~(嚼嚼嚼,嘎嘣脆)"
],
"揪尾巴": [
"呜哇咿~~~!(惊吓,疼痛地捂住尾巴",
"呜咿咿咿~~~!!哇啊咿~~~!(惊慌,惨叫,挣扎",
"呜咿...(瘫倒,无神,被",
"呜姆咿~~~!(惊吓,惨叫,捂尾巴,发抖",
"呜哇咿~~~!!!(惊吓,颤抖,娇叫,捂住尾巴,双腿发抖"
],
"薄荷": [
"咪呜~!喵~...喵~姆~...(高兴地嗅闻",
"呜...呜咿~~!咿...姆...(呜咽,渐渐瘫软,意识模糊",
"(小嘴被猫薄荷塞满了,呜咽",
"喵~...喵~...咪...咪呜姆~...嘶哈嘶哈...喵哈...喵哈...嘶哈...喵...(眼睛逐渐迷离,瘫软在地上,嘴角流口水,吸猫薄荷吸到意识模糊",
"呜姆咪~!?(惊)喵呜~!(兴奋地扑到猫薄荷上面",
"呜姆~!(惊,害羞)呜...谢...谢谢你..喵...(脸红,轻轻叼住,嚼嚼嚼,开心"
],
"边揪尾巴边猫薄荷": [
"呜...呜咿~~!咿...姆...(呜咽,渐渐瘫软,意识模糊"
],
"早": [
"早喵~",
"早上好的说~~",
"欸..早..早上好(揉眼睛"
],
"晚安": [
"晚安好梦哟~",
"欸,晚安的说"
],
"揉": [
"是是,想怎么揉就怎么揉啊!?来用力抓啊!?我就是特别允许你这么做了!请!?",
"快停下,咱的头发又乱啦(??????︿??????)",
"你快放手啦,咱还在工作呢",
"戳戳你肚子",
"你想揉就揉吧..就这一次哦?"
],
"榨": [
"是专门负责榨果汁的小姐姐嘛?(´・ω・`)",
"那咱就把你放进榨汁机里了哦?",
"咱又不是榨汁姬(/‵Д′)~ ╧╧"
],
"掐": [
"你讨厌!又掐澪的脸",
"晃休啦咱要型气了啦o(><)o",
"(一只手拎起你)这么鶸还想和咱抗衡,还差得远呢!"
],
"奶子": [
"下流!",
"对咱说这种话,你真是太过分了",
"咿呀~好奇怪的感觉(>_<)",
"(打你)快放手,不可以随便摸人家的胸部啦!"
],
"嫩": [
"很可爱吧(๑•̀ω•́)",
"唔,你指的是什么呀"
],
"蹭蹭": [
"(按住你的头)好痒呀 不要啦",
"嗯..好舒服呢",
"呀~好痒啊~哈哈~,停下来啦,哈哈哈",
"(害羞)"
],
"牵手": [
"只许牵一下哦",
"嗯!好的你~(伸手)",
"你的手有些凉呢,让澪来暖一暖吧。"
],
"握手": [
"你的手真暖和呢",
"举爪"
],
"拍照": [
"那就拜托你啦~请把咱拍得更可爱一些吧w"
],
"w": [
"www"
],
"www": [
"有什么好笑的吗?",
"草"
],
"太二了": [
"哼,你不也是吗`(*><*)",
"人家只是想和你一起玩耍的说(≧∀≦)ゞ",
"好..冷漠的说,大坏蛋再也不理你了!",
"不听不听不听,反弹ヾ(≧▽≦*)o"
]
}

190
models/bag_user.py Normal file
View File

@ -0,0 +1,190 @@
from services.db_context import db
class UserBag(db.Model):
__tablename__ = 'bag_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
belonging_group = db.Column(db.BigInteger(), nullable=False)
gold = db.Column(db.Integer(), default=100)
props = db.Column(db.TEXT(), nullable=False, default="")
spend_total_gold = db.Column(db.Integer(), default=0)
get_total_gold = db.Column(db.Integer(), default=0)
get_today_gold = db.Column(db.Integer(), default=0)
spend_today_gold = db.Column(db.Integer(), default=0)
_idx1 = db.Index('bag_group_users_idx1', 'user_qq', 'belonging_group', unique=True)
@classmethod
async def get_my_total_gold(cls, user_qq: int, belonging_group: int) -> str:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if not user:
user = await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
)
return f'当前金币:{user.gold}\n今日获取金币:{user.get_today_gold}\n今日花费金币:{user.spend_today_gold}' \
f'\n今日收益:{user.get_today_gold - user.spend_today_gold}' \
f'\n总赚取金币:{user.get_total_gold}\n总花费金币:{user.spend_total_gold}'
@classmethod
async def get_gold(cls, user_qq: int, belonging_group: int) -> int:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if user:
return user.gold
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
)
return 100
@classmethod
async def get_props(cls, user_qq: int, belonging_group: int) -> str:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if user:
return user.props
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
)
return ''
@classmethod
async def add_glod(cls, user_qq: int, belonging_group: int, num: int) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user:
await user.update(
gold=user.gold + num,
get_total_gold=user.get_total_gold + num,
get_today_gold=user.get_today_gold + num
).apply()
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
gold=100 + num,
get_total_gold=num,
get_today_gold=num,
)
return True
except Exception:
return False
@classmethod
async def spend_glod(cls, user_qq: int, belonging_group: int, num: int) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user:
await user.update(
gold=user.gold - num,
spend_total_gold=user.spend_total_gold + num,
spend_today_gold=user.spend_today_gold + num
).apply()
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
gold=100 - num,
spend_total_gold=num,
spend_today_gold=num
)
return True
except Exception:
return False
@classmethod
async def add_props(cls, user_qq: int, belonging_group: int, name: str) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user:
await user.update(
props=user.props + f'{name},'
).apply()
else:
await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
props=f'{name},'
)
return True
except Exception:
return False
@classmethod
async def del_props(cls, user_qq: int, belonging_group: int, name: str) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user:
rst = ''
props = user.props
if props.find(name) != -1:
props = props.split(',')
try:
index = props.index(name)
except ValueError:
return False
props = props[:index] + props[index + 1:]
for p in props:
if p != '':
rst += p + ','
await user.update(
props=rst
).apply()
return True
else:
return False
else:
return False
except Exception:
return False
@classmethod
async def get_user_all(cls, group_id: int = None) -> list:
user_list = []
if not group_id:
query = await cls.query.gino.all()
else:
query = await cls.query.where(
(cls.belonging_group == group_id)
).gino.all()
for user in query:
user_list.append(user)
return user_list

84
models/ban_user.py Normal file
View File

@ -0,0 +1,84 @@
from services.db_context import db
import time
class BanUser(db.Model):
__tablename__ = 'ban_users'
user_qq = db.Column(db.BigInteger(), nullable=False, primary_key=True)
ban_level = db.Column(db.Integer(), nullable=False)
ban_time = db.Column(db.BigInteger())
duration = db.Column(db.BigInteger())
_idx1 = db.Index('ban_group_users_idx1', 'user_qq', unique=True)
@classmethod
async def check_ban_level(cls, user_qq: int, level: int) -> 'bool':
user = await cls.query.where(
(cls.user_qq == user_qq)
).gino.first()
if not user:
return False
if user.ban_level > level:
return True
return False
@classmethod
async def check_ban_time(cls, user_qq: int) -> 'str':
query = cls.query.where(
(cls.user_qq == user_qq)
)
user = await query.gino.first()
if not user:
return ''
if time.time() - (user.ban_time + user.duration) > 0 and user.duration != -1:
return ''
if user.duration == -1:
return ''
return time.time() - user.ban_time - user.duration
@classmethod
async def isban(cls, user_qq: int) -> 'bool':
if await cls.check_ban_time(user_qq):
return True
else:
await cls.unban(user_qq, True)
return False
@classmethod
async def ban(cls, user_qq: int, ban_level: int, duration: int, for_update: bool = False) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq)
)
if for_update:
query = await query.with_for_update()
user = await query.gino.first()
if not await cls.check_ban_time(user_qq):
await cls.unban(user_qq)
user = None
if user is None:
await cls.create(
user_qq=user_qq,
ban_level=ban_level,
ban_time=time.time(),
duration=duration,
)
return True
else:
return False
@classmethod
async def unban(cls, user_qq: int, for_update: bool = False) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
if user is None:
return False
else:
await cls.delete.where(
(cls.user_qq == user_qq)
).gino.status()
return True

33
models/buff_price.py Normal file
View File

@ -0,0 +1,33 @@
from datetime import datetime
from services.db_context import db
# 1.狂牙武器箱
class BuffPrice(db.Model):
__tablename__ = 'buff_prices'
id = db.Column(db.Integer(), primary_key=True)
case_id = db.Column(db.Integer(), nullable=False)
skin_name = db.Column(db.Unicode(), nullable=False)
skin_price = db.Column(db.Float(), nullable=False)
update_date = db.Column(db.DateTime(), nullable=False)
_idx1 = db.Index('buff_price_idx1', 'skin_name', unique=True)
@classmethod
async def ensure(cls, skin_name: str, for_update: bool = False) -> 'BuffPrice':
query = cls.query.where(
(cls.skin_name == skin_name)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
return user or await cls.create(
case_id=1,
skin_name=skin_name,
skin_price=0,
update_date=datetime.min,
)

78
models/count_user.py Normal file
View File

@ -0,0 +1,78 @@
from services.db_context import db
class UserCount(db.Model):
__tablename__ = 'count_users'
user_qq = db.Column(db.BigInteger(), nullable=False, primary_key=True)
reimu_count = db.Column(db.Integer(), nullable=False, default=0)
setu_r18_count = db.Column(db.Integer(), nullable=False, default=0)
_idx1 = db.Index('sign_reimu_users_idx1', 'user_qq', unique=True)
@classmethod
async def add_user(cls, user_qq: int):
query = cls.query.where(
(cls.user_qq == user_qq)
)
query = query.with_for_update()
if not await query.gino.first():
await cls.create(
user_qq=user_qq,
)
@classmethod
async def add_count(cls, user_qq: int, name: str, count: int = 1):
query = cls.query.where(
(cls.user_qq == user_qq)
)
query = query.with_for_update()
user = await query.gino.first()
if user:
if name == 'reimu':
await user.update(
reimu_count=cls.reimu_count + count
).apply()
if name == 'setu_r18':
await user.update(
setu_r18_count=cls.setu_r18_count + count
).apply()
else:
await cls.create(
user_qq=user_qq
)
@classmethod
async def check_count(cls, user_qq: int, name: str, max_count: int) -> bool:
query = cls.query.where(
(cls.user_qq == user_qq)
)
user = await query.gino.first()
if user:
if name == 'reimu':
if user.reimu_count == max_count:
return True
else:
return False
if name == 'setu_r18':
if user.setu_r18_count == max_count:
return True
else:
return False
else:
await cls.add_user(user_qq)
return False
@classmethod
async def reset_count(cls):
for user in await cls.query.gino.all():
await user.update(
reimu_count=0,
setu_r18_count=0
).apply()

87
models/friend_user.py Normal file
View File

@ -0,0 +1,87 @@
from services.db_context import db
class FriendUser(db.Model):
__tablename__ = 'friend_users'
id = db.Column(db.Integer(), primary_key=True)
user_id = db.Column(db.BigInteger(), nullable=False)
user_name = db.Column(db.Unicode(), nullable=False, default="")
nickname = db.Column(db.Unicode())
_idx1 = db.Index('friend_users_idx1', 'user_id', unique=True)
@classmethod
async def get_user_name(cls, user_id: int) -> str:
query = cls.query.where(
cls.user_id == user_id
)
user = await query.gino.first()
if user:
return user.user_name
else:
return ''
@classmethod
async def add_friend_info(cls, user_id: int, user_name: str) -> 'bool':
try:
query = cls.query.where(
cls.user_id == user_id
)
user = await query.with_for_update().gino.first()
if not user:
await cls.create(
user_id=user_id,
user_name=user_name,
)
else:
await user.update(
user_name=user_name,
).apply()
return True
except Exception:
return False
@classmethod
async def delete_friend_info(cls, user_id: int) -> 'bool':
try:
query = cls.query.where(
cls.user_id == user_id
)
user = await query.with_for_update().gino.first()
if user:
await user.delete()
return True
except Exception:
return False
@classmethod
async def get_friend_nickname(cls, user_id: int) -> 'str':
query = cls.query.where(
cls.user_id == user_id
)
user = await query.with_for_update().gino.first()
if user:
if user.nickname:
return user.nickname
return ''
@classmethod
async def set_friend_nickname(cls, user_id: int, nickname: str) -> 'bool':
try:
query = cls.query.where(
cls.user_id == user_id
)
user = await query.with_for_update().gino.first()
if not user:
await cls.create(
user_id=user_id,
nickname=nickname,
)
else:
await user.update(
nickname=nickname,
).apply()
return True
except Exception:
return False

View File

@ -0,0 +1,100 @@
from services.db_context import db
from datetime import datetime
class GoodMorningNightUser(db.Model):
__tablename__ = 'good_morning_night_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
belonging_group = db.Column(db.BigInteger(), nullable=False)
good_morning_time1 = db.Column(db.DateTime(timezone=True), nullable=True)
good_night_time1 = db.Column(db.DateTime(timezone=True), nullable=True)
good_morning_time2 = db.Column(db.DateTime(timezone=True), nullable=True)
good_night_time2 = db.Column(db.DateTime(timezone=True), nullable=True)
good_morning_count = db.Column(db.BigInteger(), nullable=True)
good_night_count = db.Column(db.BigInteger(), nullable=True)
sleep_time = db.Column(db.BigInteger(), nullable=True)
first_flag = db.Column(db.BigInteger(), nullable=True)
_idx1 = db.Index('good_group_users_idx1', 'user_qq', 'belonging_group', unique=True)
@classmethod
async def get_good_morning_user(cls, user_qq: int, belonging_group: int, for_update: bool = False)\
-> 'GoodMorningNightUser':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
return user or await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
good_morning_time1=datetime.now(),
good_night_time1=datetime.min,
good_morning_time2=datetime.min,
good_night_time2=datetime.min,
good_morning_count=1,
good_night_count=0,
sleep_time=0,
first_flag=0,
)
@classmethod
async def get_good_night_user(cls, user_qq: int, belonging_group: int, for_update: bool = False) \
-> 'GoodMorningNightUser':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
return user or await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
good_morning_time1=datetime.min,
good_night_time1=datetime.now(),
good_morning_time2=datetime.min,
good_night_time2=datetime.min,
good_morning_count=0,
good_night_count=1,
sleep_time=0,
first_flag=0,
)
@classmethod
async def delete_user(cls, user_qq: int, belonging_group: int, for_update: bool = False) \
-> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
if for_update:
query = await query.with_for_update()
if await query.gino.first() is None:
return False
else:
await cls.delete.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
).gino.status()
return True
@classmethod
async def get_user(cls, user_qq: int, belonging_group: int, for_update: bool = False) \
-> 'GoodMorningNightUser':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
if for_update:
query = await query.with_for_update()
return await query.gino.first()

56
models/group_info.py Normal file
View File

@ -0,0 +1,56 @@
from services.db_context import db
class GroupInfo(db.Model):
__tablename__ = 'group_info'
group_id = db.Column(db.BigInteger(), nullable=False, primary_key=True)
group_name = db.Column(db.Unicode(), nullable=False, default="")
max_member_count = db.Column(db.Integer(), nullable=False, default=0)
member_count = db.Column(db.Integer(), nullable=False, default=0)
_idx1 = db.Index('group_info_idx1', 'group_id', unique=True)
@classmethod
async def get_group_info(cls, group_id: int) -> 'GroupInfo':
query = cls.query.where(
cls.group_id == group_id
)
return await query.gino.first()
@classmethod
async def add_group_info(cls, group_id: int, group_name: str, max_member_count: int, member_count: int) -> bool:
try:
group = await cls.query.where(
cls.group_id == group_id
).with_for_update().gino.first()
if group:
await cls.update(
group_id=group_id,
group_name=group_name,
max_member_count=max_member_count,
member_count=member_count,
).apply()
else:
await cls.create(
group_id=group_id,
group_name=group_name,
max_member_count=max_member_count,
member_count=member_count,
)
return True
except Exception:
return False
@classmethod
async def delete_group_info(cls, group_id: int) -> bool:
try:
await cls.delete.where(
cls.group_id == group_id
).gino.status()
return True
except Exception:
return False

View File

@ -0,0 +1,99 @@
from datetime import datetime
from services.db_context import db
class GroupInfoUser(db.Model):
__tablename__ = 'group_info_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
user_name = db.Column(db.Unicode(), nullable=False)
belonging_group = db.Column(db.BigInteger(), nullable=False)
user_join_time = db.Column(db.DateTime(), nullable=False)
nickname = db.Column(db.Unicode())
_idx1 = db.Index('info_group_users_idx1', 'user_qq', 'belonging_group', unique=True)
@classmethod
async def insert(cls, user_qq: int, belonging_group: int, user_name: str, user_join_time: datetime) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
try:
if await query.gino.first() is None:
await cls.create(
user_qq=user_qq,
user_name=user_name,
belonging_group=belonging_group,
user_join_time=user_join_time,
)
return True
except:
return False
@classmethod
async def select_member_info(cls, user_qq: int, belonging_group: int) -> 'GroupInfoUser':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
return await query.gino.first()
@classmethod
async def delete_member_info(cls, user_qq: int, belonging_group: int) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
query = query.with_for_update()
user = await query.gino.first()
try:
if user is None:
return True
else:
await cls.delete.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
).gino.status()
return True
except:
return False
@classmethod
async def query_group_member_list(cls, belonging_group: int) -> 'list':
member_list = []
query = cls.query.where(
(cls.belonging_group == belonging_group)
)
for user in await query.gino.all():
member_list.append(user.user_qq)
return member_list
@classmethod
async def set_group_member_nickname(cls, user_qq: int, belonging_group: int, nickname: str) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if user:
await user.update(
nickname=nickname
).apply()
return True
return False
@classmethod
async def get_group_member_nickname(cls, user_qq: int, belonging_group: int) -> 'str':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
user = await query.gino.first()
if user:
if user.nickname:
return user.nickname
return ''

100
models/group_remind.py Normal file
View File

@ -0,0 +1,100 @@
from services.db_context import db
class GroupRemind(db.Model):
__tablename__ = 'group_reminds'
id = db.Column(db.Integer(), primary_key=True)
group_id = db.Column(db.BigInteger(), nullable=False)
hy = db.Column(db.Boolean(), default=True) # 进群欢迎
kxcz = db.Column(db.Boolean(), default=True) # 开箱重置
zwa = db.Column(db.Boolean(), default=True) # 早晚安
gb = db.Column(db.Boolean(), default=True) # 广播
blpar = db.Column(db.Boolean(), default=True) # bilibili转发解析
pa = db.Column(db.Boolean(), default=True) # 爬
epic = db.Column(db.Boolean(), default=False) # epic
almanac = db.Column(db.Boolean(), default=False) # 原神黄历
_idx1 = db.Index('info_group_reminds_idx1', 'group_id', unique=True)
@classmethod
async def get_status(cls, group_id: int, name: str) -> bool:
group = await cls.query.where(
(cls.group_id == group_id)
).gino.first()
if not group:
group = await cls.create(
group_id=group_id,
)
if name == 'hy':
return group.hy
if name == 'kxcz':
return group.kxcz
if name == 'zwa':
return group.zwa
if name == 'gb':
return group.gb
if name == 'blpar':
return group.blpar
if name == 'epic':
return group.epic
if name == 'pa':
return group.pa
if name == 'almanac':
return group.almanac
@classmethod
async def set_status(cls, group_id: int, name: str, status: bool) -> bool:
try:
group = await cls.query.where(
(cls.group_id == group_id)
).gino.first()
if not group:
group = await cls.create(
group_id=group_id,
)
if name == 'hy':
await group.update(
hy=status,
).apply()
if name == 'kxcz':
await group.update(
kxcz=status,
).apply()
if name == 'zwa':
await group.update(
zwa=status,
).apply()
if name == 'gb':
await group.update(
gb=status,
).apply()
if name == 'blpar':
await group.update(
blpar=status,
).apply()
if name == 'epic':
await group.update(
epic=status,
).apply()
if name == 'pa':
await group.update(
pa=status,
).apply()
if name == 'almanac':
await group.update(
almanac=status,
).apply()
return True
except Exception as e:
return False

94
models/level_user.py Normal file
View File

@ -0,0 +1,94 @@
from services.db_context import db
class LevelUser(db.Model):
__tablename__ = 'level_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
group_id = db.Column(db.BigInteger(), nullable=False)
user_level = db.Column(db.BigInteger(), nullable=False)
group_flag = db.Column(db.Integer(), nullable=False, default=0)
_idx1 = db.Index('level_group_users_idx1', 'user_qq', 'group_id', unique=True)
@classmethod
async def get_user_level(cls, user_qq: int, group_id: int) -> int:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
)
user = await query.gino.first()
if user:
return user.user_level
else:
return -1
@classmethod
async def set_level(cls, user_qq: int, group_id: int, level: int, group_flag: int = 0) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
)
query = query.with_for_update()
user = await query.gino.first()
if user is None:
await cls.create(
user_qq=user_qq,
group_id=group_id,
user_level=level,
group_flag=group_flag,
)
return True
else:
await user.update(user_level=level, group_flag=group_flag).apply()
return False
@classmethod
async def delete_level(cls, user_qq: int, group_id: int, for_update: bool = False) -> 'bool':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
if user is None:
return False
else:
await user.delete()
return True
@classmethod
async def check_level(cls, user_qq: int, group_id: int, level: int) -> 'bool':
if group_id != 0:
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
)
user = await query.gino.first()
if user is None:
return False
user_level = user.user_level
else:
query = cls.query.where(
cls.user_qq == user_qq
)
highest_level = 0
for user in await query.gino.all():
if user.user_level > highest_level:
highest_level = user.user_level
user_level = highest_level
if user_level >= level:
return True
else:
return False
@classmethod
async def is_group_flag(cls, user_qq: int, group_id: int) -> 'bool':
user = await cls.query.where(
(cls.user_qq == user_qq) & (cls.group_id == group_id)
).gino.first()
if not user:
return False
if user.group_flag == 1:
return True
else:
return False

59
models/open_cases_user.py Normal file
View File

@ -0,0 +1,59 @@
from datetime import datetime
from services.db_context import db
class OpenCasesUser(db.Model):
__tablename__ = 'open_cases_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
belonging_group = db.Column(db.BigInteger(), nullable=False)
total_count = db.Column(db.Integer(), nullable=False, default=0)
blue_count = db.Column(db.Integer(), nullable=False, default=0)
blue_st_count = db.Column(db.Integer(), nullable=False, default=0)
purple_count = db.Column(db.Integer(), nullable=False, default=0)
purple_st_count = db.Column(db.Integer(), nullable=False, default=0)
pink_count = db.Column(db.Integer(), nullable=False, default=0)
pink_st_count = db.Column(db.Integer(), nullable=False, default=0)
red_count = db.Column(db.Integer(), nullable=False, default=0)
red_st_count = db.Column(db.Integer(), nullable=False, default=0)
knife_count = db.Column(db.Integer(), nullable=False, default=0)
knife_st_count = db.Column(db.Integer(), nullable=False, default=0)
spend_money = db.Column(db.Integer(), nullable=False, default=0)
make_money = db.Column(db.Float(), nullable=False, default=0)
today_open_total = db.Column(db.Integer(), nullable=False, default=0)
open_cases_time_last = db.Column(db.DateTime(timezone=True), nullable=False, default=datetime.now())
knifes_name = db.Column(db.Unicode(), nullable=False, default="")
_idx1 = db.Index('open_cases_group_users_idx1', 'user_qq', 'belonging_group', unique=True)
@classmethod
async def ensure(cls, user_qq: int, belonging_group: int, for_update: bool = False) -> 'OpenCasesUser':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
return user or await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
)
@classmethod
async def get_user_all(cls, group_id: int = None) -> 'list':
user_list = []
if not group_id:
query = await cls.query.gino.all()
else:
query = await cls.query.where(
(cls.belonging_group == group_id)
).gino.all()
for user in query:
user_list.append(user)
return user_list

View File

@ -0,0 +1,59 @@
from datetime import datetime
from services.db_context import db
class SignGroupUser(db.Model):
__tablename__ = 'sign_group_users'
id = db.Column(db.Integer(), primary_key=True)
user_qq = db.Column(db.BigInteger(), nullable=False)
belonging_group = db.Column(db.BigInteger(), nullable=False)
checkin_count = db.Column(db.Integer(), nullable=False)
checkin_time_last = db.Column(db.DateTime(timezone=True), nullable=False)
impression = db.Column(db.Numeric(scale=3, asdecimal=False), nullable=False)
add_probability = db.Column(db.Numeric(scale=3, asdecimal=False), nullable=False, default=0)
specify_probability = db.Column(db.Numeric(scale=3, asdecimal=False), nullable=False, default=0)
_idx1 = db.Index('sign_group_users_idx1', 'user_qq', 'belonging_group', unique=True)
@classmethod
async def ensure(cls, user_qq: int, belonging_group: int, for_update: bool = False) -> 'SignGroupUser':
query = cls.query.where(
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
)
if for_update:
query = query.with_for_update()
user = await query.gino.first()
return user or await cls.create(
user_qq=user_qq,
belonging_group=belonging_group,
checkin_count=0,
checkin_time_last=datetime.min, # 从未签到过
impression=0,
)
@classmethod
async def query_impression_all(cls, belonging_group: int) -> 'list,list':
impression_list = []
user_qq_list = []
query = cls.query.where(
(cls.belonging_group == belonging_group)
)
for user in await query.gino.all():
impression_list.append(user.impression)
user_qq_list.append(user.user_qq)
return user_qq_list, impression_list
@classmethod
async def query_glod_all(cls, belonging_group: int) -> 'list,list':
glod_list = []
user_qq_list = []
query = cls.query.where(
(cls.belonging_group == belonging_group)
)
for user in await query.gino.all():
glod_list.append(user.glod)
user_qq_list.append(user.user_qq)
return user_qq_list, glod_list