Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
65ae0e0a
Commit
65ae0e0a
authored
Nov 13, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计通话时间优化
parent
a0900ce3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
3 deletions
+54
-3
PrivacyNumber.php
application/task/controller/PrivacyNumber.php
+54
-3
No files found.
application/task/controller/PrivacyNumber.php
View file @
65ae0e0a
...
@@ -18,6 +18,7 @@ use app\model\AAgentsPhone;
...
@@ -18,6 +18,7 @@ use app\model\AAgentsPhone;
use
app\model\AliYunSecretReport
;
use
app\model\AliYunSecretReport
;
use
app\model\BindingPhone
;
use
app\model\BindingPhone
;
use
app\model\TAgentTotalCallModel
;
use
app\model\TAgentTotalCallModel
;
use
app\model\Users
;
use
think\Db
;
use
think\Db
;
use
think\Log
;
use
think\Log
;
use
think\Request
;
use
think\Request
;
...
@@ -28,12 +29,16 @@ class PrivacyNumber
...
@@ -28,12 +29,16 @@ class PrivacyNumber
private
$m_bind
;
private
$m_bind
;
private
$m_secret_report
;
private
$m_secret_report
;
private
$m_agent
;
private
$m_agent
;
private
$m_agent_phone
;
private
$m_user
;
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
redis
=
RedisExt
::
getRedis
();
$this
->
redis
=
RedisExt
::
getRedis
();
$this
->
m_secret_report
=
new
AliYunSecretReport
();
$this
->
m_secret_report
=
new
AliYunSecretReport
();
$this
->
m_bind
=
new
BindingPhone
();
$this
->
m_bind
=
new
BindingPhone
();
$this
->
m_agent
=
new
AAgents
();
$this
->
m_agent
=
new
AAgents
();
$this
->
m_agent_phone
=
new
AAgentsPhone
();
$this
->
m_user
=
new
Users
();
}
}
/**
/**
...
@@ -78,6 +83,52 @@ class PrivacyNumber
...
@@ -78,6 +83,52 @@ class PrivacyNumber
return
json_encode
([
'code'
=>
0
,
'msg'
=>
'接收成功'
]);
return
json_encode
([
'code'
=>
0
,
'msg'
=>
'接收成功'
]);
}
}
/**
* 阿里大于隐私号码回调处理
*
* @return string
*/
public
function
addReportV2
()
{
$post_data
=
Request
::
instance
()
->
param
();
foreach
(
$post_data
as
$k
=>
$v
)
{
$save_data
=
$v
;
$save_data
[
'report_id'
]
=
$post_data
[
0
][
'id'
];
unset
(
$save_data
[
'id'
]);
//阿里大于返回是的id改为report_id
if
(
$v
[
'phone_no'
])
{
$agent_where
[
'phone'
]
=
$v
[
'phone_no'
];
$agent_where
[
'status'
]
=
0
;
$agent_where
[
'password'
]
=
[
'NOT NULL'
];
$agent_id
=
$this
->
m_agent
->
getAgentsByWhere
(
$agent_where
,
'id'
);
if
(
empty
(
$agent_id
))
{
$phone_where
[
'phone'
]
=
$v
[
'phone_no'
];
$phone_where
[
'status'
]
=
0
;
$agent_id
=
$this
->
m_agent_phone
->
getAgentsByWhere
(
$phone_where
,
'agents_id'
);
}
$save_data
[
'agents_id'
]
=
$agent_id
;
$save_data
[
'users_id'
]
=
$this
->
m_user
->
getUserByWhereValue
([
'user_phone'
=>
$save_data
[
'peer_no'
]],
'id'
);
}
$call_time
=
strtotime
(
$save_data
[
'release_time'
])
-
strtotime
(
$save_data
[
'start_time'
]);
$save_data
[
'time'
]
=
$call_time
;
if
(
$call_time
>
0
)
{
$end_date
=
date
(
'Y-m-d H:i:s'
,
time
());
$start_date
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
"-1 day"
));
$num
=
$this
->
m_secret_report
->
getCallNumber
(
$post_data
[
0
][
'phone_no'
],
$post_data
[
0
][
'peer_no'
],
$start_date
,
$end_date
);
if
(
empty
(
$num
))
{
$m_service
=
new
ClientService
();
$m_service
->
saveCallNumByUserId
(
$save_data
[
'users_id'
]);
}
}
$this
->
m_secret_report
->
allowField
(
true
)
->
save
(
$save_data
);
}
Log
::
write
(
json_encode
(
$post_data
[
0
]),
'AliYunSecretReport'
);
//记录日志
return
json_encode
([
'code'
=>
0
,
'msg'
=>
'接收成功'
]);
}
/**
/**
* 下载录音 高峰期 一般是早上9-11点 下午2-4点
* 下载录音 高峰期 一般是早上9-11点 下午2-4点
*
*
...
@@ -399,7 +450,7 @@ class PrivacyNumber
...
@@ -399,7 +450,7 @@ class PrivacyNumber
}
}
$where
[
'c
reate
_time'
]
=
[
'between'
,
[
$yesterday
.
' 00:00:00'
,
$yesterday
.
' 23:59:59'
]];
$where
[
'c
all
_time'
]
=
[
'between'
,
[
$yesterday
.
' 00:00:00'
,
$yesterday
.
' 23:59:59'
]];
$where
[
'time'
]
=
[
'>'
,
0
];
$where
[
'time'
]
=
[
'>'
,
0
];
$total
=
$this
->
m_secret_report
->
getListGroupCount
(
$where
,
'phone_no'
);
$total
=
$this
->
m_secret_report
->
getListGroupCount
(
$where
,
'phone_no'
);
...
@@ -492,8 +543,8 @@ class PrivacyNumber
...
@@ -492,8 +543,8 @@ class PrivacyNumber
* 历史数据
* 历史数据
*/
*/
public
function
oldTotalAgentCall
()
{
public
function
oldTotalAgentCall
()
{
//
$month = ['2018-03','2018-04','2018-05','2018-06','2018-07','2018-08','2018-09','2018-10','2018-11'];
$month
=
[
'2018-03'
,
'2018-04'
,
'2018-05'
,
'2018-06'
,
'2018-07'
,
'2018-08'
,
'2018-09'
,
'2018-10'
,
'2018-11'
];
$month
=
[
'2018-11'
];
//
$month = ['2018-11'];
foreach
(
$month
as
$v
)
{
foreach
(
$month
as
$v
)
{
$firstday
=
date
(
'Y-m-01'
,
strtotime
(
$v
));
$firstday
=
date
(
'Y-m-01'
,
strtotime
(
$v
));
...
...
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