Merge branch 'main' of git.opencomputing.cn:yumoqing/accounting
This commit is contained in:
commit
d38368b3ac
@ -9,7 +9,6 @@ from .const import *
|
|||||||
from .accountingnode import get_accounting_nodes
|
from .accountingnode import get_accounting_nodes
|
||||||
from .excep import *
|
from .excep import *
|
||||||
from .getaccount import getAccountByName
|
from .getaccount import getAccountByName
|
||||||
from .businessdate import get_business_date
|
|
||||||
|
|
||||||
class ConsumeBiz(PFBiz):
|
class ConsumeBiz(PFBiz):
|
||||||
def __init__(self, consume_logs):
|
def __init__(self, consume_logs):
|
||||||
@ -54,16 +53,16 @@ class ConsumeBiz(PFBiz):
|
|||||||
ao = Accounting(self)
|
ao = Accounting(self)
|
||||||
await ao.do_accounting(sor)
|
await ao.do_accounting(sor)
|
||||||
|
|
||||||
async def get_orgid_by_trans_role(self, sor, leg, role):
|
async def get_orgid_by_trans_role(self, sor, leg, role):
|
||||||
if role == 'owner':
|
if role == 'owner':
|
||||||
return '0'
|
return '0'
|
||||||
if role == 'customer':
|
if role == 'customer':
|
||||||
return self.customerid
|
return self.customerid
|
||||||
if role == 'reseller':
|
if role == 'reseller':
|
||||||
return self.resellerid
|
return self.resellerid
|
||||||
if role is None or role == 'null':
|
if role is None or role == 'null':
|
||||||
return None
|
return None
|
||||||
e = Exception(f'unknown role({role})')
|
e = Exception(f'unknown role({role})')
|
||||||
exception(f'Exception:{e}')
|
exception(f'Exception:{e}')
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,13 @@ from appPublic.registerfunction import RegisterFunction
|
|||||||
from appPublic.dictObject import DictObject
|
from appPublic.dictObject import DictObject
|
||||||
from appPublic.log import debug, exception, error
|
from appPublic.log import debug, exception, error
|
||||||
from ahserver.serverenv import ServerEnv
|
from ahserver.serverenv import ServerEnv
|
||||||
from accounting.accounting_config import Accounting
|
from .accounting_config import Accounting
|
||||||
from accounting.bill import write_bill
|
from .bill import write_bill
|
||||||
from accounting.openaccount import openOwnerAccounts, openProviderAccounts, openResellerAccounts, openCustomerAccounts
|
from .openaccount import openOwnerAccounts, openProviderAccounts, openResellerAccounts, openCustomerAccounts
|
||||||
from accounting.getaccount import getAccountBalance, getCustomerBalance, getAccountByName, get_account_total_amount
|
from .getaccount import getAccountBalance, getCustomerBalance, getAccountByName, get_account_total_amount
|
||||||
from accounting.bizaccount import BizAccounting
|
from .bizaccount import BizAccounting
|
||||||
from accounting.recharge import RechargeBiz, recharge_accounting
|
from .recharge import RechargeBiz, recharge_accounting
|
||||||
from comsume import ConsumeBiz
|
from .consume import ConsumeBiz
|
||||||
|
|
||||||
async def all_my_accounts(request):
|
async def all_my_accounts(request):
|
||||||
env = request._run_ns
|
env = request._run_ns
|
||||||
|
|||||||
7
wwwroot/open_customer_accounts.dspy
Normal file
7
wwwroot/open_customer_accounts.dspy
Normal 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=}
|
||||||
7
wwwroot/open_owner_accounts.dspy
Normal file
7
wwwroot/open_owner_accounts.dspy
Normal 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=}
|
||||||
7
wwwroot/open_reseller_accounts.dspy
Normal file
7
wwwroot/open_reseller_accounts.dspy
Normal 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=}
|
||||||
Loading…
x
Reference in New Issue
Block a user