Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
98e3568a
Commit
98e3568a
authored
Jun 07, 2020
by
xsren@gongsibao.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
起名寶
parent
4500ed10
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
157 additions
and
1 deletions
+157
-1
center-channel/app/base/api/impl/nmaction/name.js
+128
-0
center-channel/app/config/routes/api.js
+29
-1
No files found.
center-channel/app/base/api/impl/nmaction/name.js
0 → 100644
View file @
98e3568a
var
WEBBase
=
require
(
"../../web.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
NameAPI
extends
WEBBase
{
constructor
()
{
super
();
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
this
.
centerOrderUrl
=
settings
.
centerOrderUrl
();
this
.
centerCacheUrl
=
"http://123.57.217.203:30005/"
;
}
/**
* 接口跳转-POST请求
* action_type 执行的类型
*/
async
springBoard
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
null
;
pobj
.
requestId
=
req
.
requestId
;
switch
(
action_type
)
{
case
"getCache"
:
//行业类别
opResult
=
await
this
.
getCache
();
break
;
case
"getPreference"
:
//偏好
opResult
=
await
this
.
getPreference
();
break
;
case
"createName"
:
//起名
opResult
=
await
this
.
addOrderDelivery
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
/**
* 获取行业类别数据 後期可提出為一個service文件
* @returns {Promise<{}>}
*/
async
getCache
(){
let
cacheResult
=
{};
cacheResult
.
cache
=
cacheJson
return
cacheResult
;
}
/**
* 获取偏好信息 後期可提出為一個service文件
* @returns {Promise<{}>}
*/
async
getPreference
(){
let
preResult
=
{};
const
key
=
'qmbpreference'
;
let
result
=
await
this
.
redisClient
.
get
(
key
)
if
(
result
){
preResult
.
preference
=
JSON
.
parse
(
result
);
return
preResult
;
}
else
{
const
data
=
await
this
.
restPostUrl
({},
this
.
centerCacheUrl
+
"preference_select"
);
if
(
data
.
code
==
200
){
await
this
.
redisClient
.
set
(
key
,
JSON
.
stringify
(
data
.
data
),
2
*
3600
)
preResult
.
preference
=
data
.
data
return
preResult
;
}
}
}
/**
* 获取起名数据并添加到c_order_delivery 后期可提取为一個service文件
* @param pobj
* @param actionBody
* @returns {Promise<{msg: string, data: (*|null), bizmsg: *, status: number}|{msg: *, data: *, status: *}|{msg: *, data: (*|null), status: number}>}
*/
async
addOrderDelivery
(
pobj
,
actionBody
){
var
nameResult
=
{};
if
(
!
actionBody
.
orderId
)
{
return
system
.
getResult
(
null
,
"orderId参数不能为空"
);
}
if
(
!
actionBody
.
province
)
{
return
system
.
getResult
(
null
,
"province参数不能为空"
);
}
if
(
!
actionBody
.
city
)
{
return
system
.
getResult
(
null
,
"city:参数不能为空"
);
}
if
(
!
actionBody
.
county
)
{
return
system
.
getResult
(
null
,
"county参数不能为空"
);
}
if
(
!
actionBody
.
pcate
)
{
return
system
.
getResult
(
null
,
"pcate参数不能为空"
);
}
if
(
!
actionBody
.
cate
)
{
return
system
.
getResult
(
null
,
"cate参数不能为空"
);
}
if
(
!
actionBody
.
preference
)
{
return
system
.
getResult
(
null
,
"preference参数不能为空"
);
}
//获取取名结果
nameResult
=
await
this
.
restPostUrl
(
actionBody
,
this
.
centerCacheUrl
+
"treasure_name"
);
if
(
nameResult
.
code
==
200
){
pobj
.
actionType
=
'addOrderDelivery'
pobj
.
actionBody
=
nameResult
.
data
;
//取名结果存储
var
reut
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerOrderUrl
+
"action/nameOrder/springBoard"
);
if
(
reut
.
status
===
0
){
return
system
.
getResultSuccess
();
}
else
{
return
system
.
getResultFail
(
-
1
,
reut
.
msg
)
}
}
else
{
await
this
.
addOrderDelivery
(
pobj
);
}
}
}
const
cacheJson
=
{
"科技类"
:
[
"网络科技"
,
"电子商务"
,
"信息技术"
,
"游戏"
,
"电子"
,
"软件"
,
"新材料"
,
"生物科技"
,
"教育科技"
,
"环保科技"
,
"信息科技"
],
"许可类"
:
[
"投资管理"
,
"金融"
,
"资产"
,
"商业保理"
,
"融资租赁"
,
"医疗器械"
,
"人力资源"
,
"食品"
,
"劳务派遣"
],
"服务类"
:
[
"广告"
,
"文化传媒"
,
"建筑装潢"
,
"设计"
,
"美容美发"
,
"房地产中介"
,
"物业管理"
,
"商务咨询"
,
"企业管理"
],
"其他"
:
[
"贸易"
,
"实业"
,
"制造"
,
"服饰"
,
"化妆品"
,
"工程"
,
"农业"
,
"餐饮管理"
,
"物流"
],
}
module
.
exports
=
NameAPI
;
center-channel/app/config/routes/api.js
View file @
98e3568a
...
@@ -114,7 +114,7 @@ module.exports = function (app) {
...
@@ -114,7 +114,7 @@ module.exports = function (app) {
"addOrder"
,
"getH5PayUrl"
,
"getOrderQrCode"
,
"queryOrderStatus"
,
"getOrderInfo"
,
"getOrderDeliveryInfo"
,
"getOrderDetails"
,
"addOrder"
,
"getH5PayUrl"
,
"getOrderQrCode"
,
"queryOrderStatus"
,
"getOrderInfo"
,
"getOrderDeliveryInfo"
,
"getOrderDetails"
,
"getOrderDeliveryFlowInfo"
,
"getOrderDeliveryFlowList"
,
"getOrderLogInfo"
,
"updateContacts"
,
"updateTmOrder"
,
"delOrder"
,
"getOrderDeliveryFlowInfo"
,
"getOrderDeliveryFlowList"
,
"getOrderLogInfo"
,
"updateContacts"
,
"updateTmOrder"
,
"delOrder"
,
"submitProgramme"
,
"getProgrammeListByUser"
,
"getProgrammeInfoByNeedNo"
,
"abolishProgramme"
,
"getAliPayInfo"
,
"submitProgramme"
,
"getProgrammeListByUser"
,
"getProgrammeInfoByNeedNo"
,
"abolishProgramme"
,
"getAliPayInfo"
,
"getPaidLogoListByUser"
,
"getCollectibleLogoListByUser"
,
"collectLogo"
,
"getLogoMaterial"
,
"cancelCollectLogo"
,
"icpNotify"
"getPaidLogoListByUser"
,
"getCollectibleLogoListByUser"
,
"collectLogo"
,
"getLogoMaterial"
,
"cancelCollectLogo"
,
"icpNotify"
,
"createName"
];
];
if
(
lst
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
if
(
lst
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
...
@@ -388,4 +388,32 @@ module.exports = function (app) {
...
@@ -388,4 +388,32 @@ module.exports = function (app) {
});
});
//----------------------飞书小程序---------------------------------------------结束
//----------------------飞书小程序---------------------------------------------结束
//--------------------------起名宝------------------------------------//
app
.
post
(
'/name/:gname/:qname/:method'
,
function
(
req
,
res
)
{
var
classPath
=
req
.
params
[
"qname"
];
var
methodName
=
req
.
params
[
"method"
];
var
gname
=
req
.
params
[
"gname"
];
var
params
=
[];
classPath
=
gname
+
"."
+
classPath
;
var
tClientIp
=
system
.
get_client_ip
(
req
);
req
.
clientIp
=
tClientIp
;
req
.
uagent
=
req
.
headers
[
"user-agent"
];
req
.
classname
=
classPath
;
params
.
push
(
gname
);
params
.
push
(
methodName
);
params
.
push
(
req
.
body
);
params
.
push
(
req
.
query
);
params
.
push
(
req
);
var
p
=
null
;
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
if
(
invokeObj
[
"doexecMethod"
])
{
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
}
p
.
then
(
r
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
});
});
};
};
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