Commit 0aec42a8 authored by xupeng's avatar xupeng

Merge remote-tracking branch 'origin/development' into development

parents 843e2b79 33108689
...@@ -268,13 +268,16 @@ def get_account_type(**data): ...@@ -268,13 +268,16 @@ def get_account_type(**data):
condition.append(f" type={data.get('type')}") condition.append(f" type={data.get('type')}")
if condition: if condition:
total_sql = f"select count(id) as num from fi_account_type where {' and '.join(condition)}" total_sql = f"select count(id) as num from fi_account_type where {' and '.join(condition)}"
gift_sql = f"select id,keyName,keyValue,type from fi_account_type where {' and '.join(condition)} limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}" gift_sql = f"select id,keyName,keyValue,type,createTime as create_time from fi_account_type where {' and '.join(condition)} limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}"
else: else:
total_sql = f"select count(id) as num from fi_account_type" total_sql = f"select count(id) as num from fi_account_type"
gift_sql = f"select id,keyName,keyValue,type from fi_account_type limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}" gift_sql = f"select id,keyName,keyValue,type,createTime as create_time from fi_account_type limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}"
total = LinkMysql(env.DB_3YV2).query_mysql(total_sql) total = LinkMysql(env.DB_3YV2).query_mysql(total_sql)
output = LinkMysql(env.DB_3YV2).query_mysql(gift_sql) output = LinkMysql(env.DB_3YV2).query_mysql(gift_sql)
if output: if output:
for i in output:
time_array = time.localtime(i['create_time'])
i['create_time'] = time.strftime("%Y-%m-%d %H:%M:%S", time_array)
return output, total[0]['num'] return output, total[0]['num']
return [], 0 return [], 0
......
...@@ -8,6 +8,7 @@ from libs.functions import get_now_datetime ...@@ -8,6 +8,7 @@ from libs.functions import get_now_datetime
from libs.orm import QueryAllData from libs.orm import QueryAllData
from models.export import ExportFile from models.export import ExportFile
import pandas as pd import pandas as pd
from xpinyin import Pinyin
from starlette.responses import StreamingResponse from starlette.responses import StreamingResponse
...@@ -85,6 +86,9 @@ class CalculationMonthlyBill(object): ...@@ -85,6 +86,9 @@ class CalculationMonthlyBill(object):
assert_list.append(f" reference_type in{tuple(k_list)}") assert_list.append(f" reference_type in{tuple(k_list)}")
if len(k_list) == 1: if len(k_list) == 1:
assert_list.append(f" reference_type='{k_list[0]}'") assert_list.append(f" reference_type='{k_list[0]}'")
if not k_list:
py = Pinyin().get_pinyin(name)
assert_list.append(f" reference_type='{py.replace('-', '')}'")
if key_type: if key_type:
assert_list.append(f" reference_type like '%{key_type}%'") assert_list.append(f" reference_type like '%{key_type}%'")
if assert_list: if assert_list:
...@@ -231,7 +235,7 @@ class ReferenceTypeClassification(): ...@@ -231,7 +235,7 @@ class ReferenceTypeClassification():
def classification_summary(self): def classification_summary(self):
data_sql = f"select uuid,type,amount/1000 as amount,create_time from {self.date} where reference_type='{self.reference_type}' GROUP BY uuid,type" data_sql = f"select uuid,type,sum(amount)/1000 as amount,create_time from {self.date} where reference_type='{self.reference_type}' GROUP BY uuid,type"
guild_sql = f"select uuid from guild" guild_sql = f"select uuid from guild"
account_sql = f"select uuid,name from fi_account" account_sql = f"select uuid,name from fi_account"
anchor_sql = f"select uuid from v2_user where is_achor in(1,2)" anchor_sql = f"select uuid from v2_user where is_achor in(1,2)"
...@@ -257,9 +261,9 @@ class ReferenceTypeClassification(): ...@@ -257,9 +261,9 @@ class ReferenceTypeClassification():
op['money'] = round(float(op['amount']), 2) op['money'] = round(float(op['amount']), 2)
if op.get('uuid') in guild_data: if op.get('uuid') in guild_data:
op['nickname'] = '公会' op['nickname'] = '公会'
if op.get('uuid') in anchor_data: elif op.get('uuid') in anchor_data:
op['nickname'] = '主播' op['nickname'] = '主播'
if account_dict.get(op['uuid']): elif account_dict.get(op['uuid']):
op['nickname'] = account_dict.get(op['uuid']) op['nickname'] = account_dict.get(op['uuid'])
else: else:
op['nickname'] = '用户' op['nickname'] = '用户'
...@@ -277,6 +281,6 @@ class ReferenceTypeClassification(): ...@@ -277,6 +281,6 @@ class ReferenceTypeClassification():
if self.income: if self.income:
income = pd.DataFrame(self.income) income = pd.DataFrame(self.income)
igs = income.groupby("nickname").sum() igs = income.groupby("nickname").sum()
for k,v in igs.to_dict().get('money').items(): for k, v in igs.to_dict().get('money').items():
res_list.append({"type": "入账", "name": k, "money": v}) res_list.append({"type": "入账", "name": k, "money": v})
return res_list return res_list
...@@ -150,6 +150,8 @@ def account_thead_task(data): ...@@ -150,6 +150,8 @@ def account_thead_task(data):
account = LinkMysql(env.DB_3YV2).query_mysql(account_sql) account = LinkMysql(env.DB_3YV2).query_mysql(account_sql)
if account: if account:
data['transfer_name'] = account[0]['name'] data['transfer_name'] = account[0]['name']
else:
data['transfer_name'] = data.get('transfer_uuid')
def accout_list_data(**params): def accout_list_data(**params):
......
from core.config.env import env from core.config.env import env
from libs.db_link import LinkMysql
TYPE_NAME = { sql = f"SELECT keyName,keyValue,type FROM fi_account_type"
"updateUserNameFee": "用户昵称修改", res_data = LinkMysql(env.DB_3YV2).query_mysql(sql)
"updateFamilyNameFee": "家族改名",
"userExchange": "珍珠兑换钻石", TYPE_NAME = {}
"userRecharge": "充值", for i in res_data:
"pay_discount": "充值折扣", if not TYPE_NAME.get(i['keyValue']):
"studioGift": "直播间送礼", TYPE_NAME[i['keyValue']] = i['keyName']
"turntableIncome": "转盘",
"turntableExpend": "转盘中奖", # TYPE_NAME_T = {
"recyclingGifts": "回收礼物", # "updateUserNameFee": "用户昵称修改",
"buyIdentity": "开贵族", # "updateFamilyNameFee": "家族改名",
"buyGuard": "开守护", # "userExchange": "珍珠兑换钻石",
"studioBarrage": "弹幕消费", # "userRecharge": "充值",
"buyProp": "购买道具", # "pay_discount": "充值折扣",
"bei_to_change_account": "购买bei+", # "studioGift": "直播间送礼",
"bei_to_cancel_account": "bei+订单退款", # "turntableIncome": "转盘",
"signInDeductMoney": "用户补签", # "turntableExpend": "转盘中奖",
"signInReward": "签到奖励", # "recyclingGifts": "回收礼物",
"sign_in_backpack_account": "背包礼物奖励", # "buyIdentity": "开贵族",
"live_support": "主播扶持分配", # "buyGuard": "开守护",
"room_support": "直播间扶持 - 领取钻石奖励", # "studioBarrage": "弹幕消费",
"lucky_gift_jackpot": "赠送幸运礼物", # "buyProp": "购买道具",
"gameReward": "游戏奖励", # "bei_to_change_account": "购买bei+",
"userWithdrawal": "用户提现", # "bei_to_cancel_account": "bei+订单退款",
"sendRedBox": "发送红包", # "signInDeductMoney": "用户补签",
"userRedBox": "红包领取", # "signInReward": "签到奖励",
"returnRedBox": "红包退还", # "sign_in_backpack_account": "背包礼物奖励",
"send_diamond_red_packet": "钻石红包发送", # "live_support": "主播扶持分配",
"get_red_packet": "钻石红包领取", # "room_support": "直播间扶持 - 领取钻石奖励",
"send_diamond_red_packet_back": "钻石红包退还", # "lucky_gift_jackpot": "赠送幸运礼物",
"send_gift_red_packet": "礼物红包发送", # "gameReward": "游戏奖励",
"get_gift_red_packet": "礼物红包领取", # "userWithdrawal": "用户提现",
"send_gift_red_packet_back": "礼物红包退还", # "sendRedBox": "发送红包",
"first_recharge_gift": "首充礼包", # "userRedBox": "红包领取",
"user_clean_up": "余额清算(线上,线下)", # "returnRedBox": "红包退还",
"cleargiftstore": "背包礼物过期", # "send_diamond_red_packet": "钻石红包发送",
"daily_task": "任务奖励发放钻石", # "get_red_packet": "钻石红包领取",
"voiceChatFee": "语聊消费", # "send_diamond_red_packet_back": "钻石红包退还",
"helpExchange": "用户打榜兑换投票次数", # "send_gift_red_packet": "礼物红包发送",
"vip_recharge": "vip购买", # "get_gift_red_packet": "礼物红包领取",
"PlatformLeakRepair": "平台补漏", # "send_gift_red_packet_back": "礼物红包退还",
"voice": "用户上麦", # "first_recharge_gift": "首充礼包",
"MagicHegemony": "魔法争霸赛活动", # "user_clean_up": "余额清算(线上,线下)",
"Points_mall_exchange": "积分商城兑换", # "cleargiftstore": "背包礼物过期",
"privateMessageCharge": "私信收费", # "daily_task": "任务奖励发放钻石",
"personalMessageGift": "私信礼物", # "voiceChatFee": "语聊消费",
"level_gift": "升级礼包", # "helpExchange": "用户打榜兑换投票次数",
"zhou_xing_backpack_account": "周星奖励发放", # "vip_recharge": "vip购买",
"zhou_xing_consumable_account": "周星奖励发放", # "PlatformLeakRepair": "平台补漏",
"NamedGift": "冠名礼物", # "voice": "用户上麦",
"whoIsUndercoverJoin": "谁是卧底游戏", # "MagicHegemony": "魔法争霸赛活动",
"game:NDJ": "扭蛋机消费", # "Points_mall_exchange": "积分商城兑换",
"gama:KMH": "参与游戏-开盲盒", # "privateMessageCharge": "私信收费",
"game_transfer": "商城礼物盲盒-许愿池,八卦象", # "personalMessageGift": "私信礼物",
"gama:ZJD": "参与游戏-砸金蛋", # "level_gift": "升级礼包",
"guildExchange": "公会结算", # "zhou_xing_backpack_account": "周星奖励发放",
"marginRecharge": "保证金缴纳", # "zhou_xing_consumable_account": "周星奖励发放",
"pledgeDeduction": "保证金扣减", # "NamedGift": "冠名礼物",
"guildExchangeDraw": "公会钻石结算", # "whoIsUndercoverJoin": "谁是卧底游戏",
"fanExpansion": "公会家族扩充", # "game:NDJ": "扭蛋机消费",
"guildTrafficPromotion": "流量推广", # "gama:KMH": "参与游戏-开盲盒",
"trafficPromotion": "流量购买", # "game_transfer": "商城礼物盲盒-许愿池,八卦象",
"guildWithdrawal": "公会提现", # "gama:ZJD": "参与游戏-砸金蛋",
"guildWithdrawal_ServiceFee": "提现服务费", # "guildExchange": "公会结算",
"free_guild_profit_Exchange": "自由公会收益", # "marginRecharge": "保证金缴纳",
"subordinate_guild_ti_xian": "下级公会提现", # "pledgeDeduction": "保证金扣减",
"investmentIncome": "招商收益", # "guildExchangeDraw": "公会钻石结算",
"platformRecharge": "转账", # "fanExpansion": "公会家族扩充",
"platformSubsidies": "平台补贴", # "guildTrafficPromotion": "流量推广",
"currencyUpgrade": "旧币兑换(钻石)", # "trafficPromotion": "流量购买",
"PlatformDeduction": "平台扣除", # "guildWithdrawal": "公会提现",
"thrid_game_transfer_user": "引流转盘奖励", # "guildWithdrawal_ServiceFee": "提现服务费",
"blind_box_mall_account_recharge": "盲盒商城账户充值(人民币)", # "free_guild_profit_Exchange": "自由公会收益",
"pk_season": "PK赛季奖励", # "subordinate_guild_ti_xian": "下级公会提现",
"finance_admin_fix": "财务系统修复", # "investmentIncome": "招商收益",
"pk_shout_anonymity": "pk喊话", # "platformRecharge": "转账",
"pk_shout": "pk喊话", # "platformSubsidies": "平台补贴",
"GameConsumption": "五子棋游戏", # "currencyUpgrade": "旧币兑换(钻石)",
"fj_shop_withdraw": "商城提现", # "PlatformDeduction": "平台扣除",
"fj_shop_recharge": "商城订单结算", # "thrid_game_transfer_user": "引流转盘奖励",
"physical_blind_box_recharge": "实物盲盒 - 使用抽奖券并中奖", # "blind_box_mall_account_recharge": "盲盒商城账户充值(人民币)",
"blind_box_redeem_points": "实物盲盒 - 兑换积分", # "pk_season": "PK赛季奖励",
"blind_box_delivery": "实物盲盒 - 提货", # "finance_admin_fix": "财务系统修复",
"physical_blind_box_refund": "实物盲盒-回收", # "pk_shout_anonymity": "pk喊话-匿名喊话",
"zhou_xing_consume": "周星活动购买道具(创造营)", # "pk_shout": "pk喊话-普通、炸弹喊话",
"zhou_xing_award": "周星活动领奖", # "GameConsumption": "五子棋游戏",
"talentCertification": "达人认证缴费", # "fj_shop_withdraw": "商城提现",
"Payment": "公会解约结算平台打款", # "fj_shop_recharge": "商城订单结算",
"guild_clear": "公会结算", # "physical_blind_box_recharge": "实物盲盒 - 使用抽奖券并中奖",
"shop_complete_payment": "积分商城改版 - 支付", # "blind_box_redeem_points": "实物盲盒 - 兑换积分",
"points_mall_points_return": "积分商城改版 - 退款", # "blind_box_delivery": "实物盲盒 - 提货",
"cash_payment_money_return": "积分商城改版 - 退款", # "physical_blind_box_refund": "实物盲盒-回收",
"ConsignmentPaymentConfirmation_release": "用户发布转售动态", # "zhou_xing_consume": "周星活动购买道具(创造营)",
"ConsignmentPaymentConfirmation_callback": "用户撤销转售", # "zhou_xing_award": "周星活动领奖",
"ConsignmentPaymentConfirmation": "【礼物】购买成功", # "talentCertification": "达人认证缴费",
"ConsignmentPaymentConfirmation_withdraw": "【实物】确认收货", # "Payment": "公会解约结算平台打款",
"ConsignmentPaymentConfirmation_dress": "【转售装扮】购买成功", # "guild_clear": "公会结算",
"week_star_buy_dress": "购买限定装扮装扮", # "shop_complete_payment": "积分商城改版 - 支付",
"week_star_award_diamond": "榜单奖励领取", # "points_mall_points_return": "积分商城改版 - 退款",
"game_transfer_to_platform": "游戏账户向平台账户转账", # "cash_payment_money_return": "积分商城改版 - 退款",
"recharge_bag_award": "超值礼包", # "ConsignmentPaymentConfirmation_release": "用户发布转售动态",
"HairSpotSong": "点歌功能付费", # "ConsignmentPaymentConfirmation_callback": "用户撤销转售",
"RetreatSpotSong": "点歌退款(主播拒绝、用户撤销)", # "ConsignmentPaymentConfirmation": "【礼物】购买成功",
"BranchSpotSong": "点歌收益分配", # "ConsignmentPaymentConfirmation_withdraw": "【实物】确认收货",
"guild_transfer_to_anchor": "公会转账", # "ConsignmentPaymentConfirmation_dress": "【转售装扮】购买成功",
"guild_transfer_to_anchor_trans_fee": "公会转账手续费", # "week_star_buy_dress": "购买限定装扮装扮",
"SmashGoldenEggs": "参与游戏-钻石", # "week_star_award_diamond": "榜单奖励领取",
"game_backpack_account": "游戏中奖", # "game_transfer_to_platform": "游戏账户向平台账户转账",
"turntable_game_balance_add": "用户中奖", # "recharge_bag_award": "超值礼包",
"collection": "天外物舱-购买礼物使用权", # "HairSpotSong": "点歌功能付费",
"fairy_star_consume": "①、3月仙女活动②、2022【贝洛的愿望】-道具购买", # "RetreatSpotSong": "点歌退款(主播拒绝、用户撤销)",
"relic_buy_prop": "2022-11_遗迹修复活动-购买道具", # "BranchSpotSong": "点歌收益分配",
"relic_recharge": "2022-11_遗迹修复活动-活动充值", # "guild_transfer_to_anchor": "公会转账",
"seven_country_award": "2022_七国游记活动-榜单奖励领取", # "guild_transfer_to_anchor_trans_fee": "公会转账手续费",
"time_detective_award": "时空侦探活动-榜单领奖", # "SmashGoldenEggs": "参与游戏-钻石",
"translate": "翻译付费", # "game_backpack_account": "游戏中奖",
"userWithdrawal_dec": "用户提现扣除项", # "turntable_game_balance_add": "用户中奖",
"heart_season_award": "怦然心动活动榜单奖励", # "collection": "天外物舱-购买礼物使用权",
"OnePieceActivityBuyItem": "航海活动购买道具", # "fairy_star_consume": "①、3月仙女活动②、2022【贝洛的愿望】-道具购买",
"challenge": "用户发起挑战功能", # "relic_buy_prop": "2022-11_遗迹修复活动-购买道具",
"AnnualCelebration": "年度活动", # "relic_recharge": "2022-11_遗迹修复活动-活动充值",
"LaborDayActivityBuyProp": "四季仙踪活动道具购买", # "seven_country_award": "2022_七国游记活动-榜单奖励领取",
"april_fools_2022": "4月活动奖励", # "time_detective_award": "时空侦探活动-榜单领奖",
"wzzyn_2022_consume": "端午活动用户购买道具", # "translate": "翻译付费",
"wzzyn_2022": "端午活动奖励", # "userWithdrawal_dec": "用户提现扣除项",
"april_fools_2022_consume": "4月活动购买道具", # "heart_season_award": "怦然心动活动榜单奖励",
"LaborDayActivity": "四季仙踪活动奖励", # "OnePieceActivityBuyItem": "航海活动购买道具",
"NewYearActivity": "春节活动", # "challenge": "用户发起挑战功能",
"OnePieceActivity": "航海活动奖励", # "AnnualCelebration": "年度活动",
"heart_season_buy_prop": "怦然心动道具购买", # "LaborDayActivityBuyProp": "四季仙踪活动道具购买",
"baseSalaryExpend": "底薪", # "april_fools_2022": "4月活动奖励",
"guildRecharge": "公会充值", # "wzzyn_2022_consume": "端午活动用户购买道具",
"blind_box_transfer_to_backpack": "商城礼物盲盒预支", # "wzzyn_2022": "端午活动奖励",
"activity_fairy_star": "三月活动奖励", # "april_fools_2022_consume": "4月活动购买道具",
"inviteGift": "邀请礼包", # "LaborDayActivity": "四季仙踪活动奖励",
"activityReward": "活动奖励", # "NewYearActivity": "春节活动",
"taskReward": "任务奖励", # "OnePieceActivity": "航海活动奖励",
"luckyGiftReward": "幸运大暴击", # "heart_season_buy_prop": "怦然心动道具购买",
"parentAdd": "上级补差", # "baseSalaryExpend": "底薪",
"januaryWishDrawal": "新语新愿", # "guildRecharge": "公会充值",
"AprilPearlRecord": "四月镖客行活奖励", # "blind_box_transfer_to_backpack": "商城礼物盲盒预支",
"bei_out_of_account": "bei+订单收入", # "activity_fairy_star": "三月活动奖励",
"dynamicGift": "动态礼物", # "inviteGift": "邀请礼包",
"whoIsUndercoverWin": "谁是卧底竞技奖励", # "activityReward": "活动奖励",
"NationalDayActivity": "国庆奖励", # "taskReward": "任务奖励",
"user_atransfer_guild": "用户转账给公会", # "luckyGiftReward": "幸运大暴击",
"guildWithdrawalPledge": "公会提现审核", # "parentAdd": "上级补差",
"voiceGift": "上麦送礼", # "januaryWishDrawal": "新语新愿",
"radioStationFee": "电台收费", # "AprilPearlRecord": "四月镖客行活奖励",
"fansCharge": "粉丝收费", # "bei_out_of_account": "bei+订单收入",
} # "dynamicGift": "动态礼物",
# "whoIsUndercoverWin": "谁是卧底竞技奖励",
# "NationalDayActivity": "国庆奖励",
# "user_atransfer_guild": "用户转账给公会",
# "guildWithdrawalPledge": "公会提现审核",
# "voiceGift": "上麦送礼",
# "radioStationFee": "电台收费",
# "fansCharge": "粉丝收费",
# }
...@@ -44,3 +44,4 @@ uvicorn==0.20.0 ...@@ -44,3 +44,4 @@ uvicorn==0.20.0
xmltodict==0.13.0 xmltodict==0.13.0
openpyxl==3.1.2 openpyxl==3.1.2
redis==4.3.4 redis==4.3.4
xpinyin==0.7.6
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment