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
3321bb9b
Commit
3321bb9b
authored
Aug 20, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
容联云号码回调
parent
2b174f58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
95 deletions
+78
-95
RongDemo.php
application/api_broker/untils/RongDemo.php
+73
-93
PrivacyNumber.php
application/task/controller/PrivacyNumber.php
+5
-2
No files found.
application/api_broker/untils/RongDemo.php
View file @
3321bb9b
...
@@ -8,54 +8,54 @@
...
@@ -8,54 +8,54 @@
namespace
app\api_broker\untils
;
namespace
app\api_broker\untils
;
//use app\api_broker\untils\curlUntils;
use
app\chat\utils\CurlUtil
;
use
app\chat\utils\CurlUtil
;
class
RongDemo
class
RongDemo
{
{
/**
/**
* 业务url/Accounts/{accountSid}/nme/{type}/{operatorId}/[/{op}]?sig={sigParameter}
* 业务url/Accounts/{accountSid}/nme/{type}/{operatorId}/[/{op}]?sig={sigParameter}
* accountSid 账户id
* accountSid 账户id
* operatorId 合作运营商标识
* operatorId 合作运营商标识
* type 号码类型
* type 号码类型
* op 操作名
* op 操作名
* sigParameter 访问签名
* sigParameter 访问签名
* appId 应用id
* appId 应用id
* authToken 访问授权码
* authToken 访问授权码
* test_phone 测试中间号
* test_phone 测试中间号
*
*
*/
*/
public
$base_url
=
'https://apppro.cloopen.com:8883/2013-12-26'
;
public
$base_url
=
'https://apppro.cloopen.com:8883/2013-12-26'
;
public
$components
=
[
public
$components
=
[
'accountSid'
=>
'8a48b55153eae51101540e763d3b3888'
,
'accountSid'
=>
'8a48b55153eae51101540e763d3b3888'
,
'appId'
=>
'8a216da85f5c89b1015f7718e2b90a63'
,
'appId'
=>
'8a216da85f5c89b1015f7718e2b90a63'
,
'appToken'
=>
'TOKEN3655166d16164b6ef25d6fa2a266acc1'
,
'appToken'
=>
'TOKEN3655166d16164b6ef25d6fa2a266acc1'
,
'authToken'
=>
'26b220de299d4a56a6f54dd5792a30e4'
'authToken'
=>
'26b220de299d4a56a6f54dd5792a30e4'
];
];
public
$test_phone
=
'17080219070'
;
public
$test_phone
=
'17080219070'
;
public
$sign
=
''
;
public
$sign
=
''
;
public
$statusCode
=
[
public
$statusCode
=
[
'000000'
=>
'成功'
,
'000000'
=>
'成功'
,
'300001'
=>
'参数错误'
,
'300001'
=>
'参数错误'
,
'300002'
=>
'验证错误'
,
'300002'
=>
'验证错误'
,
'301101'
=>
'无号码资源'
,
'301101'
=>
'无号码资源'
,
'301201'
=>
'内部存储异常'
,
'301201'
=>
'内部存储异常'
,
'301401'
=>
'无空闲号码'
,
'301401'
=>
'无空闲号码'
,
'301402'
=>
'分配失败'
,
'301402'
=>
'分配失败'
,
'301501'
=>
'类型号码未配置'
,
'301501'
=>
'类型号码未配置'
,
'301633'
=>
'找不到应用'
,
'301633'
=>
'找不到应用'
,
'320201'
=>
'号码已解绑'
,
'320201'
=>
'号码已解绑'
,
'320400'
=>
'参数异常'
,
'320400'
=>
'参数异常'
,
'320402'
=>
'号码已使用'
,
'320402'
=>
'号码已使用'
,
'320500'
=>
'落地异常'
,
'320500'
=>
'落地异常'
,
'309000'
=>
'其它错误'
,
'309000'
=>
'其它错误'
,
];
];
function
__construct
(){
function
__construct
()
{
//$this->sign = $this->sigParameter();
//$this->sign = $this->sigParameter();
}
}
...
@@ -67,11 +67,11 @@ class RongDemo
...
@@ -67,11 +67,11 @@ class RongDemo
*/
*/
public
function
sigParameter
(
$time
)
public
function
sigParameter
(
$time
)
{
{
$data
=
$this
->
components
;
$data
=
$this
->
components
;
//生成签名
//生成签名
$data
[
'accountSid'
]
.
$data
[
'authToken'
]
.
$time
;
$data
[
'accountSid'
]
.
$data
[
'authToken'
]
.
$time
;
$sign
=
strtoupper
(
md5
(
$data
[
'accountSid'
]
.
$data
[
'authToken'
]
.
$time
));
$sign
=
strtoupper
(
md5
(
$data
[
'accountSid'
]
.
$data
[
'authToken'
]
.
$time
));
return
$sign
;
return
$sign
;
}
}
...
@@ -80,10 +80,11 @@ class RongDemo
...
@@ -80,10 +80,11 @@ class RongDemo
* @param $time
* @param $time
* @return mixed
* @return mixed
*/
*/
public
function
Authorization
(
$time
){
public
function
Authorization
(
$time
)
$data
=
$this
->
components
;
{
$data
=
$this
->
components
;
$Authorization
=
base64_encode
(
$data
[
'accountSid'
]
.
':'
.
$time
);
$Authorization
=
base64_encode
(
$data
[
'accountSid'
]
.
':'
.
$time
);
return
$Authorization
;
return
$Authorization
;
}
}
...
@@ -95,15 +96,16 @@ class RongDemo
...
@@ -95,15 +96,16 @@ class RongDemo
* @param $operatorId 平台标识
* @param $operatorId 平台标识
* @return string
* @return string
*/
*/
public
function
url
(
$type
,
$op
=
''
,
$operatorId
,
$sign
){
public
function
url
(
$type
,
$op
=
''
,
$operatorId
,
$sign
)
$data
=
$this
->
components
;
{
$url_c
=
"/Accounts/
{
$data
[
'accountSid'
]
}
/nme/
{
$type
}
/
{
$operatorId
}
/
{
$op
}
?sig=
{
$sign
}
"
;
$data
=
$this
->
components
;
$url
=
$this
->
base_url
.
$url_c
;
$url_c
=
"/Accounts/
{
$data
[
'accountSid'
]
}
/nme/
{
$type
}
/
{
$operatorId
}
/
{
$op
}
?sig=
{
$sign
}
"
;
$url
=
$this
->
base_url
.
$url_c
;
return
$url
;
return
$url
;
}
}
public
function
sendCurl
(
$url
,
$arr
,
$Authorization
)
public
function
sendCurl
(
$url
,
$arr
,
$Authorization
)
{
{
$data
=
json_encode
(
$arr
);
$data
=
json_encode
(
$arr
);
$curl
=
new
CurlUtil
();
$curl
=
new
CurlUtil
();
...
@@ -116,9 +118,8 @@ class RongDemo
...
@@ -116,9 +118,8 @@ class RongDemo
"CURLOPT_SSL_VERIFYPEER"
=>
0
,
"CURLOPT_SSL_VERIFYPEER"
=>
0
,
"CURLOPT_SSL_VERIFYHOST"
=>
2
,
"CURLOPT_SSL_VERIFYHOST"
=>
2
,
];
];
//echo $url;
$response
=
$curl
->
post
(
$url
,
$data
);
$response
=
$curl
->
post
(
$url
,
$data
);
return
$response
;
return
$response
;
}
}
...
@@ -132,11 +133,12 @@ class RongDemo
...
@@ -132,11 +133,12 @@ class RongDemo
* @param $yx_time
* @param $yx_time
* @return string
* @return string
*/
*/
public
function
setNumber
(
$aNumber
,
$bNumber
,
$xNumber
,
$areaCode
,
$yx_time
=
'604800'
,
$record
){
public
function
setNumber
(
$aNumber
,
$bNumber
,
$xNumber
,
$areaCode
,
$yx_time
=
'604800'
,
$record
)
$data
=
$this
->
components
;
{
$time
=
date
(
'YmdHis'
,
time
());
$data
=
$this
->
components
;
$sign
=
$this
->
sigParameter
(
$time
);
/*签名*/
$time
=
date
(
'YmdHis'
,
time
());
$url
=
$this
->
url
(
'axb'
,
'setnumber'
,
'cu01'
,
$sign
);
/*url*/
$sign
=
$this
->
sigParameter
(
$time
);
/*签名*/
$url
=
$this
->
url
(
'axb'
,
'setnumber'
,
'cu01'
,
$sign
);
/*url*/
$Authorization
=
$this
->
Authorization
(
$time
);
/*认证信息*/
$Authorization
=
$this
->
Authorization
(
$time
);
/*认证信息*/
$post_data
=
[
$post_data
=
[
...
@@ -145,20 +147,15 @@ class RongDemo
...
@@ -145,20 +147,15 @@ class RongDemo
'bNumber'
=>
$bNumber
,
'bNumber'
=>
$bNumber
,
'servingNumber'
=>
$xNumber
,
'servingNumber'
=>
$xNumber
,
'areaCode'
=>
$areaCode
,
'areaCode'
=>
$areaCode
,
'needRecord'
=>
$record
,
'needRecord'
=>
$record
,
'mappingDuratio'
=>
$yx_time
,
'mappingDuratio'
=>
$yx_time
,
'cdrNotifyUrl'
=>
CURRENT_URL
.
"task/rongBilledInformUrl"
,
'cdrNotifyUrl'
=>
CURRENT_URL
.
'task/rongBilledInformUrl'
,
'callStateNotifyUrl'
=>
CURRENT_URL
.
"task/rongStatusInformUrl"
,
'callStateNotifyUrl'
=>
CURRENT_URL
.
'task/rongStatusInformUrl'
,
'recordNotifyUrl'
=>
CURRENT_URL
.
"task/rongRecordingInformUrl"
,
'recordNotifyUrl'
=>
CURRENT_URL
.
'task/rongRecordingInformUrl'
,
// 'cdrNotifyUrl' =>"http://pre.tonglianjituan.com/task/rongBilledInfromUrl",
'userData'
=>
$aNumber
.
'-'
.
$bNumber
//记录a和b号码,回调使用
// 'callStateNotifyUrl'=>"http://pre.tonglianjituan.com/task/rongRecordingInfromUrl",
// 'recordNotifyUrl'=>"http://pre.tonglianjituan.com/task/rongStatusInfromUrl",
];
];
//var_dump($post_data);/*************测试****************/
$result
=
json_decode
(
$this
->
sendCurl
(
$url
,
$post_data
,
$Authorization
),
true
);
$result
=
json_decode
(
$this
->
sendCurl
(
$url
,
$post_data
,
$Authorization
),
true
);
return
$result
;
return
$result
;
}
}
/**
/**
...
@@ -166,35 +163,19 @@ class RongDemo
...
@@ -166,35 +163,19 @@ class RongDemo
* @param $mappingId
* @param $mappingId
* @return string
* @return string
*/
*/
public
function
releaseNumber
(
$mappingId
){
public
function
releaseNumber
(
$mappingId
)
$data
=
$this
->
components
;
{
$time
=
date
(
'YmdHis'
,
time
());
$data
=
$this
->
components
;
$sign
=
$this
->
sigParameter
(
$time
);
/*签名*/
$time
=
date
(
'YmdHis'
,
time
());
$url
=
$this
->
url
(
'axb'
,
'releasenumber'
,
'cu01'
,
$sign
);
/*url*/
$sign
=
$this
->
sigParameter
(
$time
);
/*签名*/
$url
=
$this
->
url
(
'axb'
,
'releasenumber'
,
'cu01'
,
$sign
);
/*url*/
$Authorization
=
$this
->
Authorization
(
$time
);
/*认证信息*/
$Authorization
=
$this
->
Authorization
(
$time
);
/*认证信息*/
$post_data
=
[
$post_data
=
[
'appId'
=>
$data
[
'appId'
],
'appId'
=>
$data
[
'appId'
],
'mappingId'
=>
$mappingId
'mappingId'
=>
$mappingId
];
];
$result
=
json_decode
(
$this
->
sendCurl
(
$url
,
$post_data
,
$Authorization
),
true
);
$result
=
json_decode
(
$this
->
sendCurl
(
$url
,
$post_data
,
$Authorization
),
true
);
return
$result
;
return
$result
;
}
}
}
}
\ No newline at end of file
application/task/controller/PrivacyNumber.php
View file @
3321bb9b
...
@@ -164,14 +164,17 @@ class PrivacyNumber
...
@@ -164,14 +164,17 @@ class PrivacyNumber
'type'
=>
2
,
'type'
=>
2
,
'call_display'
=>
$params
[
'calldisplay'
],
'call_display'
=>
$params
[
'calldisplay'
],
];
];
$phone_a
=
$params
[
'callerNum'
];
$phone
=
explode
(
'-'
,
$params
[
'userData'
]);
$phone_a
=
$phone
[
0
];
$phone_b
=
$phone
[
1
];
if
(
$phone_a
)
{
if
(
$phone_a
)
{
$agents_id
=
Db
::
table
(
'a_agents'
)
->
where
(
'phone'
,
$phone_a
)
->
value
(
'id'
);
$agents_id
=
Db
::
table
(
'a_agents'
)
->
where
(
'phone'
,
$phone_a
)
->
value
(
'id'
);
if
(
empty
(
$agents_id
))
{
if
(
empty
(
$agents_id
))
{
$agents_id
=
Db
::
table
(
'a_agents_phone'
)
->
where
(
'phone'
,
$phone_a
)
->
value
(
'agents_id'
);
$agents_id
=
Db
::
table
(
'a_agents_phone'
)
->
where
(
'phone'
,
$phone_a
)
->
value
(
'agents_id'
);
}
}
$date
[
'agents_id'
]
=
$agents_id
;
$date
[
'agents_id'
]
=
$agents_id
;
$date
[
'users_id'
]
=
Db
::
table
(
'u_users'
)
->
where
(
'user_phone'
,
$p
arams
[
'calleeNum'
]
)
->
value
(
'id'
);
$date
[
'users_id'
]
=
Db
::
table
(
'u_users'
)
->
where
(
'user_phone'
,
$p
hone_b
)
->
value
(
'id'
);
}
}
$report
=
new
SecretReport
();
$report
=
new
SecretReport
();
$report
->
allowField
(
true
)
->
save
(
$date
);
$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