当前位置: 首页>>代码示例>>PHP>>正文


PHP REST::CreateSubAccount方法代码示例

本文整理汇总了PHP中REST::CreateSubAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP REST::CreateSubAccount方法的具体用法?PHP REST::CreateSubAccount怎么用?PHP REST::CreateSubAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在REST的用法示例。


在下文中一共展示了REST::CreateSubAccount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createSubAccount

/**
 * 创建子帐号
 * @param friendlyName 子帐号名称
 */
function createSubAccount($friendlyName)
{
    // 初始化REST SDK
    global $accountSid, $accountToken, $appId, $serverIP, $serverPort, $softVersion;
    $rest = new REST($serverIP, $serverPort, $softVersion);
    $rest->setAccount($accountSid, $accountToken);
    $rest->setAppId($appId);
    // 调用云通讯平台的创建子帐号,绑定您的子帐号名称
    echo "Try to create a subaccount, binding to user {$friendlyName} <br/>";
    $result = $rest->CreateSubAccount($friendlyName);
    if ($result == NULL) {
        echo "result error!";
        //        break;
    }
    if ($result->statusCode != 0) {
        echo "error code :" . $result->statusCode . "<br/>";
        echo "error msg :" . $result->statusMsg . "<br>";
        //TODO 添加错误处理逻辑
    } else {
        echo "create SubbAccount success<br/>";
        // 获取返回信息
        $subaccount = $result->SubAccount;
        echo "subAccountid:" . $subaccount->subAccountSid . "<br/>";
        echo "subToken:" . $subaccount->subToken . "<br/>";
        echo "dateCreated:" . $subaccount->dateCreated . "<br/>";
        echo "voipAccount:" . $subaccount->voipAccount . "<br/>";
        echo "voipPwd:" . $subaccount->voipPwd . "<br/>";
        //TODO 把云平台子帐号信息存储在您的服务器上.
        //TODO 添加成功处理逻辑
    }
}
开发者ID:fengyeno,项目名称:fille,代码行数:35,代码来源:CreateSubAccount+.php

示例2: createSubAccount

 /**
  * 创建子帐号
  * @param friendlyName 子帐号名称
  */
 public function createSubAccount($friendlyName)
 {
     // 初始化REST SDK
     //        global $accountSid,$accountToken,$appId,$serverIP,$serverPort,$softVersion;
     $rest = new \REST($this->serverIP, $this->serverPort, $this->softVersion);
     $rest->setAccount($this->accountSid, $this->accountToken);
     $rest->setAppId($this->appId);
     // 调用云通讯平台的创建子帐号,绑定您的子帐号名称
     $result = $rest->CreateSubAccount($friendlyName);
     if ($result == NULL) {
         return false;
     }
     if ($result->statusCode != 0) {
         $data['status'] = $result->statusCode;
         $data['msg'] = $result->statusMsg;
         //TODO 添加错误处理逻辑
     } else {
         // 获取返回信息
         $subaccount = $result->SubAccount;
         $data['status'] = $result->statusCode;
         $data['subAccountSid'] = $subaccount->subAccountSid;
         $data['subToken'] = $subaccount->subToken;
         $data['dateCreated'] = $subaccount->dateCreated;
         $data['voipAccount'] = $subaccount->voipAccount;
         $data['voipPwd'] = $subaccount->voipPwd;
         $data['msg'] = 'success';
         //TODO 把云平台子帐号信息存储在您的服务器上.
         //TODO 添加成功处理逻辑
     }
     return $data;
 }
开发者ID:fengyeno,项目名称:fille,代码行数:35,代码来源:RonglianController.class.php

示例3: createSubAccount

 /**
  * 注册容联子账号
  * @param  [type] $friendlyName [description]
  * @return [type]               [description]
  */
 private function createSubAccount($friendlyName, $uid)
 {
     import("Common.Util.CCPRestSDK");
     // 初始化REST SDK
     $rest = new \REST(C('smsServerIP'), C('smsServerPort'), C('smsSoftVersion'));
     $rest->setAccount(C('smsAccountSid'), C('smsAccountToken'));
     $rest->setAppId(C('smsAppId'));
     $result = $rest->CreateSubAccount($friendlyName);
     if ($result == NULL) {
         $this->return['code'] = 1006;
         $this->return['message'] = L('regSubAccount_error');
         $this->goJson($this->return);
     }
     if ($result->statusCode != 0) {
         $result = (array) $result;
         $this->return['code'] = $result['statusCode'];
         $this->return['message'] = $result['statusMsg'];
         $this->goJson($this->return);
     } else {
         // 获取返回信息 把云平台子帐号信息存储在您的服务器上
         $subaccount = (array) $result->SubAccount;
         $info["subAccountid"] = $subaccount['subAccountSid'];
         $info["subToken"] = $subaccount['subToken'];
         $info["dateCreated"] = $subaccount['dateCreated'];
         $info["voipAccount"] = $subaccount['voipAccount'];
         $info["voipPwd"] = $subaccount['voipPwd'];
         D('userinfo')->where('uid=' . $uid)->save($info);
         $this->return['message'] = L('reg_success');
     }
 }
开发者ID:a349944418,项目名称:yuban,代码行数:35,代码来源:RegController.class.php


注:本文中的REST::CreateSubAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。