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
f2ca4b8e
Commit
f2ca4b8e
authored
Mar 04, 2019
by
姜登
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兼容老版nofity
parent
c80f5038
Pipeline
#4003
passed with stage
in 9 minutes 20 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
5 deletions
+49
-5
order.js
app/controller/order.js
+1
-1
router.js
app/router.js
+4
-2
appKey.js
app/schedule/appKey.js
+1
-1
notifyUrl.js
app/schedule/notifyUrl.js
+41
-0
config.local.js
config/config.local.js
+1
-0
package.json
package.json
+1
-1
No files found.
app/controller/order.js
View file @
f2ca4b8e
...
...
@@ -41,7 +41,7 @@ class OrderController extends Controller {
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'
,
...
...
app/router.js
View file @
f2ca4b8e
...
...
@@ -6,7 +6,7 @@
module
.
exports
=
app
=>
{
const
{
router
,
controller
}
=
app
;
const
gjjRouter
=
app
.
router
.
namespace
(
app
.
config
.
projectRootPath
);
const
gjjRouter
=
router
.
namespace
(
app
.
config
.
projectRootPath
);
gjjRouter
.
post
(
'/tasks'
,
controller
.
task
.
create
);
// 创建任务
gjjRouter
.
get
(
'/tasks/:taskId'
,
controller
.
task
.
show
);
// 获取任务状态
gjjRouter
.
post
(
'/tasks/:taskId/submit'
,
controller
.
task
.
submit
);
// 提交任务参数
...
...
@@ -35,7 +35,9 @@ module.exports = app => {
gjjRouter
.
post
(
'/getToken'
,
controller
.
token
.
partnerCreate
);
// 合作方创建token
gjjRouter
.
post
(
'/getData'
,
controller
.
order
.
partnerShow
);
// 合作方获取订单数据
// gjjRouter.post('/getorderSn');
gjjRouter
.
post
(
'/getData'
,
controller
.
order
.
partnerShow
);
// 合作方获取订单数据
gjjRouter
.
post
(
'/getCityConfig'
,
controller
.
task
.
fetchCityConfig
)
//获取城市配置
...
...
app/schedule/appKey.js
View file @
f2ca4b8e
...
...
@@ -19,5 +19,5 @@ module.exports = {
}
catch
(
e
)
{
ctx
.
logger
.
error
(
'【schedule/flash_cus_pro】catch error:'
,
JSON
.
stringify
(
e
));
}
}
,
}
};
app/schedule/notifyUrl.js
0 → 100644
View file @
f2ca4b8e
const
Subscription
=
require
(
'egg'
).
Subscription
;
class
UpdateCache
extends
Subscription
{
// 通过 schedule 属性来设置定时任务的执行间隔等配置
static
get
schedule
()
{
return
{
interval
:
'5m'
,
// 5分钟间隔
type
:
'all'
,
// 所有woker
immediate
:
true
,
};
}
// subscribe 是真正定时任务执行时被运行的函数
async
subscribe
()
{
try
{
const
{
ctx
}
=
this
;
const
{
host
,
customerUrl
}
=
ctx
.
app
.
config
.
signatureAPI
;
const
notifyMap
=
new
Map
();
const
ret
=
await
ctx
.
curl
(
host
+
customerUrl
,
{
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
contentType
:
'json'
,
});
// ctx.logger.info(JSON.stringify(ret.data));
if
(
ret
.
data
.
code
==
'0'
)
{
ret
.
data
.
data
.
customerList
.
map
(
customer
=>
{
if
(
'callBackUrl'
in
customer
)
{
notifyMap
.
set
(
customer
.
appKey
,
{
notifyUrl
:
customer
.
callBackUrl
});
}
});
ctx
.
app
.
notifyMap
=
notifyMap
;
}
}
catch
(
e
)
{
this
.
ctx
.
logger
.
error
(
'【schedule/notifyUrlTask】catch error:'
,
JSON
.
stringify
(
e
));
}
}
}
module
.
exports
=
UpdateCache
;
\ No newline at end of file
config/config.local.js
View file @
f2ca4b8e
...
...
@@ -68,6 +68,7 @@ module.exports = () => {
signatureUrl
:
'/Access/SignValidityCheck'
,
fetchParnterUrl
:
''
,
signatureType
:
'gjj'
,
customerUrl
:
'/customer/query'
,
};
config
.
lockKeys
=
{
...
...
package.json
View file @
f2ca4b8e
...
...
@@ -33,7 +33,7 @@
"start"
:
"egg-scripts start --daemon --title=egg-server-hf_h5_server"
,
"stop"
:
"egg-scripts stop --title=egg-server-hf_h5_server"
,
"docker"
:
"eggctl start --title=egg-server-hf_h5_serverr"
,
"dev"
:
"egg-bin dev
--workers=4
"
,
"dev"
:
"egg-bin dev"
,
"debug"
:
"egg-bin debug"
,
"test"
:
"npm run lint -- --fix && npm run test-local"
,
"test-local"
:
"egg-bin test"
,
...
...
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