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
1e56b458
Commit
1e56b458
authored
Jul 10, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台拨打电话接口
parent
90996260
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
16 deletions
+132
-16
CallPhoneService.php
application/api_broker/service/CallPhoneService.php
+74
-3
CellPhone.php
application/index/controller/CellPhone.php
+58
-13
No files found.
application/api_broker/service/CallPhoneService.php
View file @
1e56b458
...
...
@@ -20,6 +20,7 @@ class CallPhoneService
{
private
$phone_a
=
''
;
private
$phone_b
=
''
;
private
$phone_x
=
''
;
private
$expiry_date
=
''
;
private
$record
=
true
;
private
$release
=
1
;
...
...
@@ -35,9 +36,6 @@ class CallPhoneService
* @param $phone_b
* @param bool $record
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
bindAXB
(
$phone_a
,
$phone_b
,
$record
=
true
)
{
...
...
@@ -57,6 +55,7 @@ class CallPhoneService
$this
->
phone_b
=
$phone_b
;
//客户手机号
$this
->
record
=
$record
;
//是否录音
try
{
$redis
=
RedisExt
::
getRedis
();
$this
->
is_privacy
=
$redis
->
get
(
's_is_privacy'
);
...
...
@@ -128,9 +127,81 @@ class CallPhoneService
if
(
$result
[
'status'
]
==
'success'
)
$bind
->
recordBindPhone
(
$call_phone
[
'phone'
],
$phone_a
,
$phone_b
,
$record
,
$this
->
expiry_date
,
$this
->
subs_id
,
$this
->
request_id
,
$this
->
mapping_id
,
$this
->
is_privacy
,
$this
->
release
);
}
catch
(
\Exception
$e
)
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
$e
->
getMessage
();
}
return
$result
;
}
/**
* 解除绑定关系
*
* @param $phone_a
* @param $phone_b
* @param $phone_x
* @return mixed
*/
public
function
agentsUnBind
(
$phone_a
,
$phone_b
,
$phone_x
)
{
$data
[
'status'
]
=
'success'
;
$data
[
'msg'
]
=
''
;
if
(
empty
(
$phone_x
)
||
empty
(
$phone_a
)
||
empty
(
$phone_b
))
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
'解除关系参数错误,请联系运营人员!'
;
return
$data
;
}
$phone
=
new
BindingPhone
();
$redis
=
RedisExt
::
getRedis
();
$is_privacy
=
$redis
->
get
(
's_is_privacy'
);
$is_privacy
=
$is_privacy
!=
'0'
?
$is_privacy
:
0
;
try
{
if
(
$is_privacy
==
1
)
{
/*阿里云*/
$subsId
=
$phone
->
getSubsId
(
$phone_x
,
$phone_a
,
$phone_b
,
1
,
'subsId'
);
if
(
$subsId
)
{
$result
=
PlsDemo
::
unbindSubscription
(
$subsId
,
$phone_x
);
/*解绑*/
if
(
$result
->
Message
==
'OK'
)
{
$phone
->
unBind
(
$phone_x
,
$phone_a
,
$phone_b
);
}
else
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
'解除绑定关系失败,请联系运营!'
;
}
}
else
{
$data
[
'msg'
]
=
'没有号码绑定关系,请忽略!'
;
}
}
elseif
(
$is_privacy
==
2
)
{
/*容联云*/
$mappingId
=
$phone
->
getSubsId
(
$phone_x
,
$phone_a
,
$phone_b
,
1
,
'mappingId'
);
$yun_tong_xun
=
new
RongDemo
();
if
(
$mappingId
)
{
$result
=
$yun_tong_xun
->
releaseNumber
(
$mappingId
);
/*解绑*/
if
(
$result
[
'statusCode'
]
==
'000000'
)
{
$phone
->
unBind
(
$phone_x
,
$phone_a
,
$phone_b
);
}
else
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
'解除绑定关系失败,请联系运营!'
;
}
}
else
{
$data
[
'msg'
]
=
'没有号码绑定关系,请忽略!。'
;
}
}
else
{
$data
[
'msg'
]
=
'没有号码绑定关系,请忽略!。'
;
}
}
catch
(
\Exception
$e
)
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
$e
->
getMessage
();
}
return
$data
;
}
/**
* @return mixed|\SimpleXMLElement
*/
...
...
application/index/controller/CellPhone.php
View file @
1e56b458
...
...
@@ -8,12 +8,14 @@
namespace
app\index\controller
;
use
app\api_broker\service\CallPhoneService
;
use
app\index\extend\Basic
;
use
app\api_broker\untils\PlsDemo
;
use
app\model\AliYunPhone
;
use
app\model\BindingPhone
;
use
app\model\SecretReport
;
use
Grpc\Call
;
use
think\Db
;
class
CellPhone
extends
Basic
...
...
@@ -30,7 +32,8 @@ class CellPhone extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
callLog
()
{
public
function
callLog
()
{
if
(
$this
->
request
->
isAjax
())
{
$result
[
'code'
]
=
200
;
...
...
@@ -43,31 +46,31 @@ class CellPhone extends Basic
$where
=
[];
if
(
!
empty
(
$this
->
params
[
'start_date'
]))
{
$where
[
'a.call_time'
]
=
[
'> time'
,
$this
->
params
[
'start_date'
]
.
' 00:00:00'
];
$where
[
'a.call_time'
]
=
[
'> time'
,
$this
->
params
[
'start_date'
]
.
' 00:00:00'
];
}
if
(
!
empty
(
$this
->
params
[
'end_date'
]))
{
$where
[
'a.call_time'
]
=
[
'< time'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
];
$where
[
'a.call_time'
]
=
[
'< time'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
];
}
if
(
!
empty
(
$this
->
params
[
'start_date'
])
&&
!
empty
(
$this
->
params
[
'end_date'
]))
{
$where
[
'a.call_time'
]
=
[
'between'
,
[
$this
->
params
[
'start_date'
]
.
' 00:00:00'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
]
];
$where
[
'a.call_time'
]
=
[
'between'
,
[
$this
->
params
[
'start_date'
]
.
' 00:00:00'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
]
];
}
if
(
!
empty
(
$this
->
params
[
'call_name'
]))
{
$where
[
'name'
]
=
[
'LIKE'
,
$this
->
params
[
'call_name'
]
.
'%'
];
$where
[
'name'
]
=
[
'LIKE'
,
$this
->
params
[
'call_name'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'call_phone'
]))
{
$where
[
'phone_no'
]
=
[
'LIKE'
,
$this
->
params
[
'call_phone'
]
.
'%'
];
$where
[
'phone_no'
]
=
[
'LIKE'
,
$this
->
params
[
'call_phone'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'client_phone'
]))
{
$where
[
'c.user_phone'
]
=
[
'LIKE'
,
$this
->
params
[
'client_phone'
]
.
'%'
];
$where
[
'c.user_phone'
]
=
[
'LIKE'
,
$this
->
params
[
'client_phone'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'user_nick'
]))
{
$where
[
'c.user_nick'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'user_nick'
]
.
'%'
];
$where
[
'c.user_nick'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'user_nick'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'call_type'
]))
{
...
...
@@ -89,7 +92,8 @@ class CellPhone extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
callCollectList
()
{
public
function
callCollectList
()
{
if
(
$this
->
request
->
isAjax
())
{
$result
[
'code'
]
=
200
;
...
...
@@ -102,19 +106,19 @@ class CellPhone extends Basic
$where
=
[];
if
(
!
empty
(
$this
->
params
[
'start_date'
]))
{
$where
[
'create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_date'
]
];
$where
[
'create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_date'
]
];
}
if
(
!
empty
(
$this
->
params
[
'end_date'
]))
{
$where
[
'create_time'
]
=
[
'< time'
,
$this
->
params
[
'end_date'
]
];
$where
[
'create_time'
]
=
[
'< time'
,
$this
->
params
[
'end_date'
]
];
}
if
(
!
empty
(
$this
->
params
[
'agents_name'
]))
{
$where
[
'realName'
]
=
[
'LIKE'
,
$this
->
params
[
'agents_name'
]
.
'%'
];
$where
[
'realName'
]
=
[
'LIKE'
,
$this
->
params
[
'agents_name'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'phone'
]))
{
$where
[
'phone'
]
=
[
'LIKE'
,
$this
->
params
[
'phone'
]
.
'%'
];
$where
[
'phone'
]
=
[
'LIKE'
,
$this
->
params
[
'phone'
]
.
'%'
];
}
$data
[
'list'
]
=
$report
->
getCallCollect
(
$pageNo
,
$pageSize
,
'id desc'
,
$field
,
$where
);
...
...
@@ -124,4 +128,44 @@ class CellPhone extends Basic
return
view
(
'cell_phone/agentIndex'
);
}
}
/**
* 绑定手机号
*
* @return \think\Response
*/
public
function
bindAXB
()
{
$call_phone
=
new
CallPhoneService
();
$data
=
$call_phone
->
bindAXB
(
$this
->
params
[
'phone_a'
],
$this
->
params
[
'phone_b'
]);
$result
[
'msg'
]
=
''
;
if
(
$data
[
'status'
]
==
'success'
)
{
$result
[
'code'
]
=
200
;
$result
[
'data'
][
'phone'
]
=
$data
[
'phone'
];
}
else
{
$result
[
'status'
]
=
101
;
$result
[
'msg'
]
=
$data
[
'msg'
];
}
return
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
$data
);
}
/**
* 解除绑定关系
*
* @return \think\Response
*/
public
function
agentsUnBind
()
{
$call_phone
=
new
CallPhoneService
();
$data
=
$call_phone
->
agentsUnBind
(
$this
->
params
[
'phone_a'
],
$this
->
params
[
'phone_b'
],
$this
->
params
[
'phone_x'
]);
$result
[
'msg'
]
=
''
;
if
(
$data
[
'status'
]
==
'success'
)
{
$result
[
'code'
]
=
200
;
$result
[
'data'
][
'phone'
]
=
$data
[
'phone'
];
}
else
{
$result
[
'status'
]
=
101
;
$result
[
'msg'
]
=
$data
[
'msg'
];
}
return
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
$data
);
}
}
\ 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