|
|
|
|
@ -2,9 +2,11 @@ import os
@@ -2,9 +2,11 @@ import os
|
|
|
|
|
import redis |
|
|
|
|
import oss2,time,sys |
|
|
|
|
import requests |
|
|
|
|
import argparse |
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) |
|
|
|
|
from download_print_out import download_transform_save_by_json |
|
|
|
|
|
|
|
|
|
# 默认使用脚本所在目录 |
|
|
|
|
currentDir = os.path.dirname(os.path.abspath(__file__)) |
|
|
|
|
|
|
|
|
|
ENV = 'dev' |
|
|
|
|
@ -97,7 +99,19 @@ def step2(jsonFilePath, versionId):
@@ -97,7 +99,19 @@ def step2(jsonFilePath, versionId):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 读取 队列中一个数据出来 |
|
|
|
|
def main(): |
|
|
|
|
def main(work_dir=None): |
|
|
|
|
global currentDir |
|
|
|
|
|
|
|
|
|
# 如果指定了工作目录,使用指定的目录 |
|
|
|
|
if work_dir: |
|
|
|
|
work_dir = os.path.abspath(work_dir) |
|
|
|
|
if not os.path.exists(work_dir): |
|
|
|
|
print(f'指定的工作目录不存在: {work_dir},将创建该目录') |
|
|
|
|
os.makedirs(work_dir, exist_ok=True) |
|
|
|
|
currentDir = work_dir |
|
|
|
|
print(f'使用指定的工作目录: {currentDir}') |
|
|
|
|
else: |
|
|
|
|
print(f'使用默认工作目录: {currentDir}') |
|
|
|
|
|
|
|
|
|
# 循环处理,直到队列为空 |
|
|
|
|
while True: |
|
|
|
|
@ -135,4 +149,12 @@ def main():
@@ -135,4 +149,12 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
main() |
|
|
|
|
parser = argparse.ArgumentParser(description='排版打印订单处理程序') |
|
|
|
|
parser.add_argument( |
|
|
|
|
'--work-dir', |
|
|
|
|
type=str, |
|
|
|
|
default=None, |
|
|
|
|
help='指定工作目录(磁盘路径),例如: D:/work 或 /Users/username/work。如果不指定,则使用脚本所在目录' |
|
|
|
|
) |
|
|
|
|
args = parser.parse_args() |
|
|
|
|
main(work_dir=args.work_dir) |
|
|
|
|
|