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
bca278e3
Commit
bca278e3
authored
Jun 25, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
download
parent
4e9d3f1f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
20 deletions
+95
-20
AliYunSecretReport.php
application/model/AliYunSecretReport.php
+12
-0
AliyunVoiceDown.php
application/model/AliyunVoiceDown.php
+20
-2
PrivacyNumber.php
application/task/controller/PrivacyNumber.php
+63
-18
No files found.
application/model/AliYunSecretReport.php
View file @
bca278e3
...
@@ -179,4 +179,15 @@ class AliYunSecretReport extends BaseModel
...
@@ -179,4 +179,15 @@ class AliYunSecretReport extends BaseModel
->
where
(
$where
)
->
where
(
$where
)
->
find
();
->
find
();
}
}
/**
* @param $data
* @param $where
* @return int|string
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
where
(
$where
)
->
update
(
$data
);
}
}
}
\ No newline at end of file
application/model/AliyunVoiceDown.php
View file @
bca278e3
...
@@ -28,11 +28,28 @@ class AliyunVoiceDown extends BaseModel
...
@@ -28,11 +28,28 @@ class AliyunVoiceDown extends BaseModel
/**
/**
* @param $data
* @param $data
* @param $where
* @return int|string
* @return int|string
* @throws \think\Exception
* @throws \think\Exception
* @throws \think\exception\PDOException
* @throws \think\exception\PDOException
*/
*/
public
function
updateData
(
$data
)
{
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
db_
->
update
(
$data
);
return
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getListAll
(
$field
,
$where
=
[])
{
$where
[
'is_del'
]
=
0
;
return
$this
->
field
(
$field
)
->
where
(
$where
)
->
select
();
}
}
}
}
\ No newline at end of file
application/task/controller/PrivacyNumber.php
View file @
bca278e3
...
@@ -733,28 +733,66 @@ class PrivacyNumber
...
@@ -733,28 +733,66 @@ class PrivacyNumber
/**
/**
* 更新已下载
* 更新已下载
*
* @return int|Response|\think\response\Json|\think\response\Jsonp|\think\response\Redirect|\think\response\View|\think\response\Xml
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
*/
public
function
updateDownVoiceId
()
{
public
function
updateDownVoiceId
()
{
$params
=
Request
::
instance
()
->
param
();
$params
=
Request
::
instance
()
->
param
();
if
(
!
in_array
(
$params
[
'source'
],
[
1
,
2
]))
{
if
(
!
in_array
(
$params
[
'source'
],
[
1
,
2
]))
{
return
Response
::
create
([
'code'
=>
101
,
'msg'
=>
'参数错误'
],
'json'
);
return
Response
::
create
([
'code'
=>
101
,
'msg'
=>
'参数错误'
],
'json'
);
}
if
(
empty
(
$params
[
'params'
]))
{
return
Response
::
create
([
'code'
=>
101
,
'msg'
=>
'参数错误'
],
'json'
);
}
$data_array
=
json_decode
(
$params
[
'params'
],
true
);
$num
=
count
(
$data_array
);
$limit_num
=
round
(
$num
/
10
);
$count
=
0
;
$update_id_array
=
[];
$update_data
[
'is_down'
]
=
$save_data
[
'record_down'
]
=
$params
[
'source'
];
for
(
$i
=
0
;
$i
<
$num
;
$i
++
)
{
$tmp_id_array
[]
=
$data_array
[
$i
][
'id'
];
$voice_file
[
$data_array
[
$i
][
'id'
]]
=
$data_array
[
$i
][
'voice_file'
];
//组装文件路径
if
(
$count
==
$limit_num
)
{
$voice_data
=
$this
->
m_down
->
getListAll
(
'id,call_id,call_time,voice_file,type'
,
[
'id'
=>
[
'in'
,
$tmp_id_array
]]);
if
(
empty
(
$voice_data
))
{
continue
;
}
foreach
(
$voice_data
as
$k
=>
$v
)
{
$update_id_array
[
$k
]
=
$v
[
'id'
];
$where
[
'call_id'
]
=
$v
[
'call_id'
];
if
(
$v
[
'type'
]
==
1
)
{
$where
[
'call_time'
]
=
$v
[
'call_time'
];
//阿里云录音
}
}
$id_array
=
explode
(
','
,
$params
[
'id'
]);
if
(
$params
[
'source'
]
==
1
)
{
$update_data
[
'is_down'
]
=
$params
[
'source'
];
$save_data
[
'voice_file'
]
=
$update_data
[
'voice_file'
]
=
$voice_file
[
$v
[
'id'
]
];
foreach
(
$id_array
as
$k
=>
$v
)
{
}
$update_data
[
'id'
]
=
$v
;
$this
->
m_secret_report
->
updateData
(
$save_data
,
$where
)
;
$this
->
m_down
->
updateData
(
$update_data
);
$this
->
m_down
->
updateData
(
$update_data
,
[
'id'
=>
$v
[
'id'
]]);
//更新下载状态
}
}
$tmp_id_array
=
$update_id_array
=
[];
$count
=
0
;
}
$count
++
;
}
return
$num
;
}
}
/**
/**
* getDownVoiceParams -> downVoiceByParams -> updateDownVoiceId
* getDownVoiceParams -> downVoiceByParams -> updateDownVoiceId
* 获取下载参数->开始下载->更新数据库已下载
* 获取下载参数->开始下载->更新数据库已下载
*
*
* @return Response|\think\response\Json|\think\response\Jsonp|\think\response\Redirect|\think\response\View|\think\response\Xml|void
* @return Response|\think\response\Json|\think\response\Jsonp|\think\response\Redirect|\think\response\View|\think\response\Xml
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
*/
public
function
downVoiceByParams
()
public
function
downVoiceByParams
()
{
{
...
@@ -765,6 +803,7 @@ class PrivacyNumber
...
@@ -765,6 +803,7 @@ class PrivacyNumber
}
}
$base_url
=
'https://api.tonglianjituan.com/task/'
;
$base_url
=
'https://api.tonglianjituan.com/task/'
;
// $base_url = 'https://pre2.tonglianjituan.com/task/';
$url
=
$base_url
.
'getDownVoiceParams?source='
.
$params
[
'source'
];
$url
=
$base_url
.
'getDownVoiceParams?source='
.
$params
[
'source'
];
$get_params
=
curl_get
(
$url
);
$get_params
=
curl_get
(
$url
);
$data
=
json_decode
(
$get_params
,
true
);
$data
=
json_decode
(
$get_params
,
true
);
...
@@ -772,7 +811,7 @@ class PrivacyNumber
...
@@ -772,7 +811,7 @@ class PrivacyNumber
return
Response
::
create
([
'code'
=>
101
,
'msg'
=>
'获取数据错误'
],
'json'
);
return
Response
::
create
([
'code'
=>
101
,
'msg'
=>
'获取数据错误'
],
'json'
);
}
}
$save_path
=
''
;
$save_path
=
''
;
$update_
id
=
[];
$update_
data
=
[];
foreach
(
$data
[
'data'
]
as
$k
=>
$v
)
{
foreach
(
$data
[
'data'
]
as
$k
=>
$v
)
{
$create_time
=
date
(
'Y-m-d'
,
strtotime
(
$v
[
'call_time'
]));
$create_time
=
date
(
'Y-m-d'
,
strtotime
(
$v
[
'call_time'
]));
switch
(
$v
[
'type'
])
{
switch
(
$v
[
'type'
])
{
...
@@ -811,16 +850,21 @@ class PrivacyNumber
...
@@ -811,16 +850,21 @@ class PrivacyNumber
}
}
if
(
file_exists
(
PHONE_VOICE
.
'/'
.
$save_path
))
{
if
(
file_exists
(
PHONE_VOICE
.
'/'
.
$save_path
))
{
$update_id
[]
=
$v
[
'id'
];
$update_data
[]
=
[
$this
->
m_down
->
updateData
([
'id'
=>
$v
[
'id'
],
'voice_file'
=>
$save_path
]);
'id'
=>
$v
[
'id'
],
'voice_file'
=>
$save_path
];
}
}
}
}
$result
=
0
;
if
(
$update_data
)
{
$update_data
=
json_encode
(
$update_data
);
//更新下载
//更新下载
$id_string
=
implode
(
','
,
$update_id
)
;
$url
=
$base_url
.
'updateDownVoiceId'
;
$url
=
$base_url
.
'updateDownVoiceId?id='
.
$id_string
.
'&source='
.
$params
[
'source'
]
;
$result
=
curl_post
(
$url
,
[
'params'
=>
$update_data
,
'source'
=>
$params
[
'source'
]],
10
)
;
curl_post
(
$url
,
[
'id'
=>
$id_string
,
'source'
=>
$params
[
'source'
]],
30000
);
}
return
;
return
Response
::
create
([
'code'
=>
200
,
'msg'
=>
'修改数量'
.
$result
],
'json'
)
;
}
}
}
}
\ No newline at end of file
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