def update_user_current_score(userid, score):
    user = User.from_blockchain(userid)
    if user is None:
        abort(403, "提供的用户未在记录当中")
    user.CreditScore.CurrentCreditScore = score
    user.bc_update()
    user.UserInfo.CurrentCreditScore = score
    user.UserInfo.save()
    return user
示例#2
0
def userinfo(userindex):
    # data = get_data_from_ajax()
    # if data is None:
    #     return
    u = User.from_blockchain(userindex.UserID)
    if u is None:
        abort(403, u"用户不存在于区块链记录中或访问区块链失败")
    u.UserInfo.CurrentCreditScore = u.CreditScore.CurrentCreditScore
    u.UserInfo.TotalCreditScore = u.CreditScore.TotalCreditScore
    u.UserInfo.RateCount = u.CreditScore.Ratetimes
    u.UserInfo.save()
    d = UserController.wrapper_userinfo(u)

    # return return_data(None, data=u.dump_to_dict())
    return return_data(None, data=d)