From bd09b33337c2f0280483c0832b1f88a3687fb198 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Wed, 10 Dec 2025 14:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../main_download_batch_data_and_trans.py | 24 ++++++++----------- .../download_batch_data/utils/funcs.py | 18 ++++++++++++++ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 418f161..6342c0e 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,4 @@ factory_sliceing/download_batch_data/utils/__pycache__/ factory_sliceing/auto_sliceing_operate/utils/__pycache__/ script/factory_sliceing/build/build_exe/ script/factory_sliceing_v2/build/build_exe/ +factory_sliceing/download_batch_data/__pycache__/ \ No newline at end of file diff --git a/factory_sliceing/download_batch_data/main_download_batch_data_and_trans.py b/factory_sliceing/download_batch_data/main_download_batch_data_and_trans.py index 7fe839d..4cfc0c9 100644 --- a/factory_sliceing/download_batch_data/main_download_batch_data_and_trans.py +++ b/factory_sliceing/download_batch_data/main_download_batch_data_and_trans.py @@ -1,11 +1,5 @@ -import os,shutil -import redis -import oss2,time,sys -import requests -import argparse,json +import os,time,sys from .utils.funcs import requestApiToUpdateSliceStatus - -# from download_print_out import download_transform_save_by_json from .utils.oss_redis import redisClient from .utils.funcs import downloadJsonAndJpgFileAndMoveToCorrectDir, downloadDataByOssAndTransformSave # 默认使用脚本所在目录 @@ -132,13 +126,15 @@ def main(work_dir=None): sys.exit(0) -def testMain(): - global currentDir - currentDir = "/Users/dcx/code/make2/script/factory_sliceing_v2/tempData" - versionId = '10153' #'10153 10158' - print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 正在处理版次ID={versionId}') - res = step1(versionId) - print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 处理完成,res={res}') +# def testMain(): +# # global currentDir +# # currentDir = "/Users/dcx/code/make2/script/factory_sliceing_v2/tempData" +# # versionId = '10153' #'10153 10158' +# # print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 正在处理版次ID={versionId}') +# # res = step1(versionId) +# # print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 处理完成,res={res}') + +# sendWechatMessage("18950403426", "测试企业微信通知") # if __name__ == '__main__': # #testMain() diff --git a/factory_sliceing/download_batch_data/utils/funcs.py b/factory_sliceing/download_batch_data/utils/funcs.py index e03fb67..9dfc6d1 100644 --- a/factory_sliceing/download_batch_data/utils/funcs.py +++ b/factory_sliceing/download_batch_data/utils/funcs.py @@ -114,11 +114,13 @@ def requestApiToUpdateSliceStatus(versionId, downloadCounts): res = requests.post(api_url, timeout=60) # 60秒超时 if res.status_code != 200: log(f'状态变更请求失败, res={res.text}') + sendWechatMessage("18950403426", f"切片状态变更请求失败, res={res.text}") return False log(f'状态变更请求成功, res={res.text}') #判断返回的code是否是1000 if res.json()["code"] != 1000: log(f'状态变更请求失败, res={res.text}') + sendWechatMessage("18950403426", f"切片状态变更请求失败, res={res.text}") return False log(f'状态变更请求成功, res={res.text}') return True @@ -691,3 +693,19 @@ def findBpyModule(): raise FileNotFoundError(error_msg) return blender_bin_path + + + +#发起企业微信通知 +def sendWechatMessage(tel,content): + # 发起企业微信通知 + api_url = f"https://mp.api.suwa3d.com/api/qyNotify" + data = { + "message": content, + "userId": tel + } + res = requests.post(api_url, data=json.dumps(data)) + if res.status_code != 200: + log(f"发起企业微信通知失败, res={res.text}") + return False + return True \ No newline at end of file