Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wfs_export
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yexing
wfs_export
Commits
f63311b6
Commit
f63311b6
authored
Mar 18, 2025
by
yexing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[yx] update
parent
d7184b29
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
142 additions
and
59 deletions
+142
-59
plugin/.version
+2
-2
plugin/dist.crx
+0
-0
plugin/dist.test.pem
+28
-0
plugin/dist/js/background.js
+42
-18
plugin/dist/js/main.js
+3
-2
plugin/dist/js/popup.js
+4
-3
plugin/dist/manifest.json
+2
-2
plugin/dist/popup.html
+3
-3
plugin/package.json
+1
-0
plugin/rollup.config.js
+6
-6
plugin/src/background.js
+43
-18
plugin/src/base.js
+3
-2
plugin/src/main.js
+1
-0
plugin/src/popup.js
+4
-3
No files found.
plugin/.version
View file @
f63311b6
2.2.4
\ No newline at end of file
2.4.3
\ No newline at end of file
plugin/dist.crx
View file @
f63311b6
No preview for this file type
plugin/dist.test.pem
0 → 100644
View file @
f63311b6
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC5NToxMwL+9ed2
+IHi7SYFVXbYyzEjNzwCsYKwdr6PCVyzPFIEGWsV2qW0IANelJVM9+HrbrTDhYNo
ES6ysi/eSIBoGZLoVPIihsd3zt5EkmenwoOs8i6aSH5wI3rHZAuMMJUqRl20xpJV
yZ/7XhcP6zniageQwmXyTRBMjeZwdXnQc23ZjPj5FxFA+lHJ/EozK6KN7QpfXRYn
3ES4fVojTutlEfRA8ZUsRTlFM84mitBiEeQefd1W8tY5SSmgmxpob+fnQsOgb6EQ
wludlyI7MOFBj9h0gTYOosfEy55vk0OHt/pmkKK6Pr3VvohrUBWne9SQZZ9ZLclJ
g1xeSEo7AgMBAAECggEAWDJhwNYjAhlGHaCf8dmu9nFJhFnWz4dZG4s+yhvyCRmT
PINoJy2XkjOqH0nzcNHe+2U7/6qbiFSHTEKKc2xpYTgzdd9f1yXEnO6EBKjNrefu
VrRJkk1OJgiJtYsfx937pcno7tXNf+3j99hpSAH5h4oj6Y9GhQgeFjHepiYY68om
OtwNxjiBvOTDsNKBroORns4NoLbGH0HPUBm9uS0YYPm1P85RTw7D/r5f1iL6REhZ
JBJPhBRlehv3o/nJgI07aiuvwUHq6dk78hWE8VgtKqD9ccfN5m0bRSczL4IpKT8T
0N4z704xMM5e7cwfLaA1mlznla7JcgLtplI30BHLaQKBgQDgU9Lrcdxj0UE2w2Yh
WpVKy5u5zu+4a/EDAHySDauvRJOotBx028KNwq9tBCAGyv9MvTblcE4MTcOF60IS
uuSGFFLXkJKO5K9BeYYP6g5SQ3x3XKudTgc9xYx8FvACrxUPUbtKZ/0O1FBUl7mF
8xdyLZ9xKXcDPcgHawYiXgPqVwKBgQDTW3PjrelMAAXzHl4nSfZ+5aIRCB8/gsQY
D051CEp9Vf+6JNOYPQOgsXq1JJDkZKtrZKYS8jzUa2J32cybp/9vxhT1yWgYF13s
8CqDC+TC2ly3ojFdP05f6sSTsY3wbPqMkk0AmUvCK4K+axn+FU0LkHrdt4NRDavT
/Kj2bKD4vQKBgQDIXtck6pz6o6xmZ/5PiIOVPWypeQdyaSfrkIG0S3WwpcZmiApq
7uhGi0D6VRbuOl/zgYcJRVjRcJxWgB6ScFEy2fBtD3t5GxbXmt5+VIfaPuFsFGBN
r6aULGIhbLOREiXzewOZoGzO1CG0jZlu5gVpPQsPnwPo50RGK/hctjE1HQKBgCk8
JGX9HhD3yDFgcVoU8gRb5LyR6xbG+l7/TX1DutStHJFCcg23iaemOJxyn9oPUepH
3qa/n+KJeNKNKYAMzKcP7DLvsmFQ3cBGMuUSQvVJCOHCwQLCQRYxhVyTPW/0swUN
3fwJ7F/bgUyJNK7/lOJ2s6HiFbqQgj9/ga9iDh25AoGAA0IblHQe+/7XqVnul9rU
WX1SSKQXEEaMjAtr2oR6+l6c+jSumoOibcnvQMvJvqEHI5cnIgCb62JUNDrhOq7Q
cKVzMy7ULcpPREBkmuuLDFdCcKGrA5SgGk9OtAgS5fpL0008Hz2EpoovV3aSP4vS
dYwA5he1Q5CwYXdqC/+fCeY=
-----END PRIVATE KEY-----
plugin/dist/js/background.js
View file @
f63311b6
...
...
@@ -19619,7 +19619,7 @@
}
console
.
log
(
`send
${
JSON
.
stringify
(
msg
)}
to
${
tab
.
url
}
`
);
chrome
.
tabs
.
sendMessage
(
tab
.
id
,
msg
,
(
response
)
=>
{
callback
?
?
callback
(
response
);
callback
?
callback
(
response
)
:
console
.
log
(
response
);
});
});
};
...
...
@@ -19665,9 +19665,8 @@
startTask
();
sendTabMsg
(
msg
,
sendResponse
);
}
else
if
(
msg
.
type
===
"resetTaskNum"
)
{
taskNum
=
0
;
logs
=
[];
clearInterval
(
taskInterval
);
taskInterval
=
null
,
taskNum
=
0
,
logs
=
[];
sendResponse
();
}
else
if
(
msg
.
type
===
"addLog"
)
{
logs
.
push
(
msg
.
data
);
...
...
@@ -19686,8 +19685,8 @@
let
taskInterval
=
null
,
taskNum
=
0
,
logs
=
[];
function
startTask
()
{
// chrome.storage.local.get(['isRunning'
, 'logs', 'taskCount', 'taskLen'
]).then(console.log);
// chrome.storage.local.set({ isRunning: true
, logs: [], taskLen: 0, taskCount: 0
});
// chrome.storage.local.get(['isRunning']).then(console.log);
// chrome.storage.local.set({ isRunning: true });
taskNum
++
;
if
(
taskInterval
)
return
;
...
...
@@ -19696,10 +19695,15 @@
// 推送更新
const
ackLen
=
logs
.
filter
(
x
=>
x
.
message
.
includes
(
"完成"
)).
length
;
if
(
ackLen
===
taskNum
)
{
taskNum
=
0
;
clearInterval
(
taskInterval
);
chrome
.
storage
.
local
.
set
({
isRunning
:
false
});
logs
.
push
(
"已全部完成"
);
// recycle
taskInterval
=
null
,
taskNum
=
0
;
logs
.
push
({
time
:
new
Date
().
toLocaleTimeString
(),
message
:
"已全部完成"
});
// copy logs
chrome
.
storage
.
local
.
set
({
isRunning
:
false
,
logs
});
}
chrome
.
runtime
.
sendMessage
({
type
:
'progress'
,
logs
...
...
@@ -19708,21 +19712,25 @@
}
const
initTimedTask
=
()
=>
{
for
(
le
t
[
key
,
{
uri
,
params
}]
of
Object
.
entries
(
TABLE
))
{
le
t
plan
=
new
Plan
(
null
,
params
);
le
t
period
=
plan
.
get
()?.
period
;
for
(
cons
t
[
key
,
{
uri
,
params
}]
of
Object
.
entries
(
TABLE
))
{
cons
t
plan
=
new
Plan
(
null
,
params
);
cons
t
period
=
plan
.
get
()?.
period
;
const
when
=
plan
.
next
().
dt
.
getTime
();
chrome
.
alarms
.
create
(
key
,
{
when
});
console
.
log
(
`[timedTask]
start - uri:
${
uri
}
period:
${
period
}
next
:
${
when
}
`
);
console
.
log
(
`[timedTask]
uri:
${
uri
}
period:
${
period
}
when
:
${
when
}
`
);
}
};
chrome
.
alarms
.
onAlarm
.
addListener
((
alarm
)
=>
{
const
{
uri
,
params
}
=
TABLE
[
alarm
.
name
];
let
plan
=
new
Plan
(
null
,
params
);
let
period
=
plan
.
get
()?.
period
;
const
when
=
plan
.
next
().
dt
.
getTime
();
chrome
.
alarms
.
create
(
alarm
.
name
,
{
when
});
console
.
log
(
`[timedTask] start - uri:
${
uri
}
period:
${
period
}
next:
${
when
}
`
);
let
[
key
,
fromDate
,
toDate
,
when
]
=
alarm
.
name
.
split
(
'_'
);
if
(
!
Object
.
keys
(
TABLE
).
includes
(
key
))
return
;
const
{
uri
,
params
}
=
TABLE
[
key
];
const
plan
=
new
Plan
(
null
,
params
);
const
period
=
!
fromDate
||
!
toDate
?
plan
.
get
()?.
period
:
[
fromDate
,
toDate
];
if
(
!
when
)
{
when
=
plan
.
next
().
dt
.
getTime
();
chrome
.
alarms
.
create
(
alarm
.
name
,
{
when
});
console
.
log
(
`[timedTask] uri:
${
uri
}
period:
${
period
}
when:
${
when
}
`
);
}
startTask
();
sendTabMsg
({
type
:
"run"
,
data
:
{
uri
,
period
}
});
});
...
...
@@ -19730,4 +19738,20 @@
initTimedTask
();
// chrome.alarms.clearAll();
const
getTmpClock
=
()
=>
{
const
clock
=
new
Date
();
clock
.
setHours
(
22
,
0
,
0
,
0
);
return
clock
.
getTime
();
};
globalThis
.
initTmpTimedTask
=
(
when
)
=>
{
const
period
=
[
'2025-02-01'
,
'2025-02-28'
];
for
(
const
[
key
,
{
uri
}]
of
Object
.
entries
(
TABLE
))
{
const
name
=
[
key
,
...
period
,
when
].
join
(
'_'
);
chrome
.
alarms
.
create
(
name
,
{
when
});
console
.
log
(
`[timedTask] uri:
${
uri
}
period:
${
period
}
when:
${
when
}
`
);
}
};
globalThis
.
initTmpTimedTask
(
getTmpClock
());
// initTmpTimedTask(new Date().getTime() + 10)
})();
plugin/dist/js/main.js
View file @
f63311b6
...
...
@@ -406,7 +406,7 @@
newJson
[
"Endtime"
]
=
this
.
params
.
toDate
;
return
JSON
.
stringify
(
newJson
);
};
const
getPeriods
=
async
()
=>
{
const
getPeriods
=
async
(
options
=
{}
)
=>
{
const
url
=
"https://seller.walmart.com/aurora/v1/auroraPaymentsSettlementService/payment/settlementPeriods"
;
console
.
log
(
`GET
${
url
}
`
);
let
response
=
await
fetch
(
url
,
{
headers
});
...
...
@@ -415,7 +415,8 @@
if
(
!
response
)
{
throw
new
Error
(
`response 获取失败:
${
JSON
.
stringify
(
data
)}
`
);
}
const
periods
=
response
.
slice
(
1
,
4
);
const
{
start
=
1
,
end
=
4
}
=
options
;
const
periods
=
response
.
slice
(
start
,
end
);
console
.
log
(
`periods:
${
JSON
.
stringify
(
periods
)}
`
);
return
periods
;
};
...
...
plugin/dist/js/popup.js
View file @
f63311b6
...
...
@@ -260,16 +260,17 @@
document
.
querySelector
(
'.modal'
).
style
.
display
=
'none'
;
});
const
btn
=
document
.
querySelector
(
".confirm"
);
chrome
.
storage
.
local
.
get
([
'isRunning'
],
({
isRunning
=
false
})
=>
{
chrome
.
storage
.
local
.
get
([
'isRunning'
,
'logs'
],
({
isRunning
=
false
,
logs
=
[]
})
=>
{
if
(
isRunning
)
{
showModal
();
disableButton
(
btn
);
}
else
{
enableButton
(
btn
);
}
showModal
();
renderLogs
(
logs
);
});
document
.
querySelector
(
'.cancel'
).
addEventListener
(
'click'
,
()
=>
{
chrome
.
storage
.
local
.
set
({
isRunning
:
false
});
chrome
.
storage
.
local
.
set
({
isRunning
:
false
,
logs
:
[]
});
chrome
.
runtime
.
sendMessage
({
type
:
"resetTaskNum"
});
enableButton
(
btn
);
});
...
...
plugin/dist/manifest.json
View file @
f63311b6
{
"name"
:
"WalmartExports"
,
"description"
:
"导出沃尔玛报表"
,
"version"
:
"2.2.4"
,
"manifest_version"
:
3
,
"background"
:{
"service_worker"
:
"./js/background.js"
},
"permissions"
:[
"tabs"
,
"activeTab"
,
"scripting"
,
"notifications"
,
"storage"
,
"alarms"
],
"action"
:{
"default_title"
:
"WalmartExports"
,
"default_popup"
:
"popup.html"
,
"default_icon"
:{
"16"
:
"icon.png"
,
"32"
:
"icon.png"
,
"48"
:
"icon.png"
,
"128"
:
"icon.png"
}},
"icons"
:{
"16"
:
"icon.png"
,
"32"
:
"icon.png"
,
"48"
:
"icon.png"
,
"128"
:
"icon.png"
},
"web_accessible_resources"
:[{
"resources"
:[
"src/main.js"
],
"matches"
:[
"<all_urls>"
]}],
"host_permissions"
:[
"https://seller.walmart.com/*"
,
"https://advertising.walmart.com/*"
,
"https://login.account.wal-mart.com/*"
,
"https://marketplace.walmartapis.com/*"
,
"https://walmart.meinuosha.com/*"
],
"content_scripts"
:[{
"matches"
:[
"https://seller.walmart.com/*"
,
"https://advertising.walmart.com/*"
,
"https://login.account.wal-mart.com/*"
,
"https://marketplace.walmartapis.com/*"
,
"https://walmart.meinuosha.com/*"
],
"js"
:[
"./js/main.js"
]}]}
\ No newline at end of file
{
"name"
:
"Test"
,
"description"
:
"导出沃尔玛报表"
,
"version"
:
"2.4.3"
,
"manifest_version"
:
3
,
"background"
:{
"service_worker"
:
"./js/background.js"
},
"permissions"
:[
"tabs"
,
"activeTab"
,
"scripting"
,
"notifications"
,
"storage"
,
"alarms"
],
"action"
:{
"default_title"
:
"WalmartExports"
,
"default_popup"
:
"popup.html"
,
"default_icon"
:{
"16"
:
"icon.png"
,
"32"
:
"icon.png"
,
"48"
:
"icon.png"
,
"128"
:
"icon.png"
}},
"icons"
:{
"16"
:
"icon.png"
,
"32"
:
"icon.png"
,
"48"
:
"icon.png"
,
"128"
:
"icon.png"
},
"web_accessible_resources"
:[{
"resources"
:[
"src/main.js"
],
"matches"
:[
"<all_urls>"
]}],
"host_permissions"
:[
"https://seller.walmart.com/*"
,
"https://advertising.walmart.com/*"
,
"https://login.account.wal-mart.com/*"
,
"https://marketplace.walmartapis.com/*"
,
"https://walmart.meinuosha.com/*"
],
"content_scripts"
:[{
"matches"
:[
"https://seller.walmart.com/*"
,
"https://advertising.walmart.com/*"
,
"https://login.account.wal-mart.com/*"
,
"https://marketplace.walmartapis.com/*"
,
"https://walmart.meinuosha.com/*"
],
"js"
:[
"./js/main.js"
]}]}
\ No newline at end of file
plugin/dist/popup.html
View file @
f63311b6
...
...
@@ -19,10 +19,10 @@
<label><input
type=
"checkbox"
value=
"Payment"
name=
"option"
checked
/>
放款表
</label>
<!-- <input type="text" name="fromDate">-<input type="text" name="toDate"> -->
</div>
<div
class=
"form-row"
>
<
!-- <
div class="form-row">
<label><input type="checkbox" value="Order" name="option" checked /> 订单表</label>
<
!-- <input type="text" name="fromDate">-<input type="text" name="toDate"> --
>
</div>
<
input type="text" name="fromDate">-<input type="text" name="toDate"
>
</div>
-->
<div
class=
"form-row"
>
<label><input
type=
"checkbox"
value=
"Advert"
name=
"option"
checked
/>
广告表
</label>
<!-- <input type="text" name="fromDate">-<input type="text" name="toDate"> -->
...
...
plugin/package.json
View file @
f63311b6
...
...
@@ -2,6 +2,7 @@
"type"
:
"module"
,
"scripts"
:
{
"build"
:
"rollup -c && chrome.exe --pack-extension=%cd%/dist --pack-extension-key=%cd%/dist.pem"
,
"build:test"
:
"set NODE_ENV=TEST && rollup -c && chrome.exe --pack-extension=%cd%/dist --pack-extension-key=%cd%/dist.test.pem"
,
"lint"
:
"eslint src/**/*.js"
},
"devDependencies"
:
{
...
...
plugin/rollup.config.js
View file @
f63311b6
...
...
@@ -13,19 +13,19 @@ const changeVersion = () => {
fs
.
writeFileSync
(
".version"
,
newVersion
);
return
newVersion
;
}
const
changeManifest
=
()
=>
{
cons
t
manifest
=
JSON
.
parse
(
fs
.
readFileSync
(
"manifest.json"
,
{
encoding
:
"utf8"
}));
manifest
.
version
=
changeVersion
();
const
changeManifest
=
(
others
=
{}
)
=>
{
le
t
manifest
=
JSON
.
parse
(
fs
.
readFileSync
(
"manifest.json"
,
{
encoding
:
"utf8"
}));
manifest
=
{...
manifest
,
version
:
changeVersion
(),
...
others
}
fs
.
writeFileSync
(
"dist/manifest.json"
,
JSON
.
stringify
(
manifest
));
}
changeManifest
();
const
inputs
=
[
"src/main.js"
,
"src/popup.js"
,
"src/background.js"
];
const
conf
=
[];
const
nodeEnv
=
process
.
env
.
NODE_ENV
||
'dev
'
;
const
nodeEnv
=
process
.
env
.
NODE_ENV
.
trim
()
||
'DEV
'
;
console
.
log
(
`NODE_ENV:
${
nodeEnv
}
`
);
nodeEnv
==
'TEST'
?
changeManifest
({
name
:
'Test'
})
:
changeManifest
();
inputs
.
forEach
(
input
=>
{
const
fn
=
Path
.
parse
(
input
).
name
;
if
(
process
.
env
.
NODE_ENV
==
'
prod
'
)
{
if
(
process
.
env
.
NODE_ENV
==
'
PROD
'
)
{
conf
.
push
({
input
,
output
:
{
...
...
plugin/src/background.js
View file @
f63311b6
...
...
@@ -17,7 +17,7 @@ const sendTabMsg = (msg, callback) => {
}
console
.
log
(
`send
${
JSON
.
stringify
(
msg
)}
to
${
tab
.
url
}
`
);
chrome
.
tabs
.
sendMessage
(
tab
.
id
,
msg
,
(
response
)
=>
{
callback
?
?
callback
(
response
);
callback
?
callback
(
response
)
:
console
.
log
(
response
);
});
});
}
...
...
@@ -63,9 +63,8 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
startTask
();
sendTabMsg
(
msg
,
sendResponse
);
}
else
if
(
msg
.
type
===
"resetTaskNum"
)
{
taskNum
=
0
;
logs
=
[];
clearInterval
(
taskInterval
);
taskInterval
=
null
,
taskNum
=
0
,
logs
=
[];
sendResponse
();
}
else
if
(
msg
.
type
===
"addLog"
)
{
logs
.
push
(
msg
.
data
);
...
...
@@ -84,8 +83,8 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
let
taskInterval
=
null
,
taskNum
=
0
,
logs
=
[];
function
startTask
()
{
// chrome.storage.local.get(['isRunning'
, 'logs'
]).then(console.log);
// chrome.storage.local.set({ isRunning: true
, logs: []
});
// chrome.storage.local.get(['isRunning']).then(console.log);
// chrome.storage.local.set({ isRunning: true });
taskNum
++
;
if
(
taskInterval
)
return
;
...
...
@@ -94,10 +93,15 @@ function startTask() {
// 推送更新
const
ackLen
=
logs
.
filter
(
x
=>
x
.
message
.
includes
(
"完成"
)).
length
;
if
(
ackLen
===
taskNum
)
{
taskNum
=
0
;
clearInterval
(
taskInterval
);
chrome
.
storage
.
local
.
set
({
isRunning
:
false
});
logs
.
push
(
"已全部完成"
);
// recycle
taskInterval
=
null
,
taskNum
=
0
;
logs
.
push
({
time
:
new
Date
().
toLocaleTimeString
(),
message
:
"已全部完成"
});
// copy logs
chrome
.
storage
.
local
.
set
({
isRunning
:
false
,
logs
});
}
chrome
.
runtime
.
sendMessage
({
type
:
'progress'
,
logs
...
...
@@ -106,24 +110,45 @@ function startTask() {
}
const
initTimedTask
=
()
=>
{
for
(
le
t
[
key
,
{
uri
,
params
}]
of
Object
.
entries
(
TABLE
))
{
le
t
plan
=
new
Plan
(
null
,
params
);
le
t
period
=
plan
.
get
()?.
period
;
for
(
cons
t
[
key
,
{
uri
,
params
}]
of
Object
.
entries
(
TABLE
))
{
cons
t
plan
=
new
Plan
(
null
,
params
);
cons
t
period
=
plan
.
get
()?.
period
;
const
when
=
plan
.
next
().
dt
.
getTime
();
chrome
.
alarms
.
create
(
key
,
{
when
});
console
.
log
(
`[timedTask]
start - uri:
${
uri
}
period:
${
period
}
next
:
${
when
}
`
);
console
.
log
(
`[timedTask]
uri:
${
uri
}
period:
${
period
}
when
:
${
when
}
`
);
}
}
chrome
.
alarms
.
onAlarm
.
addListener
((
alarm
)
=>
{
const
{
uri
,
params
}
=
TABLE
[
alarm
.
name
];
let
plan
=
new
Plan
(
null
,
params
);
let
period
=
plan
.
get
()?.
period
;
const
when
=
plan
.
next
().
dt
.
getTime
();
chrome
.
alarms
.
create
(
alarm
.
name
,
{
when
});
console
.
log
(
`[timedTask] start - uri:
${
uri
}
period:
${
period
}
next:
${
when
}
`
);
let
[
key
,
fromDate
,
toDate
,
when
]
=
alarm
.
name
.
split
(
'_'
);
if
(
!
Object
.
keys
(
TABLE
).
includes
(
key
))
return
;
const
{
uri
,
params
}
=
TABLE
[
key
];
const
plan
=
new
Plan
(
null
,
params
);
const
period
=
!
fromDate
||
!
toDate
?
plan
.
get
()?.
period
:
[
fromDate
,
toDate
];
if
(
!
when
)
{
when
=
plan
.
next
().
dt
.
getTime
();
chrome
.
alarms
.
create
(
alarm
.
name
,
{
when
});
console
.
log
(
`[timedTask] uri:
${
uri
}
period:
${
period
}
when:
${
when
}
`
);
}
startTask
();
sendTabMsg
({
type
:
"run"
,
data
:
{
uri
,
period
}
});
});
// 初始化
initTimedTask
();
// chrome.alarms.clearAll();
// eslint-disable-next-line no-unused-vars
const
getTmpClock
=
()
=>
{
const
clock
=
new
Date
();
clock
.
setHours
(
22
,
0
,
0
,
0
);
return
clock
.
getTime
();
}
globalThis
.
initTmpTimedTask
=
(
when
)
=>
{
const
period
=
[
'2025-02-01'
,
'2025-02-28'
];
for
(
const
[
key
,
{
uri
}]
of
Object
.
entries
(
TABLE
))
{
const
name
=
[
key
,
...
period
,
when
].
join
(
'_'
);
chrome
.
alarms
.
create
(
name
,
{
when
});
console
.
log
(
`[timedTask] uri:
${
uri
}
period:
${
period
}
when:
${
when
}
`
);
}
}
// globalThis.initTmpTimedTask(getTmpClock());
// initTmpTimedTask(new Date().getTime() + 10)
plugin/src/base.js
View file @
f63311b6
...
...
@@ -222,7 +222,7 @@ const jsonCallback = async function (response) {
newJson
[
"Endtime"
]
=
this
.
params
.
toDate
;
return
JSON
.
stringify
(
newJson
);
}
const
getPeriods
=
async
()
=>
{
const
getPeriods
=
async
(
options
=
{}
)
=>
{
const
url
=
"https://seller.walmart.com/aurora/v1/auroraPaymentsSettlementService/payment/settlementPeriods"
;
console
.
log
(
`GET
${
url
}
`
);
let
response
=
await
fetch
(
url
,
{
headers
});
...
...
@@ -231,7 +231,8 @@ const getPeriods = async () => {
if
(
!
response
)
{
throw
new
Error
(
`response 获取失败:
${
JSON
.
stringify
(
data
)}
`
);
}
const
periods
=
response
.
slice
(
1
,
4
);
const
{
start
=
1
,
end
=
4
}
=
options
;
const
periods
=
response
.
slice
(
start
,
end
);
console
.
log
(
`periods:
${
JSON
.
stringify
(
periods
)}
`
);
return
periods
;
}
...
...
plugin/src/main.js
View file @
f63311b6
...
...
@@ -3,6 +3,7 @@ import { createTasks } from "./base.js";
import
{
uploadFile
}
from
"./upload.js"
;
import
{
TABLE
}
from
"./conf.js"
;
// fetch("https://advertising.walmart.com/extend-sso")
async
function
webJump
()
{
if
(
location
.
hostname
===
'login.account.wal-mart.com'
)
{
document
.
querySelector
(
"button"
).
click
();
...
...
plugin/src/popup.js
View file @
f63311b6
...
...
@@ -56,16 +56,17 @@ window.onload = function () {
document
.
querySelector
(
'.modal'
).
style
.
display
=
'none'
;
});
const
btn
=
document
.
querySelector
(
".confirm"
);
chrome
.
storage
.
local
.
get
([
'isRunning'
],
({
isRunning
=
false
})
=>
{
chrome
.
storage
.
local
.
get
([
'isRunning'
,
'logs'
],
({
isRunning
=
false
,
logs
=
[]
})
=>
{
if
(
isRunning
)
{
showModal
();
disableButton
(
btn
);
}
else
{
enableButton
(
btn
);
}
showModal
();
renderLogs
(
logs
);
});
document
.
querySelector
(
'.cancel'
).
addEventListener
(
'click'
,
()
=>
{
chrome
.
storage
.
local
.
set
({
isRunning
:
false
});
chrome
.
storage
.
local
.
set
({
isRunning
:
false
,
logs
:
[]
});
chrome
.
runtime
.
sendMessage
({
type
:
"resetTaskNum"
});
enableButton
(
btn
);
});
...
...
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