diff --git a/json/payfee.json b/json/payfee.json new file mode 100644 index 0000000..9a6d6f8 --- /dev/null +++ b/json/payfee.json @@ -0,0 +1,14 @@ +{ + "tblname": "payfee", + "title": "充值费率", + "params": { + "sortby": "id", + "browserfields": { + "exclouded": [], + "alters": { + } + }, + "editexclouded": [ + ] + } +} diff --git a/models/payment_log.xlsx b/models/payment_log.xlsx index eb41678..e4bc646 100644 Binary files a/models/payment_log.xlsx and b/models/payment_log.xlsx differ diff --git a/unipay/init.py b/unipay/init.py index 7f75124..c3eb726 100644 --- a/unipay/init.py +++ b/unipay/init.py @@ -47,15 +47,16 @@ async def create_payment(request, params_kw=None): exception(f'{e}') raise e pl = PaymentLog(request._run_ns) + fee = await get_pay_fee(provider, amount) channel = get_provider_channel(provider) - userid = await get_suer() + userid = await get_user() orgid = await get_userorgid() client_ip = request['client_ip'] # userid, customerid, channel, payment_name, amount, client_ip, currency='CNY' payment_name = data.payment_name or "充值", amount = data.amount 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: data.out_trade_no = id res = await PROVIDERS[provider].create_payment(data) diff --git a/unipay/paylog.py b/unipay/paylog.py index 848cb31..0cc5567 100644 --- a/unipay/paylog.py +++ b/unipay/paylog.py @@ -5,7 +5,10 @@ class PaymentLog: self.db = DBPools() 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') async with self.db.sqlorContext(dbname) as sor: ns = { @@ -14,6 +17,8 @@ class PaymentLog: "payment_channel": channel, "payment_name": payment_name, "payer_client_ip": client_ip, + "amount_total": amount, + "pay_fee": fee, "currency": currency, "payment_status": '0', "init_timestamp": timestampstr(), diff --git a/wwwroot/menu.ui b/wwwroot/menu.ui index e3d28ed..bceebb4 100644 --- a/wwwroot/menu.ui +++ b/wwwroot/menu.ui @@ -4,6 +4,11 @@ "target": "page_center", "cwidth": 10, "items":[ + { + "name":"payfee", + "label":"充值费率", + "url":"{{entire_url('payfee')}}" + }, { "name":"recharge", "label":"充值",