Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sb_h5
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
sb_h5
Commits
e63c7c72
Commit
e63c7c72
authored
Apr 09, 2019
by
高诸锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【fix】
parent
b272b2fa
Pipeline
#5755
passed with stage
in 4 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
9 deletions
+75
-9
task.js
app/controller/task.js
+48
-3
router.js
app/router.js
+2
-1
scripts.js
app/service/scripts.js
+23
-4
config.prod.js
config/config.prod.js
+2
-1
No files found.
app/controller/task.js
View file @
e63c7c72
...
...
@@ -21,6 +21,30 @@ class TaskController extends Controller {
this
.
taskIdRule
=
{
taskId
:
{
type
:
'string'
,
format
:
/
\d
+/
},
};
this
.
centersInfoRule
=
{
sign
:
'string'
,
type
:
{
type
:
'enum'
,
values
:
[
'shebao'
]
},
params
:
{
type
:
'object'
,
rule
:
{
token
:
'string'
,
appKey
:
'string'
,
timestamp
:
'string'
,
},
},
};
this
.
getCityConfig
=
{
sign
:
'string'
,
type
:
{
type
:
'enum'
,
values
:
[
'shebao'
]
},
params
:
{
type
:
'object'
,
rule
:
{
token
:
'string'
,
appKey
:
'string'
,
timestamp
:
'string'
,
},
},
};
}
async
create
()
{
...
...
@@ -142,12 +166,33 @@ class TaskController extends Controller {
});
}
async
fetchC
ityConfig
()
{
async
fetchC
entersInfo
()
{
const
{
ctx
,
service
}
=
this
;
try
{
ctx
.
validate
(
this
.
c
ityList
Rule
);
ctx
.
validate
(
this
.
c
entersInfo
Rule
);
// await service.signature.signatureCheck(ctx.request.body);
const
result
=
await
service
.
scripts
.
getCityList
(
ctx
.
request
.
body
);
const
result
=
await
service
.
scripts
.
getCentersInfo
(
ctx
.
request
.
body
);
ctx
.
body
=
result
;
return
;
}
catch
(
err
)
{
ctx
.
status
=
200
;
if
(
err
.
code
===
'invalid_param'
)
{
ctx
.
body
=
{
code
:
-
1
,
msg
:
'请求参数有误'
};
return
;
}
if
(
/
[
a-zA-Z
]
+/
.
test
(
err
.
message
))
{
ctx
.
body
=
{
code
:
err
.
code
||
-
1
,
msg
:
'系统错误, 请稍后再试'
};
return
;
}
ctx
.
body
=
{
code
:
err
.
code
||
-
1
,
msg
:
err
.
message
||
''
};
}
}
async
fetchCityConfig
()
{
const
{
ctx
,
service
}
=
this
;
try
{
ctx
.
validate
(
this
.
centersInfoRule
);
const
result
=
await
service
.
scripts
.
getCityInfo
(
ctx
.
request
.
body
);
ctx
.
body
=
result
;
return
;
}
catch
(
err
)
{
...
...
app/router.js
View file @
e63c7c72
...
...
@@ -34,6 +34,7 @@ module.exports = app => {
sbRouter
.
post
(
'/getToken'
,
controller
.
partner
.
getToken
);
// 合作方获取token
sbRouter
.
post
(
'/getOrderSn'
,
controller
.
order
.
fetchOrderId
);
// 合作方获取订单号(老版H5)
sbRouter
.
post
(
'/getData'
,
controller
.
order
.
partnerShow
);
// 合作方获取订单数据
sbRouter
.
post
(
'/getCityConfig'
,
controller
.
task
.
fetchCityConfig
);
// 合作方获取城市配置
sbRouter
.
post
(
'/getCentersInfo'
,
controller
.
task
.
fetchCentersInfo
);
// 合作方获取社保中心配置
sbRouter
.
post
(
'/getCityConfig'
,
controller
.
task
.
fetchCityConfig
);
// 合作方获取社保省份和社保中心关系
sbRouter
.
get
(
'/orderData/:appKey/:orderId'
,
controller
.
order
.
orderShow
);
// 获取展示页面数据
};
app/service/scripts.js
View file @
e63c7c72
...
...
@@ -15,7 +15,8 @@ class ScriptsService extends Service {
this
.
fetchHelpUrl
=
scriptsAPI
.
fetchHelpUrl
;
this
.
redisScriptsKey
=
scriptsAPI
.
redisScriptsKey
;
this
.
redisParamsKey
=
scriptsAPI
.
redisParamsKey
;
this
.
cityListUrl
=
scriptsAPI
.
cityListUrl
;
this
.
centersInfoUrl
=
scriptsAPI
.
centersInfoUrl
;
this
.
cityInfoUrl
=
scriptsAPI
.
cityInfoUrl
;
}
async
fetchScripts
()
{
...
...
@@ -173,10 +174,28 @@ class ScriptsService extends Service {
return
scriptList
;
}
async
getC
ityList
(
params
)
{
async
getC
entersInfo
(
params
)
{
try
{
const
{
cityListUrl
,
ctx
}
=
this
;
const
result
=
await
ctx
.
curl
(
cityListUrl
,
{
const
{
centersInfoUrl
,
ctx
}
=
this
;
const
result
=
await
ctx
.
curl
(
centersInfoUrl
,
{
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
contentType
:
'json'
,
method
:
'POST'
,
data
:
params
,
});
return
result
.
data
;
}
catch
(
err
)
{
this
.
ctx
.
logger
.
error
(
err
);
return
{
code
:
-
1
,
msg
:
'系统错误,请稍后重试'
};
}
}
async
getCityInfo
(
params
)
{
try
{
const
{
cityInfoUrl
,
ctx
}
=
this
;
const
result
=
await
ctx
.
curl
(
cityInfoUrl
,
{
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
...
...
config/config.prod.js
View file @
e63c7c72
...
...
@@ -31,7 +31,8 @@ module.exports = () => {
fetchHelpUrl
:
'/chaos/hf/help'
,
fetchNoticeUrl
:
'/chaos/hf/notice'
,
fetchHubSeriptsUrl
:
'/chaos/hf/hubs'
,
cityListUrl
:
''
,
centersInfoUrl
:
'https://t.51gjj.com/shebao/centersInfo'
,
cityInfoUrl
:
'https://t.51gjj.com/shebao/cityConfig'
,
fetchScriptByCityNameUrl
:
'/chaos/hf/city_scripts'
,
redisScriptsKey
:
'DATA_SERVER_SHEBAO.SCRIPTS'
,
redisParamsKey
:
'DATA_SERVER_SHEBAO.PARAMS'
,
...
...
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