def amt_prepay(mch_prepay, mch_accnt, amount, Type): """准备金计算""" amt = SqlSave.select_remain_amt(mch_prepay) # 根据商户号查询余额 set = SqlSave.select_settled_amt(mch_accnt) # 查询结算余额 set_amt = ((0, ), ) if int(set[0][0]) <= 0 else set fix_amount = SqlSave.select_fix_poundage() # 查询手续费 if Type: result_amt = int(amt[0][0]) - (int(amount) - int(set_amt[0][0]) - int(fix_amount)) return result_amt return amt[0][0]
def amt_depository_and_prepay(mch, amount, Type, fix=False): """存管户计算""" amt = SqlSave.select_remain_amt(mch) # 根据商户号查询余额 fix_amount = SqlSave.select_fix_poundage() # 查询手续费 if Type: if fix: result_amt = int(amt[0][0]) - int(amount) + int(fix_amount) else: result_amt = int(amt[0][0]) - int(amount) return result_amt return amt[0][0]
def amt_mch_profit(mch, amount, Type): """分润商户增加手续费计算""" amt = SqlSave.select_remain_amt(mch) set_amt = SqlSave.select_settled_amt(mch) fix_amount = SqlSave.select_fix_poundage() # 查询手续费 if Type: result_amt = int(amt[0][0]) + int(fix_amount) result_set_amt = int(set_amt[0][0]) + int(fix_amount) print('查询出来的amt::%s' % amt) print('查询出来的可结算余额::%s' % set_amt) print('传入的提现金额::%s' % amount) print('子商户或分润计算 amt+amount%s' % result_amt) return result_amt, result_set_amt return amt[0][0], set_amt[0][0]