修改处理
This commit is contained in:
1 parent
e255cb3ccb
commit
bd09b33337
3 files changed
+29
-14
No files matched your search
@@ -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()
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user