Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yysh5
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
yysh5
Commits
d5263e10
Commit
d5263e10
authored
Apr 18, 2019
by
姜登
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
yys
parent
e7a260ca
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
20 deletions
+16
-20
order.js
app/controller/order.js
+6
-5
task.js
app/controller/task.js
+2
-2
taskStatus.js
app/model/taskStatus.js
+6
-0
washData.js
app/service/washData.js
+2
-13
No files found.
app/controller/order.js
View file @
d5263e10
...
...
@@ -61,11 +61,11 @@ class OrderController extends Controller {
async
create
()
{
const
{
ctx
,
service
}
=
this
;
ctx
.
validate
(
this
.
createRule
);
const
{
appKey
,
userId
,
notifyUrl
,
backUrl
,
orderId
,
phone
}
=
ctx
.
request
.
body
;
//
const appKeyInfo = await service.partner.fetchInfo(appKey);
//
if (!(appKeyInfo && appKeyInfo.valid === true && appKeyInfo.enableYys === true)) {
//
return ctx.fail('未开通此服务');
//
}
const
{
appKey
,
userId
,
notifyUrl
,
backUrl
,
orderId
,
phone
,
netMark
}
=
ctx
.
request
.
body
;
const
appKeyInfo
=
await
service
.
partner
.
fetchInfo
(
appKey
);
if
(
!
(
appKeyInfo
&&
appKeyInfo
.
valid
===
true
&&
appKeyInfo
.
enableYys
===
true
))
{
return
ctx
.
fail
(
'未开通此服务'
);
}
const
areaInfo
=
await
service
.
task
.
phoneArea
(
phone
);
const
object
=
{
orderId
,
...
...
@@ -77,6 +77,7 @@ class OrderController extends Controller {
phone
,
city
:
areaInfo
.
province
,
operator
:
areaInfo
.
operator
,
netMark
,
};
if
(
orderId
)
{
await
service
.
order
.
update
(
object
);
...
...
app/controller/task.js
View file @
d5263e10
...
...
@@ -141,8 +141,8 @@ class TaskController extends Controller {
if
(
!
order
)
{
throw
new
Error
(
'任务不存在'
);
}
const
{
orderId
}
=
order
;
await
service
.
washData
.
wash
(
result
,
orderId
);
const
{
orderId
,
netMark
}
=
order
;
await
service
.
washData
.
wash
(
result
,
orderId
,
netMark
);
await
service
.
cache
.
set
({
key
:
taskId
,
value
:
taskNote
,
...
...
app/model/taskStatus.js
View file @
d5263e10
...
...
@@ -66,6 +66,12 @@ module.exports = app => {
allowNull
:
true
,
field
:
'status'
,
},
netMark
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
defaultValue
:
0
,
field
:
'netMark'
,
},
note
:
{
type
:
DataTypes
.
STRING
(
8000
),
allowNull
:
true
,
...
...
app/service/washData.js
View file @
d5263e10
...
...
@@ -9,13 +9,13 @@ class WashDataService extends Service {
this
.
washUrl
=
config
.
washAPI
.
host
+
config
.
washAPI
.
washUrl
;
this
.
callbackUrl
=
config
.
dataCallbackUrl
;
}
async
wash
(
data
,
orderId
)
{
async
wash
(
data
,
orderId
,
netMark
=
0
)
{
const
{
app
,
washUrl
,
ctx
}
=
this
;
const
rawdata
=
{
data
,
callbackUrl
:
this
.
callbackUrl
,
orderId
,
netMark
:
0
,
netMark
,
};
const
washData
=
await
app
.
curl
(
washUrl
,
{
...
...
@@ -32,17 +32,6 @@ class WashDataService extends Service {
}
return
washData
.
data
;
}
_switchData
(
data
)
{
const
tmp
=
data
.
data
;
const
bar
=
{};
bar
.
taskId
=
tmp
.
taskId
;
bar
.
cityId
=
tmp
.
cityId
;
bar
.
data
=
JSON
.
parse
(
tmp
.
data
);
bar
.
orderID
=
'ttt'
;
bar
.
appKey
=
''
;
return
bar
;
}
}
module
.
exports
=
WashDataService
;
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