Files
aaPanel/mod/base/__init__.py
T
Jack a24f2e23c6 Update to 7.25.0
1. Added Mail Marketing Automation trigger tasks
2. Added Mail Marketing Groups Import, Export, Merge
3. Added Mail Marketing Subscribers to support paste import
4. Added Mail Marketing Template Import Export Duplicate
5. Added Mail server add timed automatic reply
6. Added HTTPS Protection function for Website (disables automatic HTTP to HTTPS redirection when enabled)
7. Optimize Website Interface Button Integration
8. Optimize the response speed of WP Toolkit interface
2025-03-13 17:52:26 +08:00

37 lines
896 B
Python

import time
from typing import Dict, List, Tuple, Union
from .process import RealProcess, Process
from .process import RealUser, User
from .process import RealServer, Server
def json_response(
status: bool,
msg: str = None,
data: Union[Dict, List, Tuple, bool, str, int, float] = None,
code: int = 0,
args: Union[List[str], Tuple[str]] = None,
):
if isinstance(msg, str) and args is not None:
for i in range(len(args)):
rep = '{' + str(i + 1) + '}'
msg = msg.replace(rep, args[i])
stn = 0 if status else -1
if msg is None:
msg = data
# return {
# "status": status,
# "msg": msg,
# "data": data,
# "code": code,
# "timestamp": int(time.time())
# }
return {
"status": stn,
"timestamp": int(time.time()),
"message": msg
}