Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EMUAFactory
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mayinghao
EMUAFactory
Commits
b9307f2f
Commit
b9307f2f
authored
Sep 26, 2025
by
mayinghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
产品管理页码
parent
695b7f6e
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
343 additions
and
34 deletions
+343
-34
main.py
main.py
+307
-25
thread_upload.py
multipleThread/thread_upload.py
+36
-9
No files found.
main.py
View file @
b9307f2f
This diff is collapsed.
Click to expand it.
multipleThread/thread_upload.py
View file @
b9307f2f
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
datetime
import
time
import
requests
import
requests
from
PyQt5.QtCore
import
QThread
,
pyqtSignal
,
QWaitCondition
,
QMutex
,
QObject
,
pyqtSlot
from
PyQt5.QtCore
import
QThread
,
pyqtSignal
,
QWaitCondition
,
QMutex
,
QObject
,
pyqtSlot
import
os.path
import
os.path
...
@@ -8,6 +11,27 @@ from oss2 import SizedFileAdapter
...
@@ -8,6 +11,27 @@ from oss2 import SizedFileAdapter
import
uuid
import
uuid
from
oss2.models
import
PartInfo
from
oss2.models
import
PartInfo
from
.config
import
*
from
.config
import
*
product_callback_url
=
"https://uat.emku.laidecloud.com/console/seller/getFiles.ajax"
def
nanoseconds_to_date
(
nano_seconds
):
timestamp
=
nano_seconds
/
1000
utc_time
=
datetime
.
datetime
.
utcfromtimestamp
(
timestamp
)
beijing_time
=
utc_time
+
datetime
.
timedelta
(
hours
=
8
)
str_date
=
beijing_time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
str_date
def
process_data
(
data
):
result
=
[]
for
j
in
data
[
"obj"
][
"files"
]:
result
.
append
([
j
[
"info"
],
"生产资料"
,
j
[
'addTime'
]])
for
j
in
data
[
"obj"
][
"files1"
]:
result
.
append
([
j
[
"info"
],
"设计资料"
,
j
[
'addTime'
]])
for
j
in
data
[
"obj"
][
"files2"
]:
result
.
append
([
j
[
"info"
],
"Bom资料"
,
j
[
'addTime'
]])
print
(
result
)
return
result
# 定义一个线程类
# 定义一个线程类
...
@@ -15,7 +39,7 @@ class Upload_Thread(QObject):
...
@@ -15,7 +39,7 @@ class Upload_Thread(QObject):
#自定义信号声明
#自定义信号声明
# 使用自定义信号和UI主线程通讯,参数是发送信号时附带参数的数据类型,可以是str、int、list等
# 使用自定义信号和UI主线程通讯,参数是发送信号时附带参数的数据类型,可以是str、int、list等
finishSignal
=
pyqtSignal
()
finishSignal
=
pyqtSignal
(
list
,
int
)
updateSignal
=
pyqtSignal
(
tuple
)
updateSignal
=
pyqtSignal
(
tuple
)
def
__init__
(
self
,
thread_num
=
0
,
order_id
=
None
,
type_info
=
None
,
token
=
""
):
def
__init__
(
self
,
thread_num
=
0
,
order_id
=
None
,
type_info
=
None
,
token
=
""
):
...
@@ -153,13 +177,16 @@ class Upload_Thread(QObject):
...
@@ -153,13 +177,16 @@ class Upload_Thread(QObject):
datas
=
{
"id"
:
str
(
self
.
order_id
),
"name"
:
self
.
uuid_str
+
"."
+
extension
,
"path"
:
name_prefix
,
"info"
:
key
,
datas
=
{
"id"
:
str
(
self
.
order_id
),
"name"
:
self
.
uuid_str
+
"."
+
extension
,
"path"
:
name_prefix
,
"info"
:
key
,
"type"
:
self
.
type_info
}
"type"
:
self
.
type_info
}
print
(
f
"datas {datas}"
)
headers
=
{
'token'
:
self
.
token
,
headers
=
{
'token'
:
self
.
token
,
'User-Agent'
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
'User-Agent'
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
try
:
if
self
.
type_info
>=
12
:
callback_url
=
goods_callback_url
response
=
requests
.
post
(
callback_url
,
data
=
datas
,
headers
=
headers
)
response
=
requests
.
post
(
callback_url
,
data
=
datas
,
headers
=
headers
)
res
=
response
.
json
()
res
=
response
.
json
()
print
(
res
[
"obj"
])
print
(
res
[
"obj"
])
self
.
finishSignal
.
emit
()
response
=
requests
.
post
(
product_callback_url
,
data
=
{
"id"
:
self
.
order_id
},
headers
=
headers
)
except
Exception
as
e
:
data
=
response
.
json
()
print
(
"wrong"
)
res
=
process_data
(
data
)
self
.
finishSignal
.
emit
(
res
,
self
.
order_id
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment