history.py 文件源码

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

项目:sodogetip 作者: just-an-dev 项目源码 文件源码
def add_to_history(user_history, sender, receiver, amount, action, finish=False, tx_id="", tip_id=""):
        # convert object to string of name if necessary
        if type(user_history) is models.User:
            user_history = user_history.username

        if tip_id == "":
            tip_id = random.randint(0, 99999999)

        bot_logger.logger.info("Save for history user=%s, sender=%s, receiver=%s, amount=%s, action=%s, finish=%s" % (
            user_history, sender, receiver, amount, action, finish))

        db = TinyDB(config.history_path + user_history + '.json')
        db.insert({
            "id": tip_id,
            "user": user_history,
            "sender": sender,
            "receiver": receiver,
            "amount": amount,
            "action": action,
            "finish": finish,
            "status": "",
            "tx_id": tx_id,
            'time': datetime.datetime.now().isoformat(),
        })
        db.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号