This commit is contained in:
yumoqing 2025-12-14 13:15:45 +08:00
parent 920d4eec06
commit cadaa59936
5 changed files with 28 additions and 3 deletions

14
json/payfee.json Normal file
View File

@ -0,0 +1,14 @@
{
"tblname": "payfee",
"title": "充值费率",
"params": {
"sortby": "id",
"browserfields": {
"exclouded": [],
"alters": {
}
},
"editexclouded": [
]
}
}

Binary file not shown.

View File

@ -47,15 +47,16 @@ async def create_payment(request, params_kw=None):
exception(f'{e}') exception(f'{e}')
raise e raise e
pl = PaymentLog(request._run_ns) pl = PaymentLog(request._run_ns)
fee = await get_pay_fee(provider, amount)
channel = get_provider_channel(provider) channel = get_provider_channel(provider)
userid = await get_suer() userid = await get_user()
orgid = await get_userorgid() orgid = await get_userorgid()
client_ip = request['client_ip'] client_ip = request['client_ip']
# userid, customerid, channel, payment_name, amount, client_ip, currency='CNY' # userid, customerid, channel, payment_name, amount, client_ip, currency='CNY'
payment_name = data.payment_name or "充值", payment_name = data.payment_name or "充值",
amount = data.amount amount = data.amount
currency = data.currency currency = data.currency
id = await pl.new_log(userid, orgid, payment_name, amount, client_ip, currency=currency) id = await pl.new_log(userid, orgid, payment_name, amount, fee, client_ip, currency=currency)
if id: if id:
data.out_trade_no = id data.out_trade_no = id
res = await PROVIDERS[provider].create_payment(data) res = await PROVIDERS[provider].create_payment(data)

View File

@ -5,7 +5,10 @@ class PaymentLog:
self.db = DBPools() self.db = DBPools()
self.env = env self.env = env
async def new_log(self, userid, customerid, channel, payment_name, amount, client_ip, currency='CNY'): async def new_log(self,
userid, customerid, channel,
payment_name, amount, fee,
client_ip, currency='CNY'):
dbname = await self.env.get_module_dbname('unipay') dbname = await self.env.get_module_dbname('unipay')
async with self.db.sqlorContext(dbname) as sor: async with self.db.sqlorContext(dbname) as sor:
ns = { ns = {
@ -14,6 +17,8 @@ class PaymentLog:
"payment_channel": channel, "payment_channel": channel,
"payment_name": payment_name, "payment_name": payment_name,
"payer_client_ip": client_ip, "payer_client_ip": client_ip,
"amount_total": amount,
"pay_fee": fee,
"currency": currency, "currency": currency,
"payment_status": '0', "payment_status": '0',
"init_timestamp": timestampstr(), "init_timestamp": timestampstr(),

View File

@ -4,6 +4,11 @@
"target": "page_center", "target": "page_center",
"cwidth": 10, "cwidth": 10,
"items":[ "items":[
{
"name":"payfee",
"label":"充值费率",
"url":"{{entire_url('payfee')}}"
},
{ {
"name":"recharge", "name":"recharge",
"label":"充值", "label":"充值",