def total_fiat_sent(self):
# Check that a user_id is set
if not bool(self.user_id):
raise Exception("HkUser::add_coin(%s): user_id must be set first" % self.username)
# Get balance and add
sqlcmd = "SELECT SUM(action.fiat_val) AS `total` FROM `username` JOIN action ON action.service_id = username.service_id WHERE username.user_id = " + str(int(self.user_id)) + " AND action.from_user= username.username AND action.service_id = username.service_id AND action.state = 'completed' AND action.type='givetip' "
# Get balance
total = self.haikuberu.get_field(sqlcmd)
if total:
total = Decimal(total)
else:
total = 0
return Decimal(Decimal(trunc(total * 100000000)) / 100000000)
# Total sent
评论列表
文章目录