dongchangxi 6 months ago
parent
commit
49a3ae397a
  1. 1
      .gitignore
  2. 2
      apps/auto_convert3d_new.py
  3. 7
      openapi/config.toml
  4. 36
      openapi/main.py
  5. 1
      openapi/token.txt
  6. 2
      openapi/utils.py
  7. 33
      test/test.py

1
.gitignore vendored

@ -20,3 +20,4 @@ apps/__pycache__/fix_up_color_two_a.cpython-310.pyc @@ -20,3 +20,4 @@ apps/__pycache__/fix_up_color_two_a.cpython-310.pyc
apps/__pycache__/ps_image_shadow_up_ag_two_a.cpython-310.pyc
apps/__pycache__/white_purification_v3.cpython-310.pyc
apps/__pycache__/white_purification_v4.cpython-310.pyc
comfyui/util/__pycache__/utils.cpython-311.pyc

2
apps/auto_convert3d_new.py

@ -165,7 +165,7 @@ def team_check(r): @@ -165,7 +165,7 @@ def team_check(r):
print(f'{update_repair_status_url}?id={repair_id}')
res = requests.get(f'{update_repair_status_url}?id={repair_id}')
print('更新团队审核状态:', res.text)
#shutil.rmtree(os.path.join(workdir, 'print', pid,orderId), ignore_errors=True)
shutil.rmtree(os.path.join(workdir, 'print', pid,orderId), ignore_errors=True)
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), f'pid:{pid} 生成团队审核模型 end')
def get_p3d_info(pid):

7
openapi/config.toml

@ -1,6 +1,9 @@ @@ -1,6 +1,9 @@
[account]
appId="1nt7j0w17ecd9duruc48m7050012r5a8"
appSecret="1nt7j0w17ecd9duruc48m70600m2a32r"
#appId="1nt7j0w17ecd9duruc48m7050012r5a8"
#appSecret="1nt7j0w17ecd9duruc48m70600m2a32r"
#shopId="1"
appId="xdezmm02857d9vp1s5j8f3i300r1ige1"
appSecret="xdezmm02857d9vp1s5j8gtd400ml1lwe"
shopId="1"
[oss]

36
openapi/main.py

@ -189,20 +189,22 @@ def main(imagePath = ""): @@ -189,20 +189,22 @@ def main(imagePath = ""):
os.remove(imagePath)
return data,True
if __name__ == "__main__":
#获取请求参数
args = sys.argv[1:]
if len(args) == 0:
#需要二次确认是否要处理images目录下的所有图片
confirmV = input("是否要处理images目录下的所有图片? (y/n)")
if confirmV == "y":
imageFolder()
else:
print("请输入图片路径")
sys.exit(1)
else:
for imagePath in args:
main(imagePath)
print(f"{args}")
def test():
utils.getToken()
test()
# if __name__ == "__main__":
# #获取请求参数
# args = sys.argv[1:]
# if len(args) == 0:
# #需要二次确认是否要处理images目录下的所有图片
# confirmV = input("是否要处理images目录下的所有图片? (y/n)")
# if confirmV == "y":
# imageFolder()
# else:
# print("请输入图片路径")
# sys.exit(1)
# else:
# for imagePath in args:
# main(imagePath)
# print(f"{args}")

1
openapi/token.txt

@ -1 +0,0 @@ @@ -1 +0,0 @@
xdezmm0291gd9x7z89yj3um2709r55mu|1747365162

2
openapi/utils.py

@ -6,6 +6,7 @@ def cfg(keyName): @@ -6,6 +6,7 @@ def cfg(keyName):
with open('config.toml', 'r') as f:
config = toml.load(f)
print(config)
if "." in keyName:
keyName = keyName.split(".")
return config[keyName[0]][keyName[1]]
@ -42,6 +43,7 @@ def getToken(): @@ -42,6 +43,7 @@ def getToken():
return token.split("|")[0]
#获取token
print(cfg("api.domain"))
url = cfg("api.domain")+cfg("api.getToken")
params = {
"appId":cfg("account.appId"),

33
test/test.py

@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
import requests
#url
#循环100次
for i in range(100):
url = "https://mp.api.suwa3d.com/api/oss/putSignURL?key_name=photos/233522/photo2/"+str(i)+".jpg"
#请求url
res = requests.get(url)
#打印结果
print(res.text)
#转json
res_json = res.json()
ossUrl = res_json['data']
print(f"当前是第几个:{i}, ossUrl: {ossUrl}")
# data 是一个 oss 的上传连接, 向这个上传连接发送一个文件
# 上传文件
try:
#with open("E:/microservice/make2/data/0.jpg", 'rb') as f:
file = open('E:/microservice/make2/data/0.jpg', 'rb')
response = requests.put(ossUrl, data=file, headers={"Content-Type": "application/octet-stream"})
print(response.status_code)
if response.status_code == 200:
upload_is_ok = True
else:
print(f"上传图片异常,状态码: {response.status_code}")
except RequestException as e:
print(f"上传异常: {str(e)}")
# file = open('E:/microservice/make2/data/0.jpg', 'rb')
# res = requests.put(ossUrl, data=file)
# print(res.text)
# url = "https://mp.api.suwa3d.com/api/oss/putSignURL?key_name=objs/photos/233522/a.jpg"
Loading…
Cancel
Save