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
4756d15c
Commit
4756d15c
authored
Sep 27, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
callrisk fix
parent
c16389ec
Pipeline
#14328
passed with stage
in 38 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
182 deletions
+18
-182
apply.js
app/service/credit/apply.js
+3
-2
callrisk.js
app/service/credit/callrisk.js
+15
-180
No files found.
app/service/credit/apply.js
View file @
4756d15c
...
...
@@ -339,7 +339,7 @@ class ApplyService extends Service {
let
report_id
=
null
;
//数盒魔方三要素校验
// await ctx.service.credit.callrisk.checkThreeElements(input);
//
await ctx.service.credit.common.shuhemofangCheck('callrisk', input);
await
ctx
.
service
.
credit
.
common
.
shuhemofangCheck
(
'callrisk'
,
input
);
//判断用户当前三要素是否是二次查询未支付订单
const
check_second_ret
=
await
this
.
checkSecond
({
name
,
phone
,
id_card
});
...
...
@@ -348,7 +348,7 @@ class ApplyService extends Service {
}
//生成订单
const
order_data
=
{
type
,
name
,
phone
,
id_card
};
const
order_data
=
{
type
,
name
,
phone
,
id_card
,
user_id
,
app_type_id
,
app_user_id
,
app_id
};
const
order
=
await
ctx
.
service
.
credit
.
order
.
createOrder
(
order_data
);
const
order_id
=
order
.
id
;
...
...
@@ -373,6 +373,7 @@ class ApplyService extends Service {
}
const
order_no
=
await
ctx
.
service
.
credit
.
common
.
getOrdertNo
(
'callrisk'
,
order_id
);
await
ctx
.
prometheusModel
.
CreditOrder
.
update
({
order_no
,
apply_id
:
apply
.
id
},
{
where
:
{
id
:
order_id
}
});
return
{
order_id
,
report_id
,
first
:
check_second_ret
.
first
,
second
:
check_second_ret
.
second
,
order_sn
};
}
...
...
app/service/credit/callrisk.js
View file @
4756d15c
...
...
@@ -530,11 +530,7 @@ class CallriskService extends Service {
const
{
ctx
}
=
this
;
const
user_id
=
ctx
.
userId
;
// const { order_id } = input;
// const yys_order_info = await ctx.prometheusModel.CreditYysOrder.findOne({ where: { order_id } });
// if (!yys_order_info || !yys_order_info.id) {
// ctx.failed('error order_sn');
// }
const
order_info
=
await
ctx
.
prometheusModel
.
CreditOrder
.
findOne
({
where
:
{
id
:
order_id
}
});
const
apply_info
=
await
ctx
.
prometheusModel
.
CreditApply
.
findOne
({
where
:
{
id
:
order_info
.
apply_id
}
});
if
(
!
order_info
||
!
order_info
.
id
)
{
...
...
@@ -552,9 +548,6 @@ class CallriskService extends Service {
let
get_code_params
=
{
orderSn
:
order_sn
,
data
:
{}
};
for
(
let
k
in
operator_params
)
{
const
operator_params_val
=
operator_params
[
k
];
// if (operator_params_val.name === 'phone') {
// continue;
// }
get_code_params
.
data
[
operator_params_val
.
name
]
=
input_params
[
operator_params_val
.
name
];
}
...
...
@@ -570,14 +563,15 @@ class CallriskService extends Service {
async
commitTask
(
input
)
{
const
{
ctx
}
=
this
;
cons
t
user_id
=
ctx
.
userId
;
le
t
user_id
=
ctx
.
userId
;
const
{
order_id
,
code
}
=
input
;
// const order_id = yys_order.order_id;
const
order_info
=
await
ctx
.
prometheusModel
.
CreditOrder
.
findOne
({
where
:
{
id
:
order_id
}
});
const
apply_info
=
await
ctx
.
prometheusModel
.
CreditApply
.
findOne
({
where
:
{
id
:
order_info
.
apply_id
}
});
if
(
!
order_info
||
!
order_info
.
id
)
{
ctx
.
failed
(
'error order_sn'
);
}
const
times_key
=
`commit_task_times_
${
apply_info
.
r_order_id
}
`
;
const
times
=
await
this
.
app
.
memcache
.
get
(
times_key
)
?
Number
(
await
this
.
app
.
memcache
.
get
(
times_key
))
:
0
;
const
input_params
=
{
phone
:
order_info
.
phone
,
name
:
order_info
.
name
,
...
...
@@ -592,13 +586,18 @@ class CallriskService extends Service {
const
column
=
params
[
i
].
name
;
request_params
[
column
]
=
input_params
[
column
];
}
const
request_data
=
{
orderSn
:
apply_info
.
r_order_id
,
params
:
request_params
};
let
request_data
=
{
orderSn
:
apply_info
.
r_order_id
,
params
:
request_params
};
if
(
times
>
0
)
{
request_data
=
{
orderSn
:
apply_info
.
r_order_id
,
params
:
{
phoneCode
:
code
}
};
}
const
yys_commit
=
await
ctx
.
service
.
credit
.
yys
.
commit
(
request_data
);
if
(
yys_commit
.
code
!==
0
)
{
ctx
.
failed
(
'commit error msg:'
+
yys_commit
.
msg
);
}
await
this
.
app
.
memcache
.
set
(
times_key
,
times
+
1
,
1800
);
return
{
order_id
};
}
...
...
@@ -626,172 +625,10 @@ class CallriskService extends Service {
if
(
r_code
!==
0
)
{
return
query_resp
;
}
// const query_resp = {
code: 0, msg: 'sdfsdfsd'
};
// const query_resp = {
code: 0, msg: 'sdfsdfsd'
};
//获取报告内容
// const yys_report_data = await ctx.service.credit.yys.getData(order_sn);//拉取报告数据
const
yys_report_data
=
{
"code"
:
0
,
"data"
:
{
"user_brief"
:
{
"mobile"
:
"13771111111"
,
//手机号
"operator"
:
"移动"
,
//运营商
"net_time"
:
5137
,
//入网时长
"call_result_assessment"
:
""
,
"report_time"
:
"2019-09-18 17:46:10"
,
//报告生成时间
"report_No"
:
"36edd55e-9ce7-4767-bd95-72077d086512"
//报告编号
},
"call_overview"
:
[
//通话概览
{
"month"
:
"201904"
,
//月份
"call_time_month"
:
"11127"
,
//月通话时长统计
"call_fee_month"
:
"150.82"
,
//月话费
"call_active_count_month"
:
"108"
,
//月主叫次数
"call_passive_count_month"
:
"92"
,
//月被叫次数
"call_count_month"
:
"200"
//月总通话次数
},
{
"month"
:
"201905"
,
"call_time_month"
:
"11048"
,
"call_fee_month"
:
"137.72"
,
"call_active_count_month"
:
"110"
,
"call_passive_count_month"
:
"90"
,
"call_count_month"
:
"200"
},
{
"month"
:
"201906"
,
"call_time_month"
:
"8637"
,
"call_fee_month"
:
"132.40"
,
"call_active_count_month"
:
"94"
,
"call_passive_count_month"
:
"97"
,
"call_count_month"
:
"191"
},
{
"month"
:
"201907"
,
"call_time_month"
:
"11803"
,
"call_fee_month"
:
"140.52"
,
"call_active_count_month"
:
"108"
,
"call_passive_count_month"
:
"92"
,
"call_count_month"
:
"200"
},
{
"month"
:
"201908"
,
"call_time_month"
:
"8636"
,
"call_fee_month"
:
"165.89"
,
"call_active_count_month"
:
"131"
,
"call_passive_count_month"
:
"69"
,
"call_count_month"
:
"200"
},
{
"month"
:
"201909"
,
"call_time_month"
:
"7509"
,
"call_fee_month"
:
"97.77"
,
"call_active_count_month"
:
"109"
,
"call_passive_count_month"
:
"53"
,
"call_count_month"
:
"162"
}
],
"call_type_analysis"
:
{
"bank_call_count"
:
0
,
//银行通话次数
"bank_call_time"
:
0
,
//银行通话时长
"bank_number_count"
:
0
,
//银行通话号码个数
"loan_call_count"
:
0
,
//贷款通话次数
"loan_call_time"
:
0
,
//贷款通话时长
"loan_number_count"
:
0
,
//贷款通话号码个数
"court_call_count"
:
0
,
//法院通话次数
"collection_call_count"
:
0
,
//催收通话次数
"laywer_call_count"
:
0
,
//律师通话次数
"macao_call_count"
:
0
,
//澳门电话通话次数
"110_call_count"
:
0
,
//110通话次数
"120_call_count"
:
0
//120/119通话次数
},
"call_active_analysis"
:
{
"routine_call_time"
:
58540
,
//常规时间通话时长
"night_call_time"
:
220
,
//深夜时间通话时长
"routine_call_count"
:
1148
,
//常规时间通话次数
"night_call_count"
:
5
,
//深夜时间通话次数
"time"
:
[
{
"time_interval"
:
"0-3"
,
//时间区间
"call_count"
:
3
,
//通话次数
"call_time"
:
158
//通话时长
},
{
"time_interval"
:
"3-6"
,
"call_count"
:
2
,
"call_time"
:
62
},
{
"time_interval"
:
"6-9"
,
"call_count"
:
127
,
"call_time"
:
4860
},
{
"time_interval"
:
"9-12"
,
"call_count"
:
222
,
"call_time"
:
12602
},
{
"time_interval"
:
"12-15"
,
"call_count"
:
136
,
"call_time"
:
7672
},
{
"time_interval"
:
"15-18"
,
"call_count"
:
305
,
"call_time"
:
13768
},
{
"time_interval"
:
"18-21"
,
"call_count"
:
288
,
"call_time"
:
15716
},
{
"time_interval"
:
"21-24"
,
"call_count"
:
70
,
"call_time"
:
3922
}
],
"location"
:
[
{
"city"
:
"徐州"
,
//具体城市
"ranking"
:
1
,
//通话次数排名
"call_count"
:
"1153"
,
//通话次数
"call_time"
:
"58760"
//通话时长
}
]
},
"call_behavior_analysis"
:
{
"silence_count_3day"
:
4
,
//静默3天以上的次数
"silence_time_3day"
:
46
,
//静默总时长
"silence_time_rate_3day"
:
"0.27"
,
//静默时长占比
"silence_cycle"
:
[
{
"silence_begin_time"
:
"2019-04-15 12:04:32"
,
//静默开始时间
"silence_end_time"
:
"2019-05-01 07:05:47"
//静默结束时间
},
{
"silence_begin_time"
:
"2019-05-21 19:59:24"
,
"silence_end_time"
:
"2019-06-01 08:29:57"
},
{
"silence_begin_time"
:
"2019-07-24 09:34:45"
,
"silence_end_time"
:
"2019-08-01 06:35:52"
},
{
"silence_begin_time"
:
"2019-08-21 11:28:24"
,
"silence_end_time"
:
"2019-09-01 07:03:25"
}
],
"maximum_active_call_count"
:
"85"
,
//最多主叫通话次数
"maximum_active_call_number"
:
"13758076123"
,
//最多主叫通话次数对应号码
"maximum_passive_call_count"
:
"9"
,
//最多被叫通话次数
"maximum_passive_call_number"
:
"13852154123"
,
//最多被叫通话次数对应号码
"maximum_call_time"
:
"990"
,
//最多通话时长
"maximum_call_time_number"
:
"15852276123"
//最多通话时长对应号码
}
},
"orderSn"
:
"36edd55e-9ce7-4767-bd95-72077d086512"
};
const
yys_report_data
=
await
ctx
.
service
.
credit
.
yys
.
getData
(
order_sn
);
//拉取报告数据
if
(
yys_report_data
.
code
!==
0
)
{
return
{
code
:
-
1
,
msg
:
yys_report_data
.
msg
}
}
...
...
@@ -898,11 +735,9 @@ class CallriskService extends Service {
}
await
ctx
.
prometheusModel
.
CreditCallriskSilenceCycle
.
bulkCreate
(
silence_cycle_report
);
await
ctx
.
prometheusModel
.
CreditOrder
.
update
({
report_id
,
valid
:
1
,
state
:
'待支付'
,
order_time
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
state_time
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
where
:
{}
});
// const report_no = await ctx.service.credit.common.getReportNo('callrisk', report_id);
// await ctx.prometheusModel.CreditCallriskReport.update({ report_no }, { where: { id: report_id } });
await
ctx
.
prometheusModel
.
CreditOrder
.
update
({
report_id
,
valid
:
1
,
state
:
'待支付'
,
order_time
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
state_time
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
where
:
{
id
:
order_id
}
});
return
Object
.
assign
({
report_id
},
query_resp
);
return
Object
.
assign
({
report_id
,
order_id
},
query_resp
);
}
...
...
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