This commit is contained in:
yumoqing 2025-02-05 11:44:49 +08:00
parent 96a21d0c01
commit 662a511648
3 changed files with 19 additions and 12 deletions

View File

@ -1,5 +1,6 @@
from appPublic.log import debug, exception
from sqlor.dbpools import DBPools
from ahserver.serverenv import ServerEnv, get_serverenv
from .const import *
from accounting.accountingnode import get_parent_orgid
@ -77,19 +78,13 @@ where a.subjectid = b.id and
async def getTransPayMode():
pass
async def getParentOrganization(sor, childid):
sql="select a.* from organization a, organization b where b.parentid=a.id and b.id = ${childid}$"
ns = {
"childid":childid
}
recs = await sor.sqlExe(sql, ns)
if len(recs) == 0:
return None
return recs[0]
async def getCustomerBalance(sor, customerid):
name = '业务账'
orgid = await get_parent_orgid(sor, customerid)
name = '客户资金账户'
get_owner_orgid = get_serverenv('get_owner_orgid')
if get_owner_orgid is None:
debug('get_owner_orgid function is not a serverenv function')
return None
orgid = await get_owner_orgid(sor, customerid)
if orgid is None:
print(f"{customerid=}'s parent organization not found")
return None

View File

@ -5,6 +5,7 @@ from ahserver.serverenv import ServerEnv
from accounting.accounting_config import Accounting
from accounting.bill import write_bill
from accounting.openaccount import openOwnerAccounts, openProviderAccounts, openResellerAccounts, openCustomerAccounts
from getaccount import getAccountBalance, getCustomerBalance
def load_accounting():
g = ServerEnv()
@ -14,3 +15,6 @@ def load_accounting():
g.openProviderAccounts = openProviderAccounts
g.openResellerAccounts = openResellerAccounts
g.openCustomerAccounts = openCustomerAccounts
g.getAccountBalance = getAccountBalance
g.getCustomerBalance = getCustomerBalance

8
script/roleperm.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/bash
python ~/py/rbac/script/roleperm.py sage accounting owner superuser account_config accounting_config subject
python ~/py/rbac/script/roleperm.py sage accounting reseller operator account acc_detail acc_balance accounting_log bill bill_detail ledger
python ~/py/rbac/script/roleperm.py sage accounting reseller sale account acc_detail acc_balance accounting_log bill bill_detail ledger
python ~/py/rbac/script/roleperm.py sage accounting reseller accountant account acc_detail acc_balance accounting_log bill bill_detail ledger
python ~/py/rbac/script/roleperm.py sage accounting customer customer account acc_detail acc_balance accounting_log bill bill_detail ledger