Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
kouling-admin
Project
Project
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
刘松
kouling-admin
Commits
36437b19
Commit
36437b19
authored
Dec 05, 2017
by
刘松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
707050df
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
21 deletions
+43
-21
app.bundle.js
app/built/app.bundle.js
+0
-0
login.jsx
app/jsx/login.jsx
+1
-1
main.jsx
app/jsx/main.jsx
+3
-3
schedule.jsx
app/jsx/setting/schedule.jsx
+9
-7
gather.jsx
app/jsx/statistics/gather.jsx
+5
-5
tao-data.js
db/mongo/tao-data.js
+8
-1
controller.js
lib/controller.js
+1
-1
cron_gather.js
lib/cron_gather.js
+16
-3
No files found.
app/built/app.bundle.js
View file @
36437b19
This source diff could not be displayed because it is too large. You can
view the blob
instead.
app/jsx/login.jsx
View file @
36437b19
...
...
@@ -39,7 +39,7 @@ class Login extends React.Component{
<
div
className
=
'
login
-
wrapper
'
>
<
Card
className
=
{
'
m
'
}
title
=
{
'
淘口令
后台'
}
title
=
{
'
媒体
后台'
}
extra
=
{
<
span
>
登陆
</
span
>
}
style =
{
{
width
:
400
,
margin
:
'auto'
}
}
>
...
...
app/jsx/main.jsx
View file @
36437b19
...
...
@@ -9,7 +9,7 @@ const MenuItemGroup = Menu.ItemGroup;
const
ButtonGroup
=
Button
.
Group
;
const
{
Header
,
Footer
,
Sider
,
Content
}
=
Layout
;
const
mapLocations
=
[
'/manage
'
,
'/manage/statistics
'
,
'/manage/setting'
,
'/manage/tkl'
,
'/manage/schedule'
]
const
mapLocations
=
[
'/manage
/statistics'
,
'/manage
'
,
'/manage/setting'
,
'/manage/tkl'
,
'/manage/schedule'
]
class
Main
extends
React
.
Component
{
constructor
(
props
){
...
...
@@ -53,7 +53,7 @@ class Main extends React.Component{
<
Layout
className=
"layout"
>
<
Header
>
<
div
className=
"logo"
>
<
span
>
淘口令
</
span
>
<
span
>
媒体后台
</
span
>
</
div
>
<
Menu
theme=
"dark"
...
...
@@ -75,7 +75,7 @@ class Main extends React.Component{
<
Content
style=
{
{
padding
:
'0 50px'
}
}
>
<
Breadcrumb
style=
{
{
margin
:
'12px 0'
}
}
>
<
Breadcrumb
.
Item
>
{
this
.
map
[
this
.
props
.
menu
.
currentPage
]
}
</
Breadcrumb
.
Item
>
<
Breadcrumb
.
Item
>
{
this
.
props
.
menu
.
currentPage
==
'0'
?
'数据统计'
:
(
this
.
props
.
menu
.
currentPage
==
'
1
'
?
'汇总数据'
:
"配置"
)
}
</
Breadcrumb
.
Item
>
<
Breadcrumb
.
Item
>
{
this
.
props
.
menu
.
currentPage
==
'0'
?
'数据统计'
:
(
this
.
props
.
menu
.
currentPage
==
'
0
'
?
'汇总数据'
:
"配置"
)
}
</
Breadcrumb
.
Item
>
</
Breadcrumb
>
<
div
style=
{
{
background
:
'#fff'
,
padding
:
24
,
minHeight
:
280
}
}
>
{
this
.
props
.
children
...
...
app/jsx/setting/schedule.jsx
View file @
36437b19
...
...
@@ -69,6 +69,9 @@ class Schedule extends React.Component{
schedules
[
schedule
[
'key'
]][
'status'
]
=
(
schedule
[
'status'
]
==
'use'
?
'disable'
:
'use'
);
this
.
setState
({
schedules
:
schedules
});
}
tklUpdate
(){
}
exportData
(){
//json2xlsx(data,{sheetName:"基础数据", filename : '基础数据'+moment().format('YYYYMMDD')+'.xlsx'});
...
...
@@ -98,13 +101,6 @@ class Schedule extends React.Component{
width
:
100
,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
key
:
'status'
,
width
:
30
,
render
:
(
text
,
schedule
)
=>
<
Switch
checked=
{
text
==
'use'
?
true
:
false
}
onChange=
{
this
.
checkUpdate
.
bind
(
this
,
schedule
)
}
/>,
},
{
title
:
'可用淘口令'
,
dataIndex
:
'tkls'
,
...
...
@@ -125,6 +121,12 @@ class Schedule extends React.Component{
key
:
'create'
,
width
:
70
,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},{
title
:
'状态与操作'
,
dataIndex
:
'status'
,
key
:
'status'
,
width
:
30
,
render
:
(
text
,
schedule
)
=>
<
div
><
Switch
checked=
{
text
==
'use'
?
true
:
false
}
onChange=
{
this
.
checkUpdate
.
bind
(
this
,
schedule
)
}
/><
Button
onClick
=
{
this
.
tklUpdate
.
bind
(
this
,
schedule
)}
>
生成淘口令
</
Button
></
div
>,
}
];
let
data
=
[];
...
...
app/jsx/statistics/gather.jsx
View file @
36437b19
...
...
@@ -75,7 +75,7 @@ class Gather extends React.Component{
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
},
{
title
:
'导出率'
,
title
:
'导出率
(%)
'
,
dataIndex
:
'rate'
,
key
:
'rate'
,
width
:
100
,
...
...
@@ -96,10 +96,10 @@ class Gather extends React.Component{
data
.
push
({
key
:
i
,
date
:
qdgathers
[
i
].
date
,
user
:(
qdgathers
[
i
].
qd
&&
qdgathers
[
i
].
qd
.
user
)
+
'/ '
+
(
qdgathers
[
i
].
qd
&&
qdgathers
[
i
].
qd
.
_id
),
times
:
qdgathers
[
i
].
times
,
dc_times
:
qdgathers
[
i
].
status
==
'disable'
?
'已归档'
:
'--'
,
rate
:
(
qdgathers
[
i
].
schedule
)
||
'--'
user
:(
qdgathers
[
i
].
qd
&&
qdgathers
[
i
].
qd
.
user
)
+
'
/ '
+
(
qdgathers
[
i
].
qd
&&
qdgathers
[
i
].
qd
.
_id
),
times
:
qdgathers
[
i
].
times
||
0
,
dc_times
:
qdgathers
[
i
].
dc_times
||
0
,
rate
:
qdgathers
[
i
].
dc_times
/
qdgathers
[
i
].
times
?
((
qdgathers
[
i
].
dc_times
/
qdgathers
[
i
].
times
).
toFixed
(
6
)
*
100
).
toFixed
(
3
)
:
0
});
}
...
...
db/mongo/tao-data.js
View file @
36437b19
...
...
@@ -11,10 +11,17 @@ const schema = mongoose.Schema({
required
:
true
,
ref
:
'tao-agent'
},
schedules
:[],
schedules
:{
type
:
Array
,
required
:
true
},
times
:{
type
:
Number
,
required
:
true
},
dc_times
:{
type
:
Number
,
required
:
false
}
},
{
timestamps
:
true
...
...
lib/controller.js
View file @
36437b19
...
...
@@ -132,7 +132,7 @@ exports.createLink = async (req, res, next) => {
let
goodInfo
=
await
tao
.
getGood
(
goodQuery
[
'id'
]);
let
title
=
goodInfo
[
'title'
];
let
pic
=
goodInfo
[
'pict_url'
]
||
''
;
let
target
=
'https://uland.taobao.com/coupon/edetail?activityId='
+
quanQuery
[
'activityId'
]
+
'&itemId='
+
goodQuery
[
'id'
]
+
'&pid='
+
pid
+
'&dx=1'
;
let
target
=
'https://uland.taobao.com/coupon/edetail?activityId='
+
quanQuery
[
'activityId'
]
+
'&itemId='
+
goodQuery
[
'id'
]
+
'&pid='
+
pid
+
'&dx=1
&src=tkm_tkmwz
'
;
tao
.
saveLink
({
name
,
quan
,
pid
,
good
,
title
,
pic
,
target
},
function
(
e
,
result
){
if
(
e
)
throw
e
;
res
.
send
({
result
:
'ok'
,
result
:
result
})
...
...
lib/cron_gather.js
View file @
36437b19
...
...
@@ -41,8 +41,8 @@ async function sendMail(email,body) {
async
function
tbklTask
()
{
console
.
log
(
'定时更新开始 =====> '
);
try
{
var
date
=
moment
().
add
(
-
3
,
'days'
).
format
(
'YYYYMMDD'
);
var
logDate
=
moment
().
add
(
-
3
,
'days'
).
toDate
();
var
date
=
moment
().
add
(
-
1
,
'days'
).
format
(
'YYYYMMDD'
);
var
logDate
=
moment
().
add
(
-
1
,
'days'
).
toDate
();
var
list
=
await
Log
.
aggregate
([
{
$match
:{
...
...
@@ -64,19 +64,32 @@ async function tbklTask () {
//schedule = schedule.toJSON();
var
schedule
=
_tasks
.
push
(
Schedule
.
findById
(
item
.
_id
));
sum2schedule
[
item
.
_id
]
=
item
.
sum
;
console
.
dir
(
item
)
});
Promise
.
all
(
_tasks
).
then
(
function
(
arr
){
arr
.
forEach
(
function
(
item
){
if
(
item
){
var
schedule
=
item
.
toJSON
();
console
.
dir
(
'schedule in in '
)
if
(
qd2schedule
[
schedule
.
qd
]
&&
qd2schedule
[
schedule
.
qd
].
length
)
qd2schedule
[
schedule
.
qd
]
=
qd2schedule
[
schedule
.
qd
].
concat
({
schedule
:
item
.
_id
,
times
:
sum2schedule
[
schedule
.
_id
]})
else
qd2schedule
[
schedule
.
qd
]
=
[{
schedule
:
item
.
_id
,
times
:
sum2schedule
[
schedule
.
_id
]}];
}
else
{
console
.
dir
(
item
);
}
});
console
.
dir
(
qd2schedule
);
var
tasks
=
[];
for
(
var
k
in
qd2schedule
){
var
qd
=
k
;
var
total
=
qd2schedule
[
k
].
reduce
(
function
(
a
,
b
){
return
a
.
times
+
b
.
times
},{
times
:
0
});
var
total
=
0
;
for
(
var
j
in
qd2schedule
[
k
]){
total
+=
qd2schedule
[
k
][
j
].
times
;
}
//var total = qd2schedule[k].reduce(function(a,b){ return a.times + b.times},{times:0});
//console.dir({qd:qd,schedules:qd2schedule[k],date:logDate,times:total});
var
data
=
new
Data
({
qd
:
qd
,
schedules
:
qd2schedule
[
k
],
date
:
logDate
,
times
:
total
});
tasks
.
push
(
data
.
save
());
}
...
...
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