Commit 990b28b3 authored by xianyang's avatar xianyang

优化公会账户

parent c0482420
...@@ -456,9 +456,14 @@ class AccountStatistics(object): ...@@ -456,9 +456,14 @@ class AccountStatistics(object):
return res return res
def guild_calculation(self): def guild_calculation(self):
guild_cond_list = []
start_time = time_str_to_timestamp(self.start_time + ' 00:00:00') start_time = time_str_to_timestamp(self.start_time + ' 00:00:00')
end_time = time_str_to_timestamp(self.end_time + ' 23:59:59') end_time = time_str_to_timestamp(self.end_time + ' 23:59:59')
sql = f"select guild_id,initial_money,income,outcome,create_time from v3_guild_account_detail_copy where create_time>={start_time} and create_time<{end_time}" guild_cond_list.append(f" (income>0 or outcome>0 or initial_money>0) ")
guild_cond_list.append(f" create_time >={start_time} and create_time<= {end_time}")
if self.user_id:
guild_cond_list.append(f" guild_id={self.user_id}")
sql = f"select guild_id,initial_money,income,outcome,create_time from v3_guild_account_detail_copy where {' and '.join(guild_cond_list)} order by create_time DESC"
mysql_data = LinkMysql(env.DB_3YV2).query_mysql(sql) mysql_data = LinkMysql(env.DB_3YV2).query_mysql(sql)
return mysql_data[int(self.page - 1) * self.size: self.page * self.size], len(mysql_data) return mysql_data[int(self.page - 1) * self.size: self.page * self.size], len(mysql_data)
......
...@@ -54,6 +54,12 @@ class FixTable(BaseModel): ...@@ -54,6 +54,12 @@ class FixTable(BaseModel):
amount_type: Optional[str] = "consumable" amount_type: Optional[str] = "consumable"
remark: str remark: str
@validator('money')
def money_must_contain_space(cls, c):
if c:
c = round(float(c), 3)
return c
class AccountTypeUpdate(BaseModel): class AccountTypeUpdate(BaseModel):
id: int = None id: int = None
......
...@@ -91,6 +91,12 @@ class PaymentAdd(BaseModel): ...@@ -91,6 +91,12 @@ class PaymentAdd(BaseModel):
cont: str cont: str
url: str url: str
@validator('money')
def money_must_contain_space(cls, c):
if c:
c = round(float(c), 3)
return c
def __str__(self): def __str__(self):
return "uuid:%s, money:%s ,cont:%s ,url:%s" % (str(self.uuid), self.money, self.cont, self.url) return "uuid:%s, money:%s ,cont:%s ,url:%s" % (str(self.uuid), self.money, self.cont, self.url)
......
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