Compare commits
2 Commits
40595979c6
...
b91ff0e1ef
Author | SHA1 | Date | |
---|---|---|---|
|
b91ff0e1ef | ||
|
fe7dd68d7f |
@ -2,7 +2,7 @@ from sqlor.dbpools import DBPools
|
|||||||
from .const import *
|
from .const import *
|
||||||
from accounting.accountingnode import get_parent_orgid
|
from accounting.accountingnode import get_parent_orgid
|
||||||
|
|
||||||
async def getAccountByName(sor, accounting_orgid, orgid, name):
|
async def getAccountByName(sor, accounting_orgid, orgid, name, org1id):
|
||||||
sql = """select a.* from account a, subject b
|
sql = """select a.* from account a, subject b
|
||||||
where a.subjectid = b.id and
|
where a.subjectid = b.id and
|
||||||
a.accounting_orgid = ${accounting_orgid}$ and
|
a.accounting_orgid = ${accounting_orgid}$ and
|
||||||
@ -15,7 +15,10 @@ where a.subjectid = b.id and
|
|||||||
});
|
});
|
||||||
if len(recs) == 0:
|
if len(recs) == 0:
|
||||||
return None
|
return None
|
||||||
return recs[0]['id']
|
for rec in recs:
|
||||||
|
if a.org1id == org1id:
|
||||||
|
return rec['id']
|
||||||
|
return None
|
||||||
|
|
||||||
async def getTransPayMode():
|
async def getTransPayMode():
|
||||||
pass
|
pass
|
||||||
@ -43,10 +46,10 @@ async def getCustomerBalance(sor, customerid):
|
|||||||
return None
|
return None
|
||||||
return balance
|
return balance
|
||||||
|
|
||||||
async def getAccountBalance(sor, accounting_orgid, orgid, subjectname):
|
async def getAccountBalance(sor, accounting_orgid, orgid, subjectname, org1id):
|
||||||
accid = await getAccountByName(sor, accounting_orgid,
|
accid = await getAccountByName(sor, accounting_orgid,
|
||||||
orgid,
|
orgid,
|
||||||
subjectname)
|
subjectname,org1id)
|
||||||
if accid is None:
|
if accid is None:
|
||||||
print(f'accid is None, {accounting_orgid=}, {orgid=}, {subjectname=}')
|
print(f'accid is None, {accounting_orgid=}, {orgid=}, {subjectname=}')
|
||||||
return None
|
return None
|
||||||
|
17
accounting/init.py
Normal file
17
accounting/init.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from ahserver.serverenv import ServerEnv
|
||||||
|
from accounting.openaccount import openAllResellerAccounts
|
||||||
|
from accounting.openaccount import openAllCustomerAccounts
|
||||||
|
from accounting.openaccount import openAllProviderAccounts
|
||||||
|
from accounting.openaccount import openRetailRelationshipAccounts
|
||||||
|
from accounting.openaccount import openOwnerAccounts
|
||||||
|
from accounting.recharge import recharge_accounting
|
||||||
|
from accounting.getaccount import getAccountBalance, getCustomerBalance
|
||||||
|
|
||||||
|
def load_accounting():
|
||||||
|
g = ServerEnv()
|
||||||
|
g.openAllResellerAccounts = openAllResellerAccounts
|
||||||
|
g.openAllCustomerAccounts = openAllCustomerAccounts
|
||||||
|
g.openAllProviderAccounts = openAllProviderAccounts
|
||||||
|
g.openRetailRelationshipAccounts = openRetailRelationshipAccounts
|
||||||
|
g.openOwnerAccounts = openOwnerAccounts
|
||||||
|
g.recharge_accounting = recharge_accounting
|
@ -16,6 +16,7 @@ class RechargeAccounting:
|
|||||||
self.db = DBPools()
|
self.db = DBPools()
|
||||||
self.recharge_log = recharge_log
|
self.recharge_log = recharge_log
|
||||||
self.customerid = recharge_log['customerid']
|
self.customerid = recharge_log['customerid']
|
||||||
|
self.summary = recharge_log['summary']
|
||||||
self.orderid = None
|
self.orderid = None
|
||||||
self.curdate = recharge_log['recharge_date']
|
self.curdate = recharge_log['recharge_date']
|
||||||
self.transamount = recharge_log['recharge_amt']
|
self.transamount = recharge_log['recharge_amt']
|
||||||
@ -62,3 +63,25 @@ class RechargeAccounting:
|
|||||||
await sor.C('bill', self.bill.copy())
|
await sor.C('bill', self.bill.copy())
|
||||||
# await sor.C('recharge_log', self.recharge_log.copy())
|
# await sor.C('recharge_log', self.recharge_log.copy())
|
||||||
|
|
||||||
|
async def recharge_accounting(sor, customerid, action, logid, trnasdate, recharge_amt):
|
||||||
|
"""
|
||||||
|
summary:recharge channe(handly, wechat, alipay)
|
||||||
|
"""
|
||||||
|
recharge_log = {
|
||||||
|
"customerid":customerid,
|
||||||
|
"recharge_date":transdate,
|
||||||
|
"recharge_logid":logid,
|
||||||
|
"recharge_amt":recharge_amt,
|
||||||
|
"action":action,
|
||||||
|
}
|
||||||
|
ra = RechargeAccounting(recharge_log)
|
||||||
|
if sor:
|
||||||
|
r = await ra.accounting(sor)
|
||||||
|
return True
|
||||||
|
|
||||||
|
db = DBPools()
|
||||||
|
dbname = await rfrun('get_module_dbname', 'accounting')
|
||||||
|
async with db.sqlorContext(dbname) as sor:
|
||||||
|
r = await ra.accounting(sor)
|
||||||
|
return True
|
||||||
|
|
||||||
|
29
app/acc.py
Normal file
29
app/acc.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
from time import time
|
||||||
|
|
||||||
|
from appPublic.worker import awaitify
|
||||||
|
from appPublic.jsonConfig import getConfig
|
||||||
|
from ahserver.serverenv import ServerEnv
|
||||||
|
from appPublic.registerfunction import RegisterFunction
|
||||||
|
from ahserver.webapp import webapp
|
||||||
|
from accounting.openaccount import openAllResellerAccounts
|
||||||
|
from accounting.openaccount import openAllCustomerAccounts
|
||||||
|
from accounting.openaccount import openAllProviderAccounts
|
||||||
|
from accounting.openaccount import openRetailRelationshipAccounts
|
||||||
|
from accounting.openaccount import openOwnerAccounts
|
||||||
|
from accounting.recharge import recharge_accounting
|
||||||
|
from accounting.getaccount import getAccountBalance, getCustomerBalance
|
||||||
|
from accounting.init import load_accounting
|
||||||
|
|
||||||
|
def get_db(module=''):
|
||||||
|
return 'test'
|
||||||
|
|
||||||
|
def init_func():
|
||||||
|
rf = RegisterFunction()
|
||||||
|
rf.register('get_module_dbname', get_db)
|
||||||
|
load_accounting()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
webapp(init_func)
|
||||||
|
|
6
www/alipay_recharge.ui
Normal file
6
www/alipay_recharge.ui
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"widgettype":"VBox",
|
||||||
|
"options":{
|
||||||
|
"height":"100%"
|
||||||
|
}
|
||||||
|
}
|
5
www/api/callback/alipay/index.dspy
Normal file
5
www/api/callback/alipay/index.dspy
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
debug(f'{params_kw=}')
|
||||||
|
return {
|
||||||
|
'status':'ok',
|
||||||
|
'message':'is ok'
|
||||||
|
}
|
5
www/api/callback/wechat/index.dspy
Normal file
5
www/api/callback/wechat/index.dspy
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
debug(f'{params_kw=}')
|
||||||
|
return {
|
||||||
|
'status':'ok',
|
||||||
|
'message':'is ok'
|
||||||
|
}
|
31
www/recharge.ui
Normal file
31
www/recharge.ui
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"widgettype":"Form",
|
||||||
|
"options":{
|
||||||
|
"fields":[
|
||||||
|
{
|
||||||
|
"name":"recharge_amt",
|
||||||
|
"uitype":"float",
|
||||||
|
"required":true,
|
||||||
|
"label":"充值金额"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"channel",
|
||||||
|
"label":"选择充值方式",
|
||||||
|
"uitype":"checkbox",
|
||||||
|
"multicheck":false,
|
||||||
|
"required":true,
|
||||||
|
"value":"alipay",
|
||||||
|
"data":[
|
||||||
|
{
|
||||||
|
"value":"alipay",
|
||||||
|
"text":"支付宝"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value":"wechatpay",
|
||||||
|
"text":"微信支付"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
6
www/wechat_recharge.ui
Normal file
6
www/wechat_recharge.ui
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"widgettype":"VBox",
|
||||||
|
"options":{
|
||||||
|
"height":"100%"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user