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
ffc11e89
Commit
ffc11e89
authored
Feb 26, 2019
by
姜登
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gjj
parent
ecd65470
Pipeline
#3889
passed with stage
in 2 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
26 deletions
+68
-26
task.js
app/controller/task.js
+3
-2
taskStatus.js
app/model/taskStatus.js
+25
-6
partner.js
app/service/partner.js
+40
-18
No files found.
app/controller/task.js
View file @
ffc11e89
...
@@ -63,7 +63,7 @@ class TaskController extends Controller {
...
@@ -63,7 +63,7 @@ class TaskController extends Controller {
key
:
taskId
,
key
:
taskId
,
value
:
{
status
:
'init'
,
note
:
{
message
:
'init'
}
},
value
:
{
status
:
'init'
,
note
:
{
message
:
'init'
}
},
});
});
ctx
.
success
({
taskId
});
ctx
.
success
({
taskId
});
}
}
async
fetchCapture
()
{
async
fetchCapture
()
{
...
@@ -108,7 +108,7 @@ class TaskController extends Controller {
...
@@ -108,7 +108,7 @@ class TaskController extends Controller {
case
1
:
case
1
:
taskNote
=
{
taskNote
=
{
status
:
'next'
,
status
:
'next'
,
note
:
{
message
:
'waiting
'
,
nextStep
:
result
.
data
.
loginParam
},
note
:
{
message
:
'waiting
'
,
nextStep
:
result
.
data
},
};
};
break
;
break
;
case
110
:
case
110
:
...
@@ -135,6 +135,7 @@ class TaskController extends Controller {
...
@@ -135,6 +135,7 @@ class TaskController extends Controller {
insertData
.
appKey
=
appKey
;
insertData
.
appKey
=
appKey
;
delete
insertData
.
code
;
delete
insertData
.
code
;
await
service
.
storage
.
write
(
insertData
);
await
service
.
storage
.
write
(
insertData
);
await
service
.
partner
.
notice
(
order
);
}
catch
(
err
)
{
}
catch
(
err
)
{
ctx
.
logger
.
error
(
'handleCallback'
,
err
,
result
);
ctx
.
logger
.
error
(
'handleCallback'
,
err
,
result
);
taskNote
=
{
taskNote
=
{
...
...
app/model/taskStatus.js
View file @
ffc11e89
...
@@ -4,8 +4,8 @@ module.exports = app => {
...
@@ -4,8 +4,8 @@ module.exports = app => {
const
{
DataTypes
}
=
app
.
Sequelize
;
const
{
DataTypes
}
=
app
.
Sequelize
;
const
taskStatsu
=
app
.
model
.
define
(
'taskStatsu'
,
{
const
taskStatsu
=
app
.
model
.
define
(
'taskStatsu'
,
{
id
:{
id
:
{
type
:
DataTypes
.
INTEGER
,
type
:
DataTypes
.
INTEGER
,
allowNull
:
false
,
allowNull
:
false
,
autoIncrement
:
true
,
autoIncrement
:
true
,
primaryKey
:
true
,
primaryKey
:
true
,
...
@@ -87,10 +87,29 @@ module.exports = app => {
...
@@ -87,10 +87,29 @@ module.exports = app => {
primaryKey
:
true
,
primaryKey
:
true
,
field
:
'updateDate'
,
field
:
'updateDate'
,
},
},
},
{
text1
:
{
tableName
:
'gjj_status'
,
type
:
DataTypes
.
STRING
(
255
),
timestamps
:
false
,
allowNull
:
true
,
});
defaultValue
:
''
,
field
:
'text1'
,
},
text2
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'text2'
,
},
notice
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'notice'
,
},
},
{
tableName
:
'gjj_status'
,
timestamps
:
false
,
});
return
taskStatsu
;
return
taskStatsu
;
};
};
app/service/partner.js
View file @
ffc11e89
...
@@ -30,7 +30,7 @@ class PartnerService extends Service {
...
@@ -30,7 +30,7 @@ class PartnerService extends Service {
});
});
ctx
.
logger
.
info
(
`【Partner】 fetchTheme
${
host
+
fetchTheme
}
/
${
appKey
}
`
,
ret
.
data
);
ctx
.
logger
.
info
(
`【Partner】 fetchTheme
${
host
+
fetchTheme
}
/
${
appKey
}
`
,
ret
.
data
);
if
(
ret
.
status
===
200
&&
ret
.
data
&&
ret
.
data
.
appKey
===
appKey
)
{
if
(
ret
.
status
===
200
&&
ret
.
data
&&
ret
.
data
.
appKey
===
appKey
)
{
await
this
.
app
.
cache
.
set
(
redisThemePrefix
+
appKey
,
JSON
.
stringify
(
ret
.
data
),
72
00
);
await
this
.
app
.
cache
.
set
(
redisThemePrefix
+
appKey
,
JSON
.
stringify
(
ret
.
data
),
3
00
);
}
}
return
ret
.
data
;
return
ret
.
data
;
}
}
...
@@ -58,33 +58,55 @@ class PartnerService extends Service {
...
@@ -58,33 +58,55 @@ class PartnerService extends Service {
});
});
ctx
.
logger
.
info
(
`【Partner】 fetchTheme
${
url
}
`
,
ret
.
data
);
ctx
.
logger
.
info
(
`【Partner】 fetchTheme
${
url
}
`
,
ret
.
data
);
if
(
ret
.
status
===
200
&&
ret
.
data
&&
ret
.
data
.
id
===
appKey
)
{
if
(
ret
.
status
===
200
&&
ret
.
data
&&
ret
.
data
.
id
===
appKey
)
{
await
this
.
app
.
cache
.
set
(
redisScriptsPrefix
+
appKey
,
JSON
.
stringify
(
ret
.
data
),
72
00
);
await
this
.
app
.
cache
.
set
(
redisScriptsPrefix
+
appKey
,
JSON
.
stringify
(
ret
.
data
),
3
00
);
}
}
return
ret
.
data
;
return
ret
.
data
;
}
}
async
fetchAgreements
(
id
)
{
async
fetchAgreements
(
id
)
{
const
{
ctx
,
partnerAPI
:
{
fetchAgreements
,
host
,
redisAgreementsPrefix
}
}
=
this
;
const
{
ctx
,
partnerAPI
:
{
fetchAgreements
,
host
,
redisAgreementsPrefix
}
}
=
this
;
const
data
=
await
this
.
app
.
cache
.
get
(
redisAgreementsPrefix
+
id
);
const
data
=
await
this
.
app
.
cache
.
get
(
redisAgreementsPrefix
+
id
);
if
(
data
)
{
if
(
data
)
{
try
{
try
{
return
JSON
.
parse
(
data
);
return
JSON
.
parse
(
data
);
}
catch
(
err
)
{
}
catch
(
err
)
{
ctx
.
logger
.
error
(
'【Partner】 fetchAgreements'
,
redisAgreementsPrefix
+
id
,
'result:'
,
data
,
err
);
ctx
.
logger
.
error
(
'【Partner】 fetchAgreements'
,
redisAgreementsPrefix
+
id
,
'result:'
,
data
,
err
);
await
this
.
app
.
cache
.
del
(
redisAgreementsPrefix
+
id
);
await
this
.
app
.
cache
.
del
(
redisAgreementsPrefix
+
id
);
}
}
}
const
url
=
`
${
host
+
fetchAgreements
}
/
${
id
}
`
;
}
const
ret
=
await
ctx
.
curl
(
url
,
{
const
url
=
`
${
host
+
fetchAgreements
}
/
${
id
}
`
;
const
ret
=
await
ctx
.
curl
(
url
,
{
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
method
:
'GET'
,
});
ctx
.
logger
.
info
(
`【Partner】 fetchAgreements
${
url
}
`
,
ret
.
data
);
if
(
ret
.
status
===
200
&&
ret
.
data
&&
ret
.
data
.
id
===
id
)
{
await
this
.
app
.
cache
.
set
(
redisScriptsPrefix
+
appKey
,
JSON
.
stringify
(
ret
.
data
),
300
);
}
return
ret
.
data
;
}
async
notice
(
order
)
{
const
{
ctx
}
=
this
;
const
{
orderId
,
callbackUrl
,
userId
,
notice
}
=
order
;
if
(
callbackUrl
&&
notice
!==
'1'
)
{
const
ret
=
await
ctx
.
curl
(
callbackUrl
,
{
charset
:
'utf-8'
,
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
contentType
:
'json'
,
method
:
'GET'
,
method
:
'POST'
,
});
data
:
{
ctx
.
logger
.
info
(
`【Partner】 fetchAgreements
${
url
}
`
,
ret
.
data
);
orderId
,
if
(
ret
.
status
===
200
&&
ret
.
data
&&
ret
.
data
.
id
===
id
)
{
userId
,
await
this
.
app
.
cache
.
set
(
redisScriptsPrefix
+
appKey
,
JSON
.
stringify
(
ret
.
data
),
7200
);
status
:
'success'
},
}
}
return
ret
.
data
;
)
ctx
.
logger
.
info
(
`【Partner】 notice
${
callbackUrl
}
`
,
'orderId:'
,
orderId
,
'result:'
,
JSON
.
stringify
(
ret
.
data
));
await
order
.
update
({
notice
:
'1'
});
}
return
;
}
}
}
}
...
...
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