Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
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
方斌
51business
Commits
aef2e88c
Commit
aef2e88c
authored
Sep 25, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
callrisk pull
parent
6042ffc4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
168 additions
and
28 deletions
+168
-28
credit_yys_order.js
app/model/prometheus/credit_yys_order.js
+46
-0
apply.js
app/service/credit/apply.js
+33
-27
yys.js
app/service/credit/yys.js
+81
-0
config.local.js
config/config.local.js
+6
-1
config.prod.js
config/config.prod.js
+2
-0
No files found.
app/model/prometheus/credit_yys_order.js
0 → 100644
View file @
aef2e88c
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
INTEGER
,
STRING
,
DATE
,
TEXT
}
=
app
.
Sequelize
;
const
CreditYysOrder
=
app
.
prometheusModel
.
define
(
'credit_yys_order'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
tyorder_idpe
:
INTEGER
,
user_id
:
STRING
,
app_user_id
:
STRING
,
app_id
:
STRING
,
app_type_id
:
STRING
,
name
:
STRING
,
phone
:
STRING
,
id_card
:
STRING
,
password
:
STRING
,
r_order_sn
:
STRING
,
operator
:
TEXT
,
valid
:
INTEGER
,
created_at
:
{
type
:
DATE
,
get
()
{
const
date
=
this
.
getDataValue
(
'created_at'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
},
updated_at
:
{
type
:
DATE
,
get
()
{
const
date
=
this
.
getDataValue
(
'updated_at'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
}
},
{
timestamps
:
false
,
tableName
:
'credit_yys_order'
,
});
return
CreditYysOrder
;
};
app/service/credit/apply.js
View file @
aef2e88c
...
...
@@ -303,7 +303,6 @@ class ApplyService extends Service {
valid
:
1
}
await
ctx
.
prometheusModel
.
CreditOrder
.
update
(
updateOrderData
,
{
where
:
{
id
:
order
.
id
}
});
// let currentOrder = await ctx.prometheusModel.CreditOrder.findOne({ where: { id: order.id } });
await
ctx
.
service
.
credit
.
order
.
logOrder
(
order
.
id
);
return
ret
;
...
...
@@ -314,49 +313,57 @@ class ApplyService extends Service {
* @param {*} inputParams
*/
async
applyCallrisk
(
input
)
{
const
{
ctx
,
app
}
=
this
;
const
{
name
,
phone
,
id_card
}
=
input
;
const
{
ctx
}
=
this
;
const
{
name
,
phone
,
id_card
,
password
}
=
input
;
const
user_id
=
ctx
.
userId
;
const
app_type_id
=
ctx
.
appTypeId
;
const
app_user_id
=
ctx
.
appUserId
;
const
app_id
=
ctx
.
appId
;
const
type
=
TypeConfigp
[
'callrisk'
];
//个人通话类型
//数盒魔方三要素校验
await
ctx
.
service
.
credit
.
common
.
shuhemofangCheck
(
'callrisk'
,
input
);
//判断用户当前三要素是否是二次查询未支付订单
const
check_second_ret
=
await
this
.
checkSecond
();
if
(
!
check_second_ret
.
order_id
)
{
return
check_second_ret
;
}
let
ret
=
{
order_id
,
report_id
:
null
,
first
:
check_second_ret
.
first
,
second
:
check_second_ret
.
second
,
order_sn
:
null
}
//生成订单
const
order_data
=
{
type
,
name
,
phone
,
id_card
};
const
order
=
await
ctx
.
service
.
credit
.
order
.
createOrder
(
order_data
);
order_id
=
order
.
id
;
//获取报告数据
// await this.createApply();
// const callrisk_info = result.data.data.callrisk;
// const report = await ctx.service.credit.blacklist.createReport({ name, phone, id_card }, callrisk_info);
// report_id = report.id;
let
order_id
=
order
.
id
;
//更新订单
//生成order_no
const
order_no
=
await
ctx
.
service
.
credit
.
common
.
getOrdertNo
(
TypeConfigFlip
[
type
],
order_id
);
const
state_time
=
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
);
const
update_order_data
=
{
order_no
,
apply_id
:
apply
.
id
,
report_id
,
state
:
'待支付'
,
state_time
,
valid
:
1
//运营商API.创建订单号
let
orderSnInfo
=
await
ctx
.
service
.
credit
.
yys
.
getOrderSn
(
phone
);
if
(
orderSnInfo
.
code
!==
0
)
{
ctx
.
failed
(
'getOrderSn error msg:'
+
orderSnInfo
.
msg
);
}
await
ctx
.
prometheusModel
.
CreditOrder
.
update
(
update_order_data
,
{
where
:
{
id
:
order
.
id
}
});
const
current_order
=
await
ctx
.
prometheusModel
.
CreditOrder
.
findOne
({
where
:
{
id
:
order
.
id
}
});
await
ctx
.
service
.
credit
.
order
.
logOrder
(
order
.
id
);
let
addYysOrder
=
{
order_id
,
user_id
,
app_type_id
,
app_user_id
,
app_id
,
name
,
phone
,
id_card
,
password
,
r_order_sn
:
orderSnInfo
.
data
.
orderSn
,
order_sn_operator
:
orderSnInfo
.
data
.
operator
}
let
YysOrderInfo
=
await
ctx
.
prometheusModel
.
CreditYysOrder
.
create
(
addYysOrder
);
ret
.
order_sn
=
orderSnInfo
.
data
.
orderSn
;
return
ret
;
}
...
...
@@ -399,7 +406,6 @@ class ApplyService extends Service {
//判断用户当前三要素是否是二次查询未支付订单
async
checkSecond
(
input
)
{
const
{
ctx
}
=
this
;
const
{
name
,
phone
,
id_card
}
=
input
;
const
{
user_id
}
=
this
;
...
...
app/service/credit/yys.js
0 → 100644
View file @
aef2e88c
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
const
moment
=
require
(
'moment'
);
const
_
=
require
(
'lodash'
);
class
YysService
extends
Service
{
/**
* 创建订单号
* @param {*}
*/
async
getOrderSn
(
phone
)
{
const
{
ctx
}
=
this
;
let
params
=
{
phone
:
phone
}
let
url
=
this
.
config
.
NODE_BASE_URL
+
'/getorderSn'
+
'?appKey='
+
this
.
config
.
YYS_APP_KEY
;
let
resp
=
await
ctx
.
helper
.
send_request
(
url
,
params
,
{
method
:
'POST'
});
ctx
.
logger
.
info
({
url
:
JSON
.
stringify
(
resp
)
});
return
resp
.
data
;
}
/**
* 获取验证码
* @param {*}
*/
async
getCode
(
params
)
{
const
{
ctx
}
=
this
;
let
params
=
{
orderSn
:
params
.
order_sn
,
data
:
{
password
:
params
.
password
}
}
let
url
=
this
.
config
.
NODE_BASE_URL
+
'/getCode'
+
'?appKey='
+
this
.
config
.
YYS_APP_KEY
;
let
resp
=
await
ctx
.
helper
.
send_request
(
url
,
params
,
{
method
:
'POST'
});
ctx
.
logger
.
info
({
url
:
JSON
.
stringify
(
resp
)
});
return
resp
.
data
;
}
/**
* 提交任务
* @param {*} params 需要提交的参数,根据getOrderSn的operator来确定需要的参数
*/
async
commit
(
params
)
{
const
{
ctx
}
=
this
;
let
params
=
{
orderSn
:
params
.
order_sn
,
params
:
{
password
:
params
.
password
}
}
let
url
=
this
.
config
.
NODE_BASE_URL
+
'/commit'
+
'?appKey='
+
this
.
config
.
YYS_APP_KEY
;
let
resp
=
await
ctx
.
helper
.
send_request
(
url
,
params
,
{
method
:
'POST'
});
ctx
.
logger
.
info
({
url
:
JSON
.
stringify
(
resp
)
});
return
resp
.
data
;
}
/**
* 查询任务状态
* @param {*} orderSn 创建订单时生成的订单号
*/
async
query
(
orderSn
)
{
const
{
ctx
}
=
this
;
let
params
=
{
orderSn
:
orderSn
,
}
let
url
=
this
.
config
.
NODE_BASE_URL
+
'/query'
+
'?appKey='
+
this
.
config
.
YYS_APP_KEY
;
let
resp
=
await
ctx
.
helper
.
send_request
(
url
,
params
,
{
method
:
'POST'
});
ctx
.
logger
.
info
({
url
:
JSON
.
stringify
(
resp
)
});
return
resp
.
data
;
}
}
module
.
exports
=
YysService
;
config/config.local.js
View file @
aef2e88c
...
...
@@ -17,7 +17,7 @@ module.exports = appInfo => {
domainWhiteList
:
[],
};
config
.
middleware
=
[
'errorHandler'
,
'deviceLogin'
,
'deviceInit'
,
'responseSet'
];
config
.
middleware
=
[
'errorHandler'
,
'deviceLogin'
,
'deviceInit'
,
'responseSet'
];
// config.middleware = [];
exports
.
multipart
=
{
...
...
@@ -161,5 +161,10 @@ module.exports = appInfo => {
config
.
TX_LBS_DISTANCE_URL
=
'https://apis.map.qq.com/ws/distance/v1/'
;
// 距离计算(一对多)
config
.
TX_LBS_ADDRESS_URL
=
'https://apis.map.qq.com/ws/geocoder/v1/'
;
// 地址解析;逆地址解析
//我的信用-通化检测
config
.
YYS_APP_KEY
=
'A86BB96F55B64DCE87A46E919A347993'
;
return
config
;
};
config/config.prod.js
View file @
aef2e88c
...
...
@@ -147,6 +147,8 @@ module.exports = appInfo => {
config
.
TX_LBS_DISTANCE_URL
=
process
.
env
.
TX_LBS_DISTANCE_URL
;
// 距离计算(一对多)
config
.
TX_LBS_ADDRESS_URL
=
process
.
env
.
TX_LBS_ADDRESS_URL
;
// 地址解析;逆地址解析
//我的信用-通化检测
config
.
YYS_APP_KEY
=
process
.
env
.
YYS_APP_KEY
;
return
config
;
};
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