Merge branch 'main' of git.opencomputing.cn:yumoqing/accounting

This commit is contained in:
yumoqing 2025-12-25 15:18:08 +08:00
commit d38368b3ac
5 changed files with 38 additions and 18 deletions

View File

@ -9,7 +9,6 @@ from .const import *
from .accountingnode import get_accounting_nodes
from .excep import *
from .getaccount import getAccountByName
from .businessdate import get_business_date
class ConsumeBiz(PFBiz):
def __init__(self, consume_logs):
@ -54,16 +53,16 @@ class ConsumeBiz(PFBiz):
ao = Accounting(self)
await ao.do_accounting(sor)
async def get_orgid_by_trans_role(self, sor, leg, role):
if role == 'owner':
return '0'
if role == 'customer':
return self.customerid
async def get_orgid_by_trans_role(self, sor, leg, role):
if role == 'owner':
return '0'
if role == 'customer':
return self.customerid
if role == 'reseller':
return self.resellerid
if role is None or role == 'null':
return None
e = Exception(f'unknown role({role})')
exception(f'Exception:{e}')
raise e
if role is None or role == 'null':
return None
e = Exception(f'unknown role({role})')
exception(f'Exception:{e}')
raise e

View File

@ -2,13 +2,13 @@ from appPublic.registerfunction import RegisterFunction
from appPublic.dictObject import DictObject
from appPublic.log import debug, exception, error
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 accounting.getaccount import getAccountBalance, getCustomerBalance, getAccountByName, get_account_total_amount
from accounting.bizaccount import BizAccounting
from accounting.recharge import RechargeBiz, recharge_accounting
from comsume import ConsumeBiz
from .accounting_config import Accounting
from .bill import write_bill
from .openaccount import openOwnerAccounts, openProviderAccounts, openResellerAccounts, openCustomerAccounts
from .getaccount import getAccountBalance, getCustomerBalance, getAccountByName, get_account_total_amount
from .bizaccount import BizAccounting
from .recharge import RechargeBiz, recharge_accounting
from .consume import ConsumeBiz
async def all_my_accounts(request):
env = request._run_ns

View File

@ -0,0 +1,7 @@
debug(f'{params_kw=}')
dbname = get_module_dbname('accounting')
db = DBPools()
async with db.sqlorContext(dbname) as sor:
await openCustomerAccounts(sor, '0', params_kw.orgid)
return f'{params_kw.orgid} accounts opened')
return f'{db.e_except=}

View File

@ -0,0 +1,7 @@
debug(f'{params_kw=}')
dbname = get_module_dbname('accounting')
db = DBPools()
async with db.sqlorContext(dbname) as sor:
await openOwnerAccounts(sor, '0')
return f'0 accounts opened')
return f'{db.e_except=}

View File

@ -0,0 +1,7 @@
debug(f'{params_kw=}')
dbname = get_module_dbname('accounting')
db = DBPools()
async with db.sqlorContext(dbname) as sor:
await openResellerAccounts(sor, '0', params_kw.orgid)
return f'{params_kw.orgid} accounts opened')
return f'{db.e_except=}