dataInfo(['uniacid'=>$uniacid]); $accessKeyId = trim($config['short_id']); $accessKeySecret = trim($config['short_secret']); $config = new Config([ // 必填,您的 AccessKey ID "accessKeyId" => $accessKeyId, // 必填,您的 AccessKey Secret "accessKeySecret" => $accessKeySecret ]); // 访问的域名 $config->endpoint = "dyplsapi.aliyuncs.com"; return new Dyplsapi($config); } /** * @param $uniacid * @param $phoneA * @param $phoneB * @param $expiration * @param bool $isRecordingEnabled * @功能说明:绑定手机号 * @author chenniang * @DataTime: 2022-12-08 10:58 */ public function bindPhone($uniacid,$phoneA,$phoneB,$expiration,$poolKey,$out_id,$isRecordingEnabled=true){ $client = self::createClient($uniacid); $bindAxbRequest = new BindAxbRequest([ "phoneNoA" => $phoneA, "phoneNoB" => $phoneB, "expiration" => $expiration, "isRecordingEnabled" => $isRecordingEnabled, "poolKey" => $poolKey, "outId" => $out_id ]); $runtime = new RuntimeOptions([]); try { // 复制代码运行请自行打印 API 的返回值 $res = $client->bindAxbWithOptions($bindAxbRequest, $runtime); $res = object_array($res); return !empty($res['body'])?$res['body']:[]; } catch (Exception $error) { if (!($error instanceof TeaError)) { $error = new TeaError([], $error->getMessage(), $error->getCode(), $error); } return $error->message; // 如有需要,请打印 error Utils::assertAsString($error->message); } } /** * @param $uniacid * @功能说明:解除绑定 * @author chenniang * @DataTime: 2022-12-08 11:57 */ public function delBind($uniacid,$subsId,$phoneX,$poolKey){ $client = self::createClient($uniacid); $unbindSubscriptionRequest = new UnbindSubscriptionRequest([ "subsId" => $subsId, "secretNo" => $phoneX, "productType" => "AXB_170", "poolKey" => $poolKey ]); $runtime = new RuntimeOptions([]); try { // 复制代码运行请自行打印 API 的返回值 $res = $client->unbindSubscriptionWithOptions($unbindSubscriptionRequest, $runtime); $res = object_array($res); return !empty($res['body'])?$res['body']:[]; } catch (Exception $error) { if (!($error instanceof TeaError)) { $error = new TeaError([], $error->getMessage(), $error->getCode(), $error); } // 如有需要,请打印 error Utils::assertAsString($error->message); } } }