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
f95f1dfb
Commit
f95f1dfb
authored
Dec 06, 2017
by
刘松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a67aecd0
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
57 additions
and
38 deletions
+57
-38
app.bundle.js
app/built/app.bundle.js
+0
-0
index.html
app/index.html
+5
-0
qd.jsx
app/jsx/setting/qd.jsx
+1
-1
schedule.jsx
app/jsx/setting/schedule.jsx
+4
-4
taopage.jsx
app/jsx/setting/taopage.jsx
+3
-3
dashboard.jsx
app/jsx/statistics/dashboard.jsx
+7
-7
gather.jsx
app/jsx/statistics/gather.jsx
+5
-5
config.default.js
config/config.default.js
+2
-2
controller.js
lib/controller.js
+17
-1
cron.js
lib/cron.js
+13
-15
No files found.
app/built/app.bundle.js
View file @
f95f1dfb
This source diff could not be displayed because it is too large. You can
view the blob
instead.
app/index.html
View file @
f95f1dfb
...
...
@@ -9,6 +9,11 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/css/antd.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/css/main.css"
>
</head>
<style
type=
"text/css"
>
body
{
font-size
:
13px
;
}
</style>
<body>
<div
id=
"main"
style=
"height: 100%;"
></div>
<a
id=
"bottom"
></a>
...
...
app/jsx/setting/qd.jsx
View file @
f95f1dfb
...
...
@@ -120,7 +120,7 @@ class Qd extends React.Component{
}
return
(
this
.
state
.
username
==
'admin'
?
<
div
>
<
Button
type=
"primary"
icon=
"
export
"
onClick=
{
this
.
createQd
.
bind
(
this
)
}
style=
{
{
margin
:
'10px 0px'
}
}
>
<
Button
type=
"primary"
icon=
"
plus
"
onClick=
{
this
.
createQd
.
bind
(
this
)
}
style=
{
{
margin
:
'10px 0px'
}
}
>
创建渠道
</
Button
>
<
Spin
spinning=
{
this
.
state
.
status
==
'pending'
}
>
...
...
app/jsx/setting/schedule.jsx
View file @
f95f1dfb
...
...
@@ -140,11 +140,11 @@ class Schedule extends React.Component{
width
:
70
,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},{
title
:
'
状态与
操作'
,
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
>,
render
:
(
text
,
schedule
)
=>
<
div
><
Switch
checked=
{
text
==
'use'
?
true
:
false
}
onChange=
{
this
.
checkUpdate
.
bind
(
this
,
schedule
)
}
style
=
{{'
margin
-
right
':
'17
px
'}}
/><
Button
onClick
=
{
this
.
tklUpdate
.
bind
(
this
,
schedule
)}
>
生成淘口令
</
Button
></
div
>,
}
];
let
data
=
[];
...
...
@@ -168,8 +168,8 @@ class Schedule extends React.Component{
}
return
(
this
.
state
.
username
==
'admin'
?
<
div
>
<
Button
type=
"primary"
icon=
"
export
"
onClick=
{
this
.
createSchedule
.
bind
(
this
)
}
style=
{
{
margin
:
'10px 0px'
}
}
>
创建
<
Button
type=
"primary"
icon=
"
plus
"
onClick=
{
this
.
createSchedule
.
bind
(
this
)
}
style=
{
{
margin
:
'10px 0px'
}
}
>
创建
计划
</
Button
>
<
Spin
spinning=
{
this
.
state
.
status
==
'pending'
}
>
<
Table
columns=
{
columns
}
dataSource
=
{
data
}
size=
"middle"
pagination=
{
this
.
state
.
pagination
}
onChange
=
{
this
.
onChange
.
bind
(
this
)}
bordered
/>
...
...
app/jsx/setting/taopage.jsx
View file @
f95f1dfb
...
...
@@ -144,15 +144,15 @@ class Agent extends React.Component{
good
:
links
[
i
].
good
,
pid
:
links
[
i
].
pid
,
target
:
links
[
i
].
target
,
qd
:(
links
[
i
].
qd
&&
links
[
i
].
qd
[
'user'
]
)
||
'暂无'
,
qd
:(
links
[
i
].
qd
)
||
'暂无'
,
img
:
links
[
i
].
pic
,
create
:
links
[
i
].
createdAt
});
}
return
(
this
.
state
.
username
==
'admin'
?
<
div
>
<
Button
type=
"primary"
icon=
"
export
"
onClick=
{
this
.
createLink
.
bind
(
this
)
}
style=
{
{
margin
:
'10px 0px'
}
}
>
创建
<
Button
type=
"primary"
icon=
"
plus
"
onClick=
{
this
.
createLink
.
bind
(
this
)
}
style=
{
{
margin
:
'10px 0px'
}
}
>
创建
推广页
</
Button
>
<
Spin
spinning=
{
this
.
state
.
status
==
'pending'
}
>
<
Table
columns=
{
columns
}
dataSource
=
{
data
}
size=
"middle"
pagination=
{
this
.
state
.
pagination
}
onChange
=
{
this
.
onChange
.
bind
(
this
)}
bordered
/>
...
...
app/jsx/statistics/dashboard.jsx
View file @
f95f1dfb
...
...
@@ -57,47 +57,47 @@ class DashBoard extends React.Component{
dataIndex
:
'date'
,
key
:
'date'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},
{
title
:
'淘口令'
,
dataIndex
:
'info'
,
key
:
'info'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},{
title
:
'请求数'
,
dataIndex
:
'times'
,
key
:
'times'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},
{
title
:
'推广计划'
,
dataIndex
:
'schedule'
,
key
:
'schedule'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},
{
title
:
'渠道'
,
dataIndex
:
'qd'
,
key
:
'qd'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
key
:
'status'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},{
title
:
'最近更新'
,
dataIndex
:
'update'
,
key
:
'update'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
}
];
...
...
app/jsx/statistics/gather.jsx
View file @
f95f1dfb
...
...
@@ -64,35 +64,35 @@ class Gather extends React.Component{
dataIndex
:
'date'
,
key
:
'date'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},
{
title
:
'渠道/分发ID'
,
dataIndex
:
'user'
,
key
:
'user'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},
{
title
:
'请求数'
,
dataIndex
:
'times'
,
key
:
'times'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},
{
title
:
'导出数'
,
dataIndex
:
'dc_times'
,
key
:
'dc_times'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
},
{
title
:
'导出率(%)'
,
dataIndex
:
'rate'
,
key
:
'rate'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
render
:
text
=>
<
span
href=
"#"
>
{
text
}
</
span
>,
}
];
...
...
config/config.default.js
View file @
f95f1dfb
module
.
exports
=
{
host
:
'0.0.0.0'
,
port
:
process
.
env
.
PORT
?
process
.
env
.
PORT
:
9401
,
mongo
:
'mongodb://user:password@10.11.3.100:1302/taoarticle'
,
//
mongo:'mongodb://127.0.0.1:27017/taoarticle',
//
mongo:'mongodb://user:password@10.11.3.100:1302/taoarticle',
mongo
:
'mongodb://127.0.0.1:27017/taoarticle'
,
taobao
:
{
host
:
"http://gw.api.taobao.com/router/rest"
,
appKey
:
"24594025"
,
//"23580470",//"23390725",
...
...
lib/controller.js
View file @
f95f1dfb
...
...
@@ -172,9 +172,25 @@ exports.getTbkls = async (req, res, next) => {
exports
.
getLinks
=
async
(
req
,
res
,
next
)
=>
{
let
{
limit
=
100
,
skip
=
0
,
sort
=
{
'updatedAt'
:
-
1
}}
=
req
.
query
;
let
options
=
{
limit
:
parseInt
(
limit
),
skip
:
parseInt
(
skip
)
*
limit
,
sort
};
let
links
=
await
Link
.
find
({},
null
,
options
)
.
populate
(
'qd'
,
'user role'
)
;
let
links
=
await
Link
.
find
({},
null
,
options
);
links
=
links
.
map
(
x
=>
{
var
d
=
x
.
toJSON
();
d
[
'createdAt'
]
=
dateFormat
(
d
[
'createdAt'
]);
return
d
;})
let
total
=
await
Link
.
count
({},
null
);
var
tasks
=
[];
links
.
forEach
(
item
=>
{
tasks
.
push
(
Schedule
.
find
({
status
:
'use'
,
links
:{
'$in'
:[
item
.
_id
]}}).
populate
(
'qd'
,
'user'
).
limit
(
1000
));
});
var
arrs
=
await
Promise
.
all
(
tasks
);
arrs
.
forEach
(
(
x
,
i
)
=>
{
if
(
x
){
links
[
i
][
'qd'
]
=
''
;
x
.
forEach
(
(
y
,
j
)
=>
{
if
(
y
){
y
=
y
.
toJSON
();
if
(
links
[
i
][
'qd'
]
+=
((
j
!==
0
?
","
:
''
)
+
(
y
.
qd
?
y
.
qd
.
user
:
''
)));
}
});
}
});
res
.
send
({
status
:
'ok'
,
result
:
links
,
pagination
:{
total
:
total
,
skip
:
skip
,
limit
:
limit
}});
}
...
...
lib/cron.js
View file @
f95f1dfb
...
...
@@ -46,7 +46,9 @@ async function tbklTask () {
//let tkls = await Kouling.find({status:'use'}).populate('link','title target').limit(1000);
// 查询进行中计划
let
schedules
=
await
Schedule
.
find
({
status
:
'use'
}).
limit
(
500
);
schedules
.
forEach
(
async
item
=>
{
if
(
schedules
.
length
==
0
)
console
.
log
(
' 更新结束 无任务'
);
else
schedules
.
forEach
(
async
item
=>
{
let
schedule
=
item
.
toJSON
().
_id
;
var
qd
=
item
.
toJSON
().
qd
;
// console.dir(schedule);
...
...
@@ -58,7 +60,6 @@ async function tbklTask () {
var
tasks_log
=
[];
logs
.
forEach
(
item
=>
{
item
=
item
.
toJSON
();
console
.
log
(
item
.
_id
);
//console.dir(item);
if
(
item
.
link
&&
item
.
link
.
title
&&
item
.
link
.
target
&&
item
.
times
>=
max
){
var
data
=
{
...
...
@@ -67,28 +68,25 @@ async function tbklTask () {
schedule
:
item
.
schedule
,
link
:
item
.
link
,
status
:
'use'
,
creater
:
qd
,
qd
:
qd
,
pic
:
item
.
link
.
pic
}
tasks_new
.
push
(
controller
.
createTbkl
(
data
));
tasks_old
.
push
(
Kouling
.
update
({
info
:
item
.
key
,
status
:{
$ne
:
'disable'
}},{
$set
:{
status
:
'disable'
}}));
tasks_old
.
push
(
Kouling
.
update
({
info
:
item
.
key
,
status
:{
$ne
:
'disable'
}},{
$set
:{
status
:
'disable'
}}
,{
multi
:
true
}
));
tasks_log
.
push
(
Log
.
update
({
_id
:
item
.
_id
},{
$set
:{
status
:
'disable'
}}));
}
});
if
(
tasks_new
.
length
&&
tasks_old
.
length
&&
tasks_log
.
length
){
Promise
.
all
(
tasks_old
).
then
(
function
(
arr
){
console
.
log
(
'删除老口令 结束 影响'
+
arr
.
length
+
'条数据'
);
});
Promise
.
all
(
tasks_log
).
then
(
function
(
arr
){
console
.
log
(
'更新log数据 影响'
+
arr
.
length
+
'条数据'
);
});
Promise
.
all
(
tasks_new
).
then
(
function
(
arr
){
console
.
log
(
'增加新口令 结束 影响'
+
arr
.
length
+
'条数据'
);
});
console
.
log
(
' 更新结束 有任务'
);
var
oldArrs
=
await
Promise
.
all
(
tasks_old
)
var
logArrs
=
await
Promise
.
all
(
tasks_log
);
var
newArrs
=
await
Promise
.
all
(
tasks_new
);
console
.
log
(
'删除老口令 结束 影响'
+
oldArrs
.
length
+
'条数据'
);
console
.
log
(
'更新log数据 影响'
+
logArrs
.
length
+
'条数据'
);
console
.
log
(
'增加新口令 结束 影响'
+
newArrs
.
length
+
'条数据'
);
console
.
log
(
' 更新计划'
+
item
.
_id
+
'结束 有任务'
);
}
else
{
console
.
log
(
' 更新结束 无任务'
);
console
.
log
(
' 更新结束
'
+
item
.
_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