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
bc21af52
Commit
bc21af52
authored
Oct 10, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
容联云绑定接口修改
parent
6be7b462
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
18 deletions
+66
-18
CallPhoneService.php
application/api_broker/service/CallPhoneService.php
+26
-16
RongDemo.php
application/api_broker/untils/RongDemo.php
+40
-2
No files found.
application/api_broker/service/CallPhoneService.php
View file @
bc21af52
...
...
@@ -177,9 +177,7 @@ class CallPhoneService
$type
=
'YunTongXunBindAxb'
;
$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
);
$bind
->
commit
();
}
else
{
$bind
->
rollback
();
$result
[
'msg'
]
=
$call_phone
[
'msg'
];
}
}
...
...
@@ -322,7 +320,6 @@ class CallPhoneService
* 容联云号码绑定
*
* @return mixed
* @throws \think\exception\PDOException
*/
public
function
yunTongXun
()
{
...
...
@@ -334,33 +331,25 @@ class CallPhoneService
$record
=
'false'
;
}
$aliYunPhone
=
new
AliYunPhone
();
$phone_x
=
$aliYunPhone
->
getAliYunPhoneAll
(
$this
->
phone_a
,
$this
->
phone_b
,
$this
->
is_privacy
,
[],
$this
->
city
);
//获取未绑定隐号
$result
=
$yun_tong_xun
->
setNumber
(
$this
->
phone_a
,
$this
->
phone_b
,
$phone_x
[
'data'
][
'phone_x'
],
$phone_x
[
'data'
][
'area'
],
$this
->
expiry_date
,
$record
);
$area
=
$this
->
getAreaCode
();
$result
=
$yun_tong_xun
->
setNumber
(
$this
->
phone_a
,
$this
->
phone_b
,
$area
,
$this
->
expiry_date
,
$record
);
/*绑定成功*/
if
(
$result
[
'statusCode'
]
==
'000000'
)
{
$data
[
'status'
]
=
'success'
;
$data
[
'msg'
]
=
'绑定成功。'
;
$data
[
'phone'
]
=
$
phone_x
[
'data'
][
'phone_x
'
];
$data
[
'phone'
]
=
$
result
[
'data'
][
'xNumber
'
];
$this
->
mapping_id
=
$result
[
'data'
][
'mappingId'
];
}
else
{
$phone_x_arr
[]
=
$phone_x
[
'data'
][
'phone_x'
];
//剔除绑定失败的中间号
//尝试5次再绑定
for
(
$i
=
0
;
$i
<
5
;
$i
++
)
{
$phone_x
=
$aliYunPhone
->
getAliYunPhoneAll
(
$this
->
phone_a
,
$this
->
phone_b
,
$this
->
is_privacy
,
$phone_x_arr
,
$this
->
city
);
//获取未绑定隐号
$result
=
$yun_tong_xun
->
setNumber
(
$this
->
phone_a
,
$this
->
phone_b
,
$phone_x
[
'data'
][
'phone_x'
],
$phone_x
[
'data'
][
'area'
],
$this
->
expiry_date
,
$record
);
$result
=
$yun_tong_xun
->
setNumber
(
$this
->
phone_a
,
$this
->
phone_b
,
$area
,
$this
->
expiry_date
,
$record
);
if
(
$result
[
'statusCode'
]
==
'000000'
)
{
$data
[
'status'
]
=
'success'
;
$data
[
'msg'
]
=
'绑定成功。'
;
$data
[
'phone'
]
=
$
phone_x
[
'data'
][
'phone_x
'
];
$data
[
'phone'
]
=
$
result
[
'data'
][
'xNumber
'
];
$this
->
mapping_id
=
$result
[
'data'
][
'mappingId'
];
break
;
}
else
{
$phone_x_arr
[]
=
$phone_x
[
'data'
][
'phone_x'
];
//剔除绑定失败的中间号
}
}
...
...
@@ -480,4 +469,24 @@ class CallPhoneService
return
;
}
/**
* 根据城市返回区号
*
* @return string
*/
public
function
getAreaCode
()
{
switch
(
$this
->
city
)
{
case
'上海'
:
$code
=
'021'
;
break
;
case
'杭州'
:
$code
=
'0571'
;
break
;
default
:
$code
=
'021'
;
}
return
$code
;
}
}
\ No newline at end of file
application/api_broker/untils/RongDemo.php
View file @
bc21af52
...
...
@@ -125,7 +125,7 @@ class RongDemo
}
/**
* AXB绑定
* AXB绑定
,指定X
* @param $aNumber
* @param $bNumber
* @param $xNumber
...
...
@@ -134,7 +134,7 @@ class RongDemo
* @param $yx_time
* @return string
*/
public
function
setNumber
(
$aNumber
,
$bNumber
,
$xNumber
,
$areaCode
,
$yx_time
=
'604800'
,
$record
)
public
function
setNumber
X
(
$aNumber
,
$bNumber
,
$xNumber
,
$areaCode
,
$yx_time
=
'604800'
,
$record
)
{
$data
=
$this
->
components
;
$time
=
date
(
'YmdHis'
,
time
());
...
...
@@ -161,6 +161,44 @@ class RongDemo
return
$result
;
}
/**
* AXB绑定,不指定X
* @param $aNumber
* @param $bNumber
* @param $areaCode
* @param $record
* @param $yx_time
* @return string
*/
public
function
setNumber
(
$aNumber
,
$bNumber
,
$areaCode
,
$yx_time
=
'604800'
,
$record
)
{
$data
=
$this
->
components
;
$time
=
date
(
'YmdHis'
,
time
());
$sign
=
$this
->
sigParameter
(
$time
);
/*签名*/
$url
=
$this
->
url
(
'axb'
,
'providenumber'
,
'cu01'
,
$sign
);
/*url*/
$Authorization
=
$this
->
Authorization
(
$time
);
/*认证信息*/
$post_data
=
[
'appId'
=>
$data
[
'appId'
],
'aNumber'
=>
$aNumber
,
'bNumber'
=>
$bNumber
,
'xNumberRestrict'
=>
'1'
,
//‘0’无限制 '1':指定区号,'2':跟随aNumber,'3':跟随bNumber
'defaultAreaCode'
=>
'021'
,
//默认区号,当指定的区号没有号码可分配时,则按照默认区号分配号码。
'areaCode'
=>
$areaCode
,
//区号
'mappingDuration'
=>
strtotime
(
$yx_time
)
.
''
,
'icDisplayFlag'
=>
3
,
//"0"显示真实号码"1"显示中间号"2"aNumbe侧"3" bNumber侧默认"1"
'needRecord'
=>
$record
,
'smscode'
=>
1
,
//'0'不支持短信‘1’支持短信
'cdrNotifyUrl'
=>
CURRENT_URL
.
'task/rongBilledInformUrl'
,
'callStateNotifyUrl'
=>
CURRENT_URL
.
'task/rongStatusInformUrl'
,
'recordNotifyUrl'
=>
CURRENT_URL
.
'task/rongRecordingInformUrl'
,
'userData'
=>
$aNumber
.
'-'
.
$bNumber
//记录a和b号码,回调使用
];
$result
=
json_decode
(
$this
->
sendCurl
(
$url
,
$post_data
,
$Authorization
),
true
);
$result
[
'code_msg'
]
=
$this
->
getCodeString
(
$result
[
'statusCode'
]);
return
$result
;
}
/**
* AXB 解绑
* @param $mappingId
...
...
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