user.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:dogetipbot 作者: dogetipbot 项目源码 文件源码
def total_received(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.coin_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.to_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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号