Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gjjh5
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
data_server
gjjh5
Commits
ccc25099
Commit
ccc25099
authored
Nov 27, 2019
by
姜登
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
taskid
parent
fd456328
Pipeline
#17413
passed with stage
in 13 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
11 deletions
+21
-11
task.js
app/controller/task.js
+10
-10
cache.js
app/service/cache.js
+10
-0
order.js
app/service/order.js
+1
-1
No files found.
app/controller/task.js
View file @
ccc25099
...
...
@@ -4,7 +4,7 @@
* @Author: jd
* @Date: 2019-02-25 18:59:53
* @LastEditors: jd
* @LastEditTime: 2019-1
0-31 19:56:03
* @LastEditTime: 2019-1
1-27 16:35:42
*/
'use strict'
;
...
...
@@ -50,9 +50,9 @@ class TaskController extends Controller {
ctx
.
validate
(
this
.
createRule
);
const
{
scriptId
,
orderId
}
=
ctx
.
request
.
body
;
const
taskId
=
await
service
.
task
.
create
(
scriptId
);
await
service
.
order
.
update
({
orderId
,
cityId
:
scriptId
,
taskId
});
await
service
.
order
.
update
({
orderId
,
cityId
:
scriptId
,
taskId
:
String
(
taskId
)
});
await
service
.
cache
.
set
({
key
:
taskId
,
key
:
String
(
taskId
)
,
value
:
{
status
:
'init'
,
note
:
{
message
:
'init'
}
},
});
ctx
.
success
({
taskId
});
...
...
@@ -63,7 +63,7 @@ class TaskController extends Controller {
ctx
.
validate
(
this
.
submitRule
);
const
{
taskId
}
=
ctx
.
params
;
await
service
.
cache
.
set
({
key
:
taskId
,
key
:
String
(
taskId
)
,
value
:
{
status
:
'login'
,
note
:
{
message
:
'login'
}
},
});
await
service
.
task
.
submit
({
...
...
@@ -80,7 +80,7 @@ class TaskController extends Controller {
const
{
taskId
}
=
ctx
.
params
;
const
{
type
}
=
ctx
.
request
.
body
;
const
result
=
await
service
.
task
.
fetchCapture
({
taskId
,
taskId
:
String
(
taskId
)
,
type
,
});
ctx
.
success
(
result
);
...
...
@@ -90,7 +90,7 @@ class TaskController extends Controller {
const
{
ctx
,
service
}
=
this
;
ctx
.
validate
(
this
.
taskIdRule
,
ctx
.
params
);
const
{
taskId
}
=
ctx
.
params
;
const
data
=
await
service
.
cache
.
get
({
key
:
taskId
});
const
data
=
await
service
.
cache
.
get
({
key
:
String
(
taskId
)
});
ctx
.
success
(
data
);
}
...
...
@@ -100,7 +100,7 @@ class TaskController extends Controller {
ctx
.
body
=
{
code
:
'0'
,
};
const
result
=
await
service
.
task
.
fetchTask
({
taskId
});
const
result
=
await
service
.
task
.
fetchTask
({
taskId
:
String
(
taskId
)
});
let
taskNote
=
{
status
:
'init'
,
note
:
{
message
:
'init'
},
...
...
@@ -140,7 +140,7 @@ class TaskController extends Controller {
};
try
{
const
insertData
=
await
service
.
washData
.
wash
(
result
);
const
order
=
await
service
.
order
.
getOneByTaskId
(
taskId
);
const
order
=
await
service
.
order
.
getOneByTaskId
(
String
(
taskId
)
);
if
(
!
order
)
{
throw
new
Error
(
'任务已经结束了'
);
}
...
...
@@ -153,7 +153,7 @@ class TaskController extends Controller {
await
service
.
storage
.
write
(
insertData
);
await
service
.
order
.
oldgjjStatus
({
orderId
,
status
:
'success'
});
await
service
.
cache
.
set
({
key
:
taskId
,
key
:
String
(
taskId
)
,
value
:
taskNote
,
});
await
service
.
partner
.
notice
(
order
);
...
...
@@ -176,7 +176,7 @@ class TaskController extends Controller {
}
if
(
result
.
code
!==
0
)
{
await
service
.
cache
.
set
({
key
:
taskId
,
key
:
String
(
taskId
)
,
value
:
taskNote
,
});
}
...
...
app/service/cache.js
View file @
ccc25099
/*
* @Descripttion:
* @version:
* @Author: jd
* @Date: 2019-02-25 18:59:53
* @LastEditors: jd
* @LastEditTime: 2019-11-27 16:25:36
*/
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
...
...
@@ -26,6 +34,7 @@ class CacheService extends Service {
}
const
order
=
await
ctx
.
model
.
TaskStatus
.
findOne
({
attributes
:
[
'status'
],
where
:
{
taskId
:
key
},
});
if
(
order
&&
order
.
status
!==
'success'
)
{
...
...
@@ -50,6 +59,7 @@ class CacheService extends Service {
return
JSON
.
parse
(
data
);
}
const
order
=
await
ctx
.
model
.
TaskStatus
.
findOne
({
attributes
:
[
'status'
,
'note'
],
where
:
{
taskId
:
key
},
});
if
(
order
)
{
...
...
app/service/order.js
View file @
ccc25099
...
...
@@ -4,7 +4,7 @@
* @Author: jd
* @Date: 2019-02-25 18:59:53
* @LastEditors: jd
* @LastEditTime: 2019-11-
08 13:52:3
9
* @LastEditTime: 2019-11-
27 16:40:1
9
*/
'use strict'
;
...
...
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