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
57671f14
Commit
57671f14
authored
Mar 07, 2019
by
姜登
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uuid
parent
3b31375e
Pipeline
#4126
passed with stage
in 46 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
20 deletions
+15
-20
order.js
app/controller/order.js
+10
-20
helper.js
app/extend/helper.js
+5
-0
No files found.
app/controller/order.js
View file @
57671f14
...
...
@@ -47,39 +47,29 @@ class OrderController extends Controller {
async
create
()
{
const
{
ctx
,
service
}
=
this
;
const
uuid
=
require
(
'node-uuid'
);
ctx
.
validate
(
this
.
createRule
);
let
{
appKey
,
userId
,
notifyUrl
,
backUrl
,
orderId
}
=
ctx
.
request
.
body
;
const
appKeyInfo
=
await
service
.
partner
.
fetchInfo
(
appKey
);
if
(
!
(
appKeyInfo
&&
appKeyInfo
.
valid
===
true
&&
appKeyInfo
.
enableHf
===
true
))
{
return
ctx
.
fail
(
'未开通此服务'
);
}
if
(
orderId
)
{
await
service
.
order
.
update
({
orderId
,
taskId
:
''
,
userId
:
userId
||
''
,
cityId
:
''
,
notifyUrl
:
(
ctx
.
app
.
notifyMap
.
get
(
appKey
)
&&
ctx
.
app
.
notifyMap
.
get
(
appKey
).
notifyUrl
)
||
''
,
backUrl
:
backUrl
||
''
,
appKey
:
appKey
,
status
:
'init'
,
})
ctx
.
success
({
orderId
});
return
}
orderId
=
uuid
.
v1
();
await
service
.
order
.
create
({
const
object
=
{
orderId
,
taskId
:
''
,
userId
:
userId
||
''
,
cityId
:
''
,
notifyUrl
:
notifyUrl
||
''
,
notifyUrl
:
notifyUrl
||
(
ctx
.
app
.
notifyMap
.
get
(
appKey
)
&&
ctx
.
app
.
notifyMap
.
get
(
appKey
).
notifyUrl
)
||
''
,
backUrl
:
backUrl
||
''
,
appKey
:
appKey
,
status
:
'init'
,
});
ctx
.
success
({
orderId
});
}
if
(
orderId
)
{
await
service
.
order
.
update
(
object
);
}
else
{
object
.
orderId
=
ctx
.
helper
.
getUuid
();
await
service
.
order
.
create
(
object
);
}
ctx
.
success
({
orderId
:
object
.
orderId
});
}
async
show
()
{
...
...
app/extend/helper.js
View file @
57671f14
'use strict'
;
const
querystring
=
require
(
'querystring'
);
const
crypto
=
require
(
'crypto'
);
const
uuid
=
require
(
'uuid/v1'
);
function
process
(
params
)
{
const
keys
=
Object
.
keys
(
params
)
...
...
@@ -57,3 +58,7 @@ module.exports.paramSign = function(appSecret, params) {
.
toUpperCase
();
return
signStr
;
};
module
.
exports
.
getUuid
=
function
()
{
return
uuid
();
};
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