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
6a1318aa
Commit
6a1318aa
authored
Mar 14, 2018
by
zfc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
容联云
parent
9a20af65
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
225 additions
and
3 deletions
+225
-3
RongPhone.php
application/api_broker/controller/RongPhone.php
+48
-0
RongDemo.php
application/api_broker/untils/RongDemo.php
+172
-0
config.php
application/config.php
+1
-1
route.php
application/route.php
+4
-2
No files found.
application/api_broker/controller/RongPhone.php
0 → 100644
View file @
6a1318aa
<?php
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\untils\RongDemo
;
class
RongPhone
extends
Basic
{
protected
$code
=
200
;
protected
$data
=
[];
protected
$msg
=
""
;
/**
* 绑定AXB
*/
public
function
rBindAXB
(){
$Rong
=
new
RongDemo
();
$phone_a
=
'18521714341'
;
$phone_x
=
'17080219070'
;
$phone_b
=
'13524893873'
;
$r
=
$Rong
->
setNumber
(
$phone_a
,
$phone_b
,
$phone_x
,
'0755'
);
echo
$r
;
}
public
function
rongReleaseNumber
(){
$Rong
=
new
RongDemo
();
$mappingId
=
'NME202201803141649196111669110810817080219070'
;
$r
=
$Rong
->
releaseNumber
(
$mappingId
);
echo
$r
;
}
//回调
public
function
callStateNotifyUrl
(){
$params
=
$this
->
request
->
param
();
$str
=
date
(
'Y-m-d h:i:s'
)
.
' '
.
var_export
(
$params
,
true
);
file_put_contents
(
'Rongcall.txt'
,
$str
,
FILE_APPEND
);
}
}
\ No newline at end of file
application/api_broker/untils/RongDemo.php
0 → 100644
View file @
6a1318aa
<?php
/**
* Created by PhpStorm.
* User: zfc
* Date: 2018/3/12
* Time: 15:42
*/
namespace
app\api_broker\untils
;
//use app\api_broker\untils\curlUntils;
use
app\chat\utils\CurlUtil
;
class
RongDemo
{
/**
* 业务url/Accounts/{accountSid}/nme/{type}/{operatorId}/[/{op}]?sig={sigParameter}
* accountSid 账户id
* operatorId 合作运营商标识
* type 号码类型
* op 操作名
* sigParameter 访问签名
* appId 应用id
* authToken 访问授权码
* test_phone 测试中间号
*
*/
public
$base_url
=
'https://apppro.cloopen.com:8883/2013-12-26'
;
public
$components
=
[
'accountSid'
=>
'8a48b55153eae51101540e763d3b3888'
,
'appId'
=>
'8a216da85f5c89b1015f7718e2b90a63'
,
'appToken'
=>
'TOKEN3655166d16164b6ef25d6fa2a266acc1'
,
'authToken'
=>
'26b220de299d4a56a6f54dd5792a30e4'
];
public
$test_phone
=
'17080219070'
;
public
$sign
=
''
;
function
__construct
(){
//$this->sign = $this->sigParameter();
}
/**
* 签名(appId+authToken+时间戳)
* @return array
* @param $time
* @return mixed
*/
public
function
sigParameter
(
$time
)
{
$data
=
$this
->
components
;
//生成签名
echo
$data
[
'accountSid'
]
.
$data
[
'authToken'
]
.
$time
;
echo
'<br>'
;
echo
$sign
=
strtoupper
(
md5
(
$data
[
'accountSid'
]
.
$data
[
'authToken'
]
.
$time
));
return
$sign
;
}
/**
* 认证信息
* @param $time
* @return mixed
*/
public
function
Authorization
(
$time
){
$data
=
$this
->
components
;
$Authorization
=
base64_encode
(
$data
[
'accountSid'
]
.
':'
.
$time
);
return
$Authorization
;
}
/**
*
* @param $type //号码类型 AXB ,XB
* @param $op //操作名(用于不同请求)
* @param $sign //签名
* @param $operatorId 平台标识
* @return string
*/
public
function
url
(
$type
,
$op
=
''
,
$operatorId
,
$sign
){
$data
=
$this
->
components
;
$url_c
=
"/Accounts/
{
$data
[
'accountSid'
]
}
/nme/
{
$type
}
/
{
$operatorId
}
/
{
$op
}
?sig=
{
$sign
}
"
;
$url
=
$this
->
base_url
.
$url_c
;
return
$url
;
}
public
function
sendCurl
(
$url
,
$arr
,
$Authorization
)
{
$data
=
json_encode
(
$arr
);
$curl
=
new
CurlUtil
();
$curl
->
headers
=
[
'Accept'
=>
'application/json'
,
'Content-Type'
=>
'application/json;charset=utf-8'
,
'Authorization'
=>
$Authorization
];
$curl
->
options
=
[
"CURLOPT_SSL_VERIFYPEER"
=>
0
,
"CURLOPT_SSL_VERIFYHOST"
=>
2
,
];
echo
$url
;
$response
=
$curl
->
post
(
$url
,
$data
);
return
$response
;
}
/**
* AXB绑定
* @param $aNumber
* @param $bNumber
* @param $xNumber
* @param $areaCode
* @return string
*/
public
function
setNumber
(
$aNumber
,
$bNumber
,
$xNumber
,
$areaCode
){
$data
=
$this
->
components
;
$time
=
date
(
'YmdHis'
,
time
());
$sign
=
$this
->
sigParameter
(
$time
);
/*签名*/
$url
=
$this
->
url
(
'axb'
,
'setnumber'
,
'cu01'
,
$sign
);
/*url*/
$Authorization
=
$this
->
Authorization
(
$time
);
/*认证信息*/
$post_data
=
[
'appId'
=>
$data
[
'appId'
],
'aNumber'
=>
$aNumber
,
'bNumber'
=>
$bNumber
,
'servingNumber'
=>
$xNumber
,
'areaCode'
=>
$areaCode
,
'callStateNotifyUrl'
=>
CURRENT_URL
.
"broker/callStateNotifyUrl"
,
'cdrNotifyUrl'
=>
CURRENT_URL
.
"broker/callStateNotifyUrl"
,
'recordNotifyUrl'
=>
CURRENT_URL
.
"broker/callStateNotifyUrl"
,
];
$result
=
$this
->
sendCurl
(
$url
,
$post_data
,
$Authorization
);
return
$result
;
}
/**
* AXB 解绑
* @param $mappingId
* @return string
*/
public
function
releaseNumber
(
$mappingId
){
$data
=
$this
->
components
;
$time
=
date
(
'YmdHis'
,
time
());
$sign
=
$this
->
sigParameter
(
$time
);
/*签名*/
$url
=
$this
->
url
(
'axb'
,
'releasenumber'
,
'cu01'
,
$sign
);
/*url*/
$Authorization
=
$this
->
Authorization
(
$time
);
/*认证信息*/
$post_data
=
[
'appId'
=>
$data
[
'appId'
],
'mappingId'
=>
$mappingId
];
$result
=
$this
->
sendCurl
(
$url
,
$post_data
,
$Authorization
);
return
$result
;
}
}
\ No newline at end of file
application/config.php
View file @
6a1318aa
...
@@ -14,7 +14,7 @@ define('LOCAL_IMG_HOST','/resource/lib/Attachments/');
...
@@ -14,7 +14,7 @@ define('LOCAL_IMG_HOST','/resource/lib/Attachments/');
define
(
'PAGESIZE'
,
15
);
//分页每页条数
define
(
'PAGESIZE'
,
15
);
//分页每页条数
define
(
'ADMIN_URL_TL'
,
'https://admin.tonglianjituan.com/'
);
//B端网址
define
(
'ADMIN_URL_TL'
,
'https://admin.tonglianjituan.com/'
);
//B端网址
//define('TEST_ADMIN_URL_TL','https://dev.tonglianjituan.com/'); //B端网址
//define('TEST_ADMIN_URL_TL','https://dev.tonglianjituan.com/'); //B端网址
define
(
'CURRENT_URL'
,
'http://'
.
$_SERVER
[
'HTTP_HOST'
]
.
DS
);
//取当前域名地址
define
(
'CURRENT_URL'
,
'http://'
.
$_SERVER
[
'HTTP_HOST'
]
.
'/'
);
//取当前域名地址
define
(
'HEADERIMGURL'
,
CURRENT_URL
.
'static'
.
DS
.
'head_portrait/'
);
//头像地址
define
(
'HEADERIMGURL'
,
CURRENT_URL
.
'static'
.
DS
.
'head_portrait/'
);
//头像地址
define
(
'CHAT_IMG_URL'
,
CURRENT_URL
.
'static'
.
DS
.
'chat_image/'
);
//聊天图片地址
define
(
'CHAT_IMG_URL'
,
CURRENT_URL
.
'static'
.
DS
.
'chat_image/'
);
//聊天图片地址
define
(
'CK_IMG_URL'
,
CURRENT_URL
.
'/resource/lib/Attachments/'
);
//ck 资源文件
define
(
'CK_IMG_URL'
,
CURRENT_URL
.
'/resource/lib/Attachments/'
);
//ck 资源文件
...
...
application/route.php
View file @
6a1318aa
...
@@ -280,8 +280,10 @@ Route::group('broker', [
...
@@ -280,8 +280,10 @@ Route::group('broker', [
'bindAXB'
=>
[
'api_broker/CellPhone/bindAXB'
,
[
'method'
=>
'post'
]
],
//隐私号码
'bindAXB'
=>
[
'api_broker/CellPhone/bindAXB'
,
[
'method'
=>
'post'
]
],
//隐私号码
'agentsUnBind'
=>
[
'api_broker/CellPhone/agentsUnBind'
,
[
'method'
=>
'post'
]
],
//解除绑定关系
'agentsUnBind'
=>
[
'api_broker/CellPhone/agentsUnBind'
,
[
'method'
=>
'post'
]
],
//解除绑定关系
'updateBindAXB'
=>
[
'api_broker/CellPhone/updateBindAXB'
,
[
'method'
=>
'post'
]
],
//更新绑定关系隐私号码
'updateBindAXB'
=>
[
'api_broker/CellPhone/updateBindAXB'
,
[
'method'
=>
'post'
]
],
//更新绑定关系隐私号码
/*****容联隐私号*******/
'rBindAXB'
=>
[
'api_broker/RongPhone/rBindAXB'
,
[
'method'
=>
'post | get'
]
],
//隐私号码【绑定】
'callStateNotifyUrl'
=>
[
'api_broker/RongPhone/callStateNotifyUrl'
,
[
'method'
=>
'post | get'
]
],
//隐私号码回调
'rongReleaseNumber'
=>
[
'api_broker/RongPhone/rongReleaseNumber'
,
[
'method'
=>
'post | get'
]
],
//隐私号码【解绑】
//商铺
//商铺
'getShopList'
=>
[
'api_broker/Shop/getShopList'
,
[
'method'
=>
'get|post'
]
],
'getShopList'
=>
[
'api_broker/Shop/getShopList'
,
[
'method'
=>
'get|post'
]
],
'getShopDetail'
=>
[
'api_broker/Shop/getShopDetail'
,
[
'method'
=>
'get'
]
],
'getShopDetail'
=>
[
'api_broker/Shop/getShopDetail'
,
[
'method'
=>
'get'
]
],
...
...
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