Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
DataCenter_Core2.1_20190520
Commits
9e5181d5
Commit
9e5181d5
authored
Jun 09, 2022
by
jianshuqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增功能:新开了3个站点shopify的广告费
parent
6e5a61a6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
28 deletions
+36
-28
Services.cs
Bailun.DC.SyncShopifyFee/Services.cs
+36
-28
No files found.
Bailun.DC.SyncShopifyFee/Services.cs
View file @
9e5181d5
...
...
@@ -13,7 +13,12 @@ namespace Bailun.DC.SyncShopifyFee
public
class
Services
:
BackgroundService
{
string
url
=
"http://scrm.bailuntec.com/ScrmApi/api/ApiGetAdFeeLog"
;
//?btime=2021-10-01&etime=2021-10-03&page=1&rows=100
IList
<
string
>
listUrl
=
new
string
[]
{
"http://scrm.bailuntec.com/ScrmApi/api/ApiGetAdFeeLog"
,
//?btime=2021-10-01&etime=2021-10-03&page=1&rows=100
"http://us.btm.bailuntec.com/ScrmApi/api/ApiGetAdFeeLog"
,
//?btime=2021-10-01&etime=2021-10-03&page=1&rows=100
"http://us2.btm.bailuntec.com/ScrmApi/api/ApiGetAdFeeLog"
,
//?btime=2021-10-01&etime=2021-10-03&page=1&rows=100
"http://au.btm.bailuntec.com/ScrmApi/api/ApiGetAdFeeLog"
//?btime=2021-10-01&etime=2021-10-03&page=1&rows=100
};
private
Timer
_timer
;
...
...
@@ -46,40 +51,43 @@ namespace Bailun.DC.SyncShopifyFee
public
void
Init
(
DateTime
?
btime
=
null
,
DateTime
?
etime
=
null
)
{
var
page
=
1
;
var
pagesize
=
1000
;
var
count
=
0
;
if
(!
btime
.
HasValue
)
{
btime
=
DateTime
.
Now
.
AddHours
(-
2
);
}
if
(!
etime
.
HasValue
)
foreach
(
string
url
in
listUrl
)
{
etime
=
DateTime
.
Today
.
AddDays
(
1
);
}
var
page
=
1
;
var
pagesize
=
1000
;
var
count
=
0
;
while
(
page
==
1
||
(
page
>
1
&&
count
>
0
))
{
try
if
(!
btime
.
HasValue
)
{
btime
=
DateTime
.
Now
.
AddHours
(-
2
);
}
if
(!
etime
.
HasValue
)
{
var
result
=
Common
.
HttpHelper
.
NetHelper
.
Request
(
$"
{
url
}
?btime=
{
btime
.
Value
.
ToString
(
"yyyy-MM-dd HH:00:00"
)}
&etime=
{
etime
.
Value
.
ToString
(
"yyyy-MM-dd"
)}
&page=
{
page
}
&rows=
{
pagesize
}
"
);
if
(!
string
.
IsNullOrEmpty
(
result
))
etime
=
DateTime
.
Today
.
AddDays
(
1
);
}
while
(
page
==
1
||
(
page
>
1
&&
count
>
0
))
{
try
{
var
json
=
JsonConvert
.
DeserializeObject
<
response_result
>(
result
);
count
=
json
.
data
.
Count
;
if
(
json
.
success
&&
count
>
0
)
var
result
=
Common
.
HttpHelper
.
NetHelper
.
Request
(
$"
{
url
}
?btime=
{
btime
.
Value
.
ToString
(
"yyyy-MM-dd HH:00:00"
)}
&etime=
{
etime
.
Value
.
ToString
(
"yyyy-MM-dd"
)}
&page=
{
page
}
&rows=
{
pagesize
}
"
);
if
(!
string
.
IsNullOrEmpty
(
result
))
{
//保存数据
Save
(
json
.
data
);
var
json
=
JsonConvert
.
DeserializeObject
<
response_result
>(
result
);
count
=
json
.
data
.
Count
;
if
(
json
.
success
&&
count
>
0
)
{
//保存数据
Save
(
json
.
data
);
}
page
++;
}
page
++;
}
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
Message
);
Thread
.
Sleep
(
60
*
1000
);
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
Message
);
Thread
.
Sleep
(
60
*
1000
);
}
}
}
}
...
...
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