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
bf506d1b
Commit
bf506d1b
authored
Aug 20, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
容联云拨打电话回调,客户增加user_id
parent
3054a2a7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
66 deletions
+113
-66
CellPhone.php
application/api_broker/controller/CellPhone.php
+4
-3
CallPhoneService.php
application/api_broker/service/CallPhoneService.php
+87
-27
CellPhone.php
application/index/controller/CellPhone.php
+9
-25
Users.php
application/model/Users.php
+11
-9
PrivacyNumber.php
application/task/controller/PrivacyNumber.php
+2
-2
No files found.
application/api_broker/controller/CellPhone.php
View file @
bf506d1b
...
...
@@ -31,7 +31,9 @@ class CellPhone extends Basic
header
(
'Access-Control-Allow-Origin:*'
);
$call
=
new
CallPhoneService
();
$result
=
$call
->
bindAXB
(
$this
->
params
[
'phone_a'
],
$this
->
params
[
'phone_b'
]);
$record
=
true
;
//是否录音
$user_id
=
empty
(
$this
->
params
[
'user_id'
])
?
0
:
(
int
)
$this
->
params
[
'user_id'
];
$result
=
$call
->
bindAXB
(
$this
->
params
[
'phone_a'
],
$this
->
params
[
'phone_b'
],
$record
,
$user_id
);
if
(
$result
[
'status'
]
==
'success'
)
{
$this
->
msg
=
$result
[
'msg'
];
...
...
@@ -82,14 +84,13 @@ class CellPhone extends Basic
* 解除绑定关系
*
* @return \think\Response
* @throws \think\exception\DbException
*/
public
function
agentsUnBind
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$call
=
new
CallPhoneService
();
$result
=
$call
->
agentsUnBind
(
$this
->
params
[
'phone_a'
],
$this
->
params
[
'phone_b'
],
$this
->
params
[
'phone_x'
]);
$result
=
$call
->
agentsUnBind
(
$this
->
params
[
'phone_a'
],
$this
->
params
[
'phone_b'
],
$this
->
params
[
'phone_x'
]
,
$this
->
params
[
'user_id'
]
);
if
(
$result
[
'status'
]
==
'success'
)
{
$this
->
msg
=
$result
[
'msg'
];
...
...
application/api_broker/service/CallPhoneService.php
View file @
bf506d1b
...
...
@@ -15,6 +15,7 @@ use app\extra\RedisExt;
use
app\model\AliYunPhone
;
use
app\model\BindingPhone
;
use
app\model\SecretReport
;
use
app\model\Users
;
use
think\Log
;
class
CallPhoneService
...
...
@@ -22,6 +23,7 @@ class CallPhoneService
private
$phone_a
=
''
;
private
$phone_b
=
''
;
private
$phone_x
=
''
;
private
$user_id
=
''
;
private
$expiry_date
=
''
;
private
$record
=
true
;
private
$release
=
1
;
...
...
@@ -29,6 +31,13 @@ class CallPhoneService
private
$request_id
=
''
;
private
$mapping_id
=
''
;
private
$is_privacy
=
0
;
//0直接拨打号码1阿里云隐私号码2容联云隐私号码
private
$day_num
=
0
;
//号码绑定有效期
private
$landlord_phone_day
=
0
;
//房东号码绑定有效期
public
function
__construct
()
{
}
/**
* 绑定AXB手机号
...
...
@@ -38,9 +47,10 @@ class CallPhoneService
* @param $phone_a
* @param $phone_b
* @param bool $record
* @param int $user_id
* @return mixed
*/
public
function
bindAXB
(
$phone_a
,
$phone_b
,
$record
=
true
)
public
function
bindAXB
(
$phone_a
,
$phone_b
,
$record
=
true
,
int
$user_id
)
{
$result
[
'status'
]
=
'failed'
;
if
(
empty
(
$phone_a
)
||
empty
(
$phone_b
))
{
...
...
@@ -58,15 +68,21 @@ class CallPhoneService
return
$result
;
}
if
(
!
empty
(
$user_id
))
{
$this
->
user_id
=
$user_id
;
$user_data
=
$this
->
getUserData
();
if
(
empty
(
$user_data
[
'user_phone'
]))
{
return
$this
->
response
(
101
,
'没有用户信息'
);
}
$phone_b
=
$user_data
[
'user_phone'
];
}
$call_phone
=
[];
$this
->
phone_a
=
$phone_a
;
//经纪人手机号
$this
->
phone_b
=
$phone_b
;
//客户手机号
$this
->
record
=
$record
;
//是否录音
try
{
$redis
=
RedisExt
::
getRedis
();
$this
->
is_privacy
=
$redis
->
get
(
's_is_privacy'
);
//0不使用隐私号码 1阿里云 2容联云
if
(
$this
->
is_privacy
==
0
)
{
$this
->
originalPhone
();
...
...
@@ -90,21 +106,18 @@ class CallPhoneService
return
$result
;
//绑定过了,返回隐号
}
$day_num
=
$redis
->
get
(
's_day_num'
);
$this
->
release
=
1
;
//是否释放
if
(
empty
(
$day_num
))
{
if
(
empty
(
$
this
->
day_num
))
{
$this
->
expiry_date
=
_EXPIRATION
;
}
else
{
if
(
empty
(
$this
->
params
[
'landlord'
]))
{
$this
->
expiry_date
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
"+
{
$day_num
}
day"
));
$this
->
expiry_date
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
"+
{
$
this
->
day_num
}
day"
));
}
else
{
$day_num
=
$redis
->
get
(
's_landlord_phone_day'
);
if
(
$day_num
==
0
)
{
if
(
$this
->
day_num
==
0
)
{
$this
->
expiry_date
=
date
(
'Y-m-d H:i:s'
,
time
()
+
5
);
$this
->
release
=
0
;
}
else
{
$this
->
expiry_date
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
"+
{
$day_num
}
day"
));
$this
->
expiry_date
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
"+
{
$
this
->
day_num
}
day"
));
}
}
}
...
...
@@ -154,52 +167,74 @@ class CallPhoneService
* @param $phone_a
* @param $phone_b
* @param $phone_x
* @param $user_id
* @return mixed
*/
public
function
agentsUnBind
(
$phone_a
,
$phone_b
,
$phone_x
)
public
function
agentsUnBind
(
$phone_a
,
$phone_b
,
$phone_x
,
$user_id
)
{
$data
[
'status'
]
=
'success'
;
$data
[
'msg'
]
=
''
;
if
(
empty
(
$phone_x
)
||
empty
(
$phone_
a
)
||
empty
(
$phone_
b
))
{
if
(
empty
(
$phone_x
)
||
empty
(
$phone_b
))
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
'解除
关系参数错误
,请联系运营人员!'
;
$data
[
'msg'
]
=
'解除
失败
,请联系运营人员!'
;
return
$data
;
}
$phone
=
new
BindingPhone
();
if
(
empty
(
$phone_a
))
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
'解除失败,请联系运营人员!'
;
return
$data
;
}
$redis
=
RedisExt
::
getRedis
();
$is_privacy
=
$redis
->
get
(
's_is_privacy'
);
$is_privacy
=
$is_privacy
!=
'0'
?
$is_privacy
:
0
;
$this
->
phone_a
=
$phone_a
;
$this
->
phone_x
=
$phone_x
;
if
(
empty
(
$phone_b
))
{
if
(
!
empty
(
$user_id
))
{
$this
->
user_id
=
$user_id
;
$user_data
=
$this
->
getUserData
();
if
(
empty
(
$user_data
[
'user_phone'
]))
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
'没有客户信息,可以忽略。'
;
return
$data
;
}
$this
->
phone_b
=
$user_data
[
'user_phone'
];
}
}
else
{
$this
->
phone_b
=
$phone_b
;
}
$phone
=
new
BindingPhone
();
try
{
if
(
$is_privacy
==
1
)
{
if
(
$
this
->
is_privacy
==
1
)
{
/*阿里云*/
$subsId
=
$phone
->
getSubsId
(
$
phone_x
,
$phone_a
,
$
phone_b
,
1
,
'subsId'
);
$subsId
=
$phone
->
getSubsId
(
$
this
->
phone_x
,
$this
->
phone_a
,
$this
->
phone_b
,
1
,
'subsId'
);
if
(
$subsId
)
{
$result
=
PlsDemo
::
unbindSubscription
(
$subsId
,
$phone_x
);
/*解绑*/
$result
=
PlsDemo
::
unbindSubscription
(
$subsId
,
$
this
->
phone_x
);
/*解绑*/
if
(
$result
->
Message
==
'OK'
)
{
$phone
->
unBind
(
$
phone_x
,
$phone_a
,
$
phone_b
);
$phone
->
unBind
(
$
this
->
phone_x
,
$this
->
phone_a
,
$this
->
phone_b
);
}
else
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
'解除
绑定关系失败
,请联系运营!'
;
$data
[
'msg'
]
=
'解除
失败,如果需要继续与客户沟通
,请联系运营!'
;
}
}
else
{
$data
[
'msg'
]
=
'没有号码绑定关系,请忽略!'
;
}
}
elseif
(
$is_privacy
==
2
)
{
}
elseif
(
$
this
->
is_privacy
==
2
)
{
/*容联云*/
$mappingId
=
$phone
->
getSubsId
(
$
phone_x
,
$phone_a
,
$
phone_b
,
1
,
'mappingId'
);
$mappingId
=
$phone
->
getSubsId
(
$
this
->
phone_x
,
$this
->
phone_a
,
$this
->
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
);
$phone
->
unBind
(
$
this
->
phone_x
,
$this
->
phone_a
,
$this
->
phone_b
);
}
else
{
$data
[
'status'
]
=
'failed'
;
$data
[
'msg'
]
=
'解除
绑定关系失败
,请联系运营!'
;
$data
[
'msg'
]
=
'解除
失败,如果需要继续与客户沟通
,请联系运营!'
;
}
}
else
{
$data
[
'msg'
]
=
'没有号码绑定关系,请忽略!。'
;
...
...
@@ -317,4 +352,28 @@ class CallPhoneService
return
$m_report
->
editData
(
$report_data
);
//记录不使用隐号拨打记录
}
/**
* @param string $field
* @return array|false|\PDOStatement|string|\think\Model
*/
public
function
getUserData
(
$field
=
'user_phone'
)
{
$m_user
=
new
Users
();
$data
=
$m_user
->
selectUser
(
$this
->
user_id
,
$field
);
return
$data
;
}
/**
* 读取配置
*/
public
function
readRedis
()
{
$redis
=
RedisExt
::
getRedis
();
$this
->
is_privacy
=
$redis
->
get
(
's_is_privacy'
);
$this
->
day_num
=
$redis
->
get
(
's_day_num'
);
$this
->
landlord_phone_day
=
$redis
->
get
(
's_landlord_phone_day'
);
$this
->
is_privacy
=
empty
(
$this
->
is_privacy
)
?
0
:
$this
->
is_privacy
;
$this
->
day_num
=
empty
(
$this
->
day_num
)
?
1
:
$this
->
day_num
;
$this
->
landlord_phone_day
=
empty
(
$this
->
landlord_phone_day
)
?
1
:
$this
->
landlord_phone_day
;
}
}
\ No newline at end of file
application/index/controller/CellPhone.php
View file @
bf506d1b
...
...
@@ -135,9 +135,6 @@ class CellPhone extends Basic
* 绑定手机号
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
bindAXB
()
{
...
...
@@ -145,21 +142,16 @@ class CellPhone extends Basic
return
$this
->
response
(
101
,
'客户id为空'
);
}
$user_id
=
0
;
$phone_b
=
0
;
if
(
empty
(
$this
->
params
[
'phone_b'
]))
{
$m_user
=
new
Users
();
$user_phone
=
$m_user
->
selectUser
(
$this
->
params
[
'user_id'
],
'user_phone'
);
if
(
empty
(
$user_phone
[
'user_phone'
]))
{
return
$this
->
response
(
101
,
'没有用户信息'
);
}
$phone_b
=
$user_phone
[
'user_phone'
];
$user_id
=
$this
->
params
[
'user_id'
];
}
else
{
$phone_b
=
$this
->
params
[
'phone_b'
];
}
$record
=
true
;
//录音
$call_phone
=
new
CallPhoneService
();
$data
=
$call_phone
->
bindAXB
(
$this
->
params
[
'phone_a'
],
$phone_b
);
$data
=
$call_phone
->
bindAXB
(
$this
->
params
[
'phone_a'
],
$phone_b
,
$record
,
$user_id
);
$result
[
'msg'
]
=
''
;
if
(
$data
[
'status'
]
==
'success'
)
{
$push
=
new
PushMessageService
();
...
...
@@ -178,9 +170,6 @@ class CellPhone extends Basic
* 解除绑定关系
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
agentsUnBind
()
{
...
...
@@ -188,21 +177,16 @@ class CellPhone extends Basic
return
$this
->
response
(
101
,
'客户id为空'
);
}
$user_id
=
0
;
$phone_b
=
0
;
if
(
empty
(
$this
->
params
[
'phone_b'
]))
{
$m_user
=
new
Users
();
$user_phone
=
$m_user
->
selectUser
(
$this
->
params
[
'user_id'
],
'user_phone'
);
if
(
empty
(
$user_phone
[
'user_phone'
]))
{
return
$this
->
response
(
101
,
'没有用户信息'
);
}
$phone_b
=
$user_phone
[
'user_phone'
];
$user_id
=
$this
->
params
[
'user_id'
];
}
else
{
$phone_b
=
$this
->
params
[
'phone_b'
];
}
$call_phone
=
new
CallPhoneService
();
$data
=
$call_phone
->
agentsUnBind
(
$this
->
params
[
'phone_a'
],
$phone_b
,
$this
->
params
[
'phone_x'
]);
$data
=
$call_phone
->
agentsUnBind
(
$this
->
params
[
'phone_a'
],
$phone_b
,
$this
->
params
[
'phone_x'
]
,
$user_id
);
$result
[
'msg'
]
=
''
;
if
(
$data
[
'status'
]
==
'success'
)
{
$result
[
'code'
]
=
200
;
...
...
application/model/Users.php
View file @
bf506d1b
...
...
@@ -18,20 +18,22 @@ class Users extends Model
* @param $userId
* @param string $fields
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
selectUser
(
$userId
,
$fields
=
'id,user_phone'
)
{
$param
[
"status"
]
=
array
(
"in"
,
[
-
1
,
0
]
);
$data
=
$this
->
field
(
$fields
)
->
where
(
$param
)
->
find
(
$userId
);
try
{
$param
[
"status"
]
=
array
(
"in"
,
[
-
1
,
0
]
);
$data
=
$this
->
field
(
$fields
)
->
where
(
$param
)
->
find
(
$userId
);
if
(
isset
(
$data
->
user_pic
))
{
$data
->
user_pic
=
HEADERIMGURL
.
$data
->
user_pic
;
if
(
isset
(
$data
->
user_pic
))
{
$data
->
user_pic
=
HEADERIMGURL
.
$data
->
user_pic
;
}
}
catch
(
\Exception
$e
)
{
$data
=
[];
}
return
$data
;
}
...
...
application/task/controller/PrivacyNumber.php
View file @
bf506d1b
...
...
@@ -166,12 +166,12 @@ class PrivacyNumber
];
$phone_a
=
$params
[
'callerNum'
];
if
(
$phone_a
)
{
$agents_id
=
Db
::
table
(
'a_agents'
)
->
where
(
"phone='
{
$phone_a
}
' AND password IS NOT NULL"
)
->
value
(
'id'
);
$agents_id
=
Db
::
table
(
'a_agents'
)
->
where
(
'phone'
,
$phone_a
)
->
value
(
'id'
);
if
(
empty
(
$agents_id
))
{
$agents_id
=
Db
::
table
(
'a_agents_phone'
)
->
where
(
'phone'
,
$phone_a
)
->
value
(
'agents_id'
);
}
$date
[
'agents_id'
]
=
$agents_id
;
$date
[
'users_id'
]
=
Db
::
table
(
'u_users'
)
->
where
(
'user_phone'
,
$params
[
'
serving
Num'
])
->
value
(
'id'
);
$date
[
'users_id'
]
=
Db
::
table
(
'u_users'
)
->
where
(
'user_phone'
,
$params
[
'
callee
Num'
])
->
value
(
'id'
);
}
$report
=
new
SecretReport
();
$report
->
allowField
(
true
)
->
save
(
$date
);
...
...
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