Commit 18537c76 authored by Administrator's avatar Administrator

Merge tag 'device_location_map' into develop

no message
parents 39ed76e6 e1c3b4e7
......@@ -10,6 +10,8 @@ use Illuminate\Support\Facades\Redis;
use App\Http\Controllers\DevicesController;
use Illuminate\Support\Facades\Config;
use App\Http\Controllers\Auth\SwooleCommandMeTcpController;
use App\Http\Controllers\SmsailiyunController;
use Illuminate\Support\Facades\Log;
class ZehongTcpController extends Controller
{
......@@ -35,15 +37,15 @@ class ZehongTcpController extends Controller
$devicecrc = substr($data, 22, 4);
$isdata = substr($data, 0, 22);
// return $this->jsonSuccessData([$this->getPrc($isdata),$devicecrc]);
if($this->getPrc($isdata) == $devicecrc){
$data = ['id'=>$deviceId,'status'=>$status,'np'=>$devicenp,'famen'=>$devicefamen,'chongqi'=>$devicechongqi,'zijian'=>$devicezijian];
$totcp = json_decode($this->mysqldb($data),true);
if ($totcp == "No equipment"){
if ($this->getPrc($isdata) == $devicecrc) {
$data = ['id' => $deviceId, 'status' => $status, 'np' => $devicenp, 'famen' => $devicefamen, 'chongqi' => $devicechongqi, 'zijian' => $devicezijian];
$totcp = json_decode($this->mysqldb($data), true);
if ($totcp == "No equipment") {
return $totcp;
}
$totcpdata = $totcp['devicenum'] . $totcp['device_control'] . $devicechongqi . $devicezijian;
$crcdata = $this->getPrc($totcpdata);
return $totcpdata .$crcdata ;
return $totcpdata . $crcdata;
}
} else {
return "Data format error";
......@@ -78,32 +80,55 @@ class ZehongTcpController extends Controller
}
}
//return the result as HEX-formatted string
$data = strrev(sprintf('%04X', $crc));
$data = strrev(sprintf('%04X', $crc));
$crc1 = strrev(substr($data, 0, 2));
$crc2 = strrev(substr($data, 2, 2));
return $crc1 . $crc2;
}
//获取上报数据从数据库查询
public function mysqldb($data){
if($data != []){
public function mysqldb($data)
{
if ($data != []) {
// 报警提醒
$meTcp = new SwooleCommandMeTcpController();
$alarmData = $data['id'] . '/' . $data['status'] . '/' . $data['np'];
$meTcp->swooletcplist($alarmData);
// $meTcp = new SwooleCommandMeTcpController();
// $alarmData = $data['id'] . '/' . $data['status'] . '/' . $data['np'];
// $meTcp->swooletcplist($alarmData);
$this->smsphone($data);
$datainfo = DB::table('device')
->where('devicenum','=',$data['id'])
->update(['nd'=>intval($data['np']),'devicepolice'=>$data['status'] == 0 ? '1' : $data['status'],'update_time'=>time(),'shutoff_status'=>$data['famen']]);
->where('devicenum', '=', $data['id'])
->update(['nd' => intval($data['np']), 'devicepolice' => $data['status'] == 0 ? '1' : $data['status'], 'update_time' => time(), 'shutoff_status' => $data['famen']]);
$todata = DB::table('device')
->where('devicenum','=',$data['id'])
->select('devicenum','nd','device_control','devicepolice')
->where('devicenum', '=', $data['id'])
->select('devicenum', 'nd', 'device_control', 'devicepolice')
->first();
if ($todata){
if ($todata) {
return json_encode($todata);
}else{
} else {
return json_encode("No equipment");
}
}
}
// 发送手机报警信息
public function smsphone($data)
{
if (Redis::get($data['id']) == '') {
if ($data['status'] != 1 || $data['status'] != 0) {
$sms = new SmsailiyunController();
$code1 = json_encode($sms->sendSms());
$code = json_decode($code1,true);
Log::channel('slack')->info('短信发送初始化 =>' . $code1 . '设备号=>' . $data['id']);
if ($code['Message'] == 'OK' && $code['Code'] == 'OK') {
Redis::set($data['id'], $code1);
Log::channel('slack')->info('短信发送结束 =>' . $code1 . '设备号=>' . $data['id']);
}
}
} else {
if ($data['status'] == 1 || $data['status'] == 0) {
Redis::del($data['id']);
}
}
}
}
<?php
namespace App\Http\Controllers;
require_once app_path() . '/aliyunsdk/api_sdk/vendor/autoload.php';
use Aliyun\Core\Config;
use Aliyun\Core\Profile\DefaultProfile;
use Aliyun\Core\DefaultAcsClient;
use Aliyun\Api\Sms\Request\V20170525\SendSmsRequest;
use Aliyun\Api\Sms\Request\V20170525\SendBatchSmsRequest;
use Aliyun\Api\Sms\Request\V20170525\QuerySendDetailsRequest;
Config::load();
class SmsailiyunController
{
static $acsClient = null;
/**
* 取得AcsClient
*
* @return DefaultAcsClient
*/
public static function getAcsClient() {
//产品名称:云通信短信服务API产品,开发者无需替换
$product = "Dysmsapi";
//产品域名,开发者无需替换
$domain = "https://dysmsapi.aliyuncs.com";
$accessKeyId = "LTAI2xiZNF3iV2aV"; // AccessKeyId
$accessKeySecret = "bprEWwn1M0xgglRQCQEMYSPiYctDk4"; // AccessKeySecret
// 暂时不支持多Region
$region = "cn-beijing";
// 服务结点
$endPointName = "cn-hangzhou";
if(static::$acsClient == null) {
//初始化acsClient,暂不支持region化
$profile = DefaultProfile::getProfile($region, $accessKeyId, $accessKeySecret);
// 增加服务结点
DefaultProfile::addEndpoint($endPointName, $region, $product, $domain);
// 初始化AcsClient用于发起请求
static::$acsClient = new DefaultAcsClient($profile);
}
return static::$acsClient;
}
/**
* 发送短信
* @return stdClass
*/
public static function sendSms() {
// 初始化SendSmsRequest实例用于设置发送短信的参数
$request = new SendSmsRequest();
//可选-启用https协议
//$request->setProtocol("https");
// 必填,设置短信接收号码
// 15200013720
$request->setPhoneNumbers("15200013720");
// 必填,设置签名名称,应严格按"签名名称"填写,请参考: https://dysms.console.aliyun.com/dysms.htm#/develop/sign
$request->setSignName("泽宏云");
// 必填,设置模板CODE,应严格按"模板CODE"填写, 请参考: https://dysms.console.aliyun.com/dysms.htm#/develop/template
$request->setTemplateCode("SMS_169897307");
// 可选,设置模板参数, 假如模板中存在变量需要替换则为必填项
$request->setTemplateParam(json_encode(array( // 短信模板中字段的值
"cphone"=>"15200013720",
"position"=>"您的设备尾号为" . 4274,
"alarm" => '报警'
), JSON_UNESCAPED_UNICODE));
// ['cphone' => 16631150870, 'position' => '您的设备尾号为' . 5712, 'alarm' => '离线']
// 可选,设置流水号
$request->setOutId("yourOutId");
// 选填,上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
$request->setSmsUpExtendCode("1234567");
// 发起访问请求
$acsResponse = static::getAcsClient()->getAcsResponse($request);
return $acsResponse;
}
/**
* 批量发送短信
* @return stdClass
*/
public static function sendBatchSms() {
// 初始化SendSmsRequest实例用于设置发送短信的参数
$request = new SendBatchSmsRequest();
//可选-启用https协议
//$request->setProtocol("https");
// 必填:待发送手机号。支持JSON格式的批量调用,批量上限为100个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
$request->setPhoneNumberJson(json_encode(array(
"1500000000",
"1500000001",
), JSON_UNESCAPED_UNICODE));
// 必填:短信签名-支持不同的号码发送不同的短信签名
$request->setSignNameJson(json_encode(array(
"云通信",
"云通信"
), JSON_UNESCAPED_UNICODE));
// 必填:短信模板-可在短信控制台中找到
$request->setTemplateCode("SMS_1000000");
// 必填:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
// 友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
$request->setTemplateParamJson(json_encode(array(
array(
"name" => "Tom",
"code" => "123",
),
array(
"name" => "Jack",
"code" => "456",
),
), JSON_UNESCAPED_UNICODE));
// 可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
// $request->setSmsUpExtendCodeJson("[\"90997\",\"90998\"]");
// 发起访问请求
$acsResponse = static::getAcsClient()->getAcsResponse($request);
return $acsResponse;
}
/**
* 短信发送记录查询
* @return stdClass
*/
public static function querySendDetails() {
// 初始化QuerySendDetailsRequest实例用于设置短信查询的参数
$request = new QuerySendDetailsRequest();
//可选-启用https协议
//$request->setProtocol("https");
// 必填,短信接收号码
$request->setPhoneNumber("12345678901");
// 必填,短信发送日期,格式Ymd,支持近30天记录查询
$request->setSendDate("20170718");
// 必填,分页大小
$request->setPageSize(10);
// 必填,当前页码
$request->setCurrentPage(1);
// 选填,短信发送流水号
$request->setBizId("yourBizId");
// 发起访问请求
$acsResponse = static::getAcsClient()->getAcsResponse($request);
return $acsResponse;
}
}
......@@ -25,6 +25,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Env;
use Illuminate\Support\Facades\Hash;
use Validator;
use App\Http\Controllers\SmsailiyunController;
/**
* Class UserController
......@@ -465,12 +466,12 @@ class UserController extends Controller
if ($areaid == '') {
return $this->jsonErrorData('105', '地区id不能为空');
}
$area = Db::table('areachina')->where('pid', '=', $areaid)
$area = Db::table('areachina')->where('pid', '=', $areaid)
->where('status', '=', '1')
->select('area_name', 'areaid')
->get();
} else {
$area = Db::table('areachina')->where('pid', '=', '0')
$area = Db::table('areachina')->where('pid', '=', '0')
->where('status', '=', '1')
->select('area_name', 'areaid')
->get();
......@@ -542,7 +543,7 @@ class UserController extends Controller
->get()->toArray();
} else {
$davicenum = DB::table('users as b')
->where('uid','=',Auth::id())
->where('uid', '=', Auth::id())
->leftjoin('device as d', 'b.id', '=', 'd.uid')
->leftjoin('device_type as t', 'd.dtype', '=', 't.tid')
->selectRaw('b.name,b.id,b.mapcenter,d.devicenum,COUNT(d.id) AS UserDaviceNum,COUNT(IF(d.devicepolice <> 1, true, null)) AS police')
......@@ -562,8 +563,10 @@ class UserController extends Controller
return $this->jsonSuccessData(['paper' => $paper, 'stutus' => $stutus]);
}
public function textcountuser()
public function textcountuser(Request $request)
{
print_r(Auth::id());
// https://dysmsapi.aliyuncs.com?
$sms = new SmsailiyunController();
print_r(json_encode($sms->sendSms(),true));
}
}
<?php
ini_set("display_errors", "on");
require_once dirname(__DIR__) . '/api_sdk/vendor/autoload.php';
use Aliyun\Core\Config;
use Aliyun\Core\Profile\DefaultProfile;
use Aliyun\Core\DefaultAcsClient;
use Aliyun\Api\Sms\Request\V20170525\SendSmsRequest;
use Aliyun\Api\Sms\Request\V20170525\SendBatchSmsRequest;
use Aliyun\Api\Sms\Request\V20170525\QuerySendDetailsRequest;
// 加载区域结点配置
Config::load();
/**
* Class SmsDemo
*
* 这是短信服务API产品的DEMO程序,直接执行此文件即可体验短信服务产品API功能
* (只需要将AK替换成开通了云通信-短信服务产品功能的AK即可)
* 备注:Demo工程编码采用UTF-8
*/
class SmsDemo
{
static $acsClient = null;
/**
* 取得AcsClient
*
* @return DefaultAcsClient
*/
public static function getAcsClient() {
//产品名称:云通信短信服务API产品,开发者无需替换
$product = "Dysmsapi";
//产品域名,开发者无需替换
$domain = "dysmsapi.aliyuncs.com";
// TODO 此处需要替换成开发者自己的AK (https://ak-console.aliyun.com/)
$accessKeyId = "yourAccessKeyId"; // AccessKeyId
$accessKeySecret = "yourAccessKeySecret"; // AccessKeySecret
// 暂时不支持多Region
$region = "cn-hangzhou";
// 服务结点
$endPointName = "cn-hangzhou";
if(static::$acsClient == null) {
//初始化acsClient,暂不支持region化
$profile = DefaultProfile::getProfile($region, $accessKeyId, $accessKeySecret);
// 增加服务结点
DefaultProfile::addEndpoint($endPointName, $region, $product, $domain);
// 初始化AcsClient用于发起请求
static::$acsClient = new DefaultAcsClient($profile);
}
return static::$acsClient;
}
/**
* 发送短信
* @return stdClass
*/
public static function sendSms() {
// 初始化SendSmsRequest实例用于设置发送短信的参数
$request = new SendSmsRequest();
//可选-启用https协议
//$request->setProtocol("https");
// 必填,设置短信接收号码
$request->setPhoneNumbers("12345678901");
// 必填,设置签名名称,应严格按"签名名称"填写,请参考: https://dysms.console.aliyun.com/dysms.htm#/develop/sign
$request->setSignName("短信签名");
// 必填,设置模板CODE,应严格按"模板CODE"填写, 请参考: https://dysms.console.aliyun.com/dysms.htm#/develop/template
$request->setTemplateCode("SMS_0000001");
// 可选,设置模板参数, 假如模板中存在变量需要替换则为必填项
$request->setTemplateParam(json_encode(array( // 短信模板中字段的值
"code"=>"12345",
"product"=>"dsd"
), JSON_UNESCAPED_UNICODE));
// 可选,设置流水号
$request->setOutId("yourOutId");
// 选填,上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
$request->setSmsUpExtendCode("1234567");
// 发起访问请求
$acsResponse = static::getAcsClient()->getAcsResponse($request);
return $acsResponse;
}
/**
* 批量发送短信
* @return stdClass
*/
public static function sendBatchSms() {
// 初始化SendSmsRequest实例用于设置发送短信的参数
$request = new SendBatchSmsRequest();
//可选-启用https协议
//$request->setProtocol("https");
// 必填:待发送手机号。支持JSON格式的批量调用,批量上限为100个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
$request->setPhoneNumberJson(json_encode(array(
"1500000000",
"1500000001",
), JSON_UNESCAPED_UNICODE));
// 必填:短信签名-支持不同的号码发送不同的短信签名
$request->setSignNameJson(json_encode(array(
"云通信",
"云通信"
), JSON_UNESCAPED_UNICODE));
// 必填:短信模板-可在短信控制台中找到
$request->setTemplateCode("SMS_1000000");
// 必填:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
// 友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
$request->setTemplateParamJson(json_encode(array(
array(
"name" => "Tom",
"code" => "123",
),
array(
"name" => "Jack",
"code" => "456",
),
), JSON_UNESCAPED_UNICODE));
// 可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
// $request->setSmsUpExtendCodeJson("[\"90997\",\"90998\"]");
// 发起访问请求
$acsResponse = static::getAcsClient()->getAcsResponse($request);
return $acsResponse;
}
/**
* 短信发送记录查询
* @return stdClass
*/
public static function querySendDetails() {
// 初始化QuerySendDetailsRequest实例用于设置短信查询的参数
$request = new QuerySendDetailsRequest();
//可选-启用https协议
//$request->setProtocol("https");
// 必填,短信接收号码
$request->setPhoneNumber("12345678901");
// 必填,短信发送日期,格式Ymd,支持近30天记录查询
$request->setSendDate("20170718");
// 必填,分页大小
$request->setPageSize(10);
// 必填,当前页码
$request->setCurrentPage(1);
// 选填,短信发送流水号
$request->setBizId("yourBizId");
// 发起访问请求
$acsResponse = static::getAcsClient()->getAcsResponse($request);
return $acsResponse;
}
}
// 调用示例:
set_time_limit(0);
header('Content-Type: text/plain; charset=utf-8');
$response = SmsDemo::sendSms();
echo "发送短信(sendSms)接口返回的结果:\n";
print_r($response);
sleep(2);
$response = SmsDemo::sendBatchSms();
echo "批量发送短信(sendBatchSms)接口返回的结果:\n";
print_r($response);
sleep(2);
$response = SmsDemo::querySendDetails();
echo "查询短信发送情况(querySendDetails)接口返回的结果:\n";
print_r($response);
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
{
"name": "aliyuncs/aliyun-dysms-php-sdk",
"description": "Aliyun SMS SDK for PHP",
"keywords": [ "aliyun", "SMS", "sdk" ],
"type": "library",
"license": "Apache-2.0",
"homepage": "https://www.aliyun.com/product/sms",
"authors": [
{
"name": "Aliyuncs",
"homepage": "https://www.aliyun.com"
}
],
"require": {
"php": ">=5.5.0"
},
"require-dev": {},
"minimum-stability": "stable",
"autoload": {
"psr-4": {
"Aliyun\\": "lib/"
}
}
}
\ No newline at end of file
<?php
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace Aliyun\Api\Sms\Request\V20170525;
use Aliyun\Core\RpcAcsRequest;
class QueryInterSmsIsoInfoRequest extends RpcAcsRequest
{
function __construct()
{
parent::__construct("Dysmsapi", "2017-05-25", "QueryInterSmsIsoInfo");
$this->setMethod("POST");
}
private $resourceOwnerAccount;
private $countryName;
private $resourceOwnerId;
private $ownerId;
public function getResourceOwnerAccount() {
return $this->resourceOwnerAccount;
}
public function setResourceOwnerAccount($resourceOwnerAccount) {
$this->resourceOwnerAccount = $resourceOwnerAccount;
$this->queryParameters["ResourceOwnerAccount"]=$resourceOwnerAccount;
}
public function getCountryName() {
return $this->countryName;
}
public function setCountryName($countryName) {
$this->countryName = $countryName;
$this->queryParameters["CountryName"]=$countryName;
}
public function getResourceOwnerId() {
return $this->resourceOwnerId;
}
public function setResourceOwnerId($resourceOwnerId) {
$this->resourceOwnerId = $resourceOwnerId;
$this->queryParameters["ResourceOwnerId"]=$resourceOwnerId;
}
public function getOwnerId() {
return $this->ownerId;
}
public function setOwnerId($ownerId) {
$this->ownerId = $ownerId;
$this->queryParameters["OwnerId"]=$ownerId;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Api\Sms\Request\V20170525;
use Aliyun\Core\RpcAcsRequest;
class QuerySendDetailsRequest extends RpcAcsRequest
{
function __construct()
{
parent::__construct("Dysmsapi", "2017-05-25", "QuerySendDetails");
$this->setMethod("POST");
}
private $sendDate;
private $pageSize;
private $phoneNumber;
private $resourceOwnerAccount;
private $currentPage;
private $bizId;
private $resourceOwnerId;
private $ownerId;
public function getSendDate() {
return $this->sendDate;
}
public function setSendDate($sendDate) {
$this->sendDate = $sendDate;
$this->queryParameters["SendDate"]=$sendDate;
}
public function getPageSize() {
return $this->pageSize;
}
public function setPageSize($pageSize) {
$this->pageSize = $pageSize;
$this->queryParameters["PageSize"]=$pageSize;
}
public function getPhoneNumber() {
return $this->phoneNumber;
}
public function setPhoneNumber($phoneNumber) {
$this->phoneNumber = $phoneNumber;
$this->queryParameters["PhoneNumber"]=$phoneNumber;
}
public function getResourceOwnerAccount() {
return $this->resourceOwnerAccount;
}
public function setResourceOwnerAccount($resourceOwnerAccount) {
$this->resourceOwnerAccount = $resourceOwnerAccount;
$this->queryParameters["ResourceOwnerAccount"]=$resourceOwnerAccount;
}
public function getCurrentPage() {
return $this->currentPage;
}
public function setCurrentPage($currentPage) {
$this->currentPage = $currentPage;
$this->queryParameters["CurrentPage"]=$currentPage;
}
public function getBizId() {
return $this->bizId;
}
public function setBizId($bizId) {
$this->bizId = $bizId;
$this->queryParameters["BizId"]=$bizId;
}
public function getResourceOwnerId() {
return $this->resourceOwnerId;
}
public function setResourceOwnerId($resourceOwnerId) {
$this->resourceOwnerId = $resourceOwnerId;
$this->queryParameters["ResourceOwnerId"]=$resourceOwnerId;
}
public function getOwnerId() {
return $this->ownerId;
}
public function setOwnerId($ownerId) {
$this->ownerId = $ownerId;
$this->queryParameters["OwnerId"]=$ownerId;
}
}
\ No newline at end of file
<?php
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace Aliyun\Api\Sms\Request\V20170525;
use Aliyun\Core\RpcAcsRequest;
class SendBatchSmsRequest extends RpcAcsRequest
{
function __construct()
{
parent::__construct("Dysmsapi", "2017-05-25", "SendBatchSms");
$this->setMethod("POST");
}
private $templateCode;
private $templateParamJson;
private $resourceOwnerAccount;
private $smsUpExtendCodeJson;
private $resourceOwnerId;
private $signNameJson;
private $ownerId;
private $phoneNumberJson;
public function getTemplateCode() {
return $this->templateCode;
}
public function setTemplateCode($templateCode) {
$this->templateCode = $templateCode;
$this->queryParameters["TemplateCode"]=$templateCode;
}
public function getTemplateParamJson() {
return $this->templateParamJson;
}
public function setTemplateParamJson($templateParamJson) {
$this->templateParamJson = $templateParamJson;
$this->queryParameters["TemplateParamJson"]=$templateParamJson;
}
public function getResourceOwnerAccount() {
return $this->resourceOwnerAccount;
}
public function setResourceOwnerAccount($resourceOwnerAccount) {
$this->resourceOwnerAccount = $resourceOwnerAccount;
$this->queryParameters["ResourceOwnerAccount"]=$resourceOwnerAccount;
}
public function getSmsUpExtendCodeJson() {
return $this->smsUpExtendCodeJson;
}
public function setSmsUpExtendCodeJson($smsUpExtendCodeJson) {
$this->smsUpExtendCodeJson = $smsUpExtendCodeJson;
$this->queryParameters["SmsUpExtendCodeJson"]=$smsUpExtendCodeJson;
}
public function getResourceOwnerId() {
return $this->resourceOwnerId;
}
public function setResourceOwnerId($resourceOwnerId) {
$this->resourceOwnerId = $resourceOwnerId;
$this->queryParameters["ResourceOwnerId"]=$resourceOwnerId;
}
public function getSignNameJson() {
return $this->signNameJson;
}
public function setSignNameJson($signNameJson) {
$this->signNameJson = $signNameJson;
$this->queryParameters["SignNameJson"]=$signNameJson;
}
public function getOwnerId() {
return $this->ownerId;
}
public function setOwnerId($ownerId) {
$this->ownerId = $ownerId;
$this->queryParameters["OwnerId"]=$ownerId;
}
public function getPhoneNumberJson() {
return $this->phoneNumberJson;
}
public function setPhoneNumberJson($phoneNumberJson) {
$this->phoneNumberJson = $phoneNumberJson;
$this->queryParameters["PhoneNumberJson"]=$phoneNumberJson;
}
}
\ No newline at end of file
<?php
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace Aliyun\Api\Sms\Request\V20170525;
use Aliyun\Core\RpcAcsRequest;
class SendInterSmsRequest extends RpcAcsRequest
{
function __construct()
{
parent::__construct("Dysmsapi", "2017-05-25", "SendInterSms");
$this->setMethod("POST");
}
private $templateCode;
private $phoneNumbers;
private $countryCode;
private $signName;
private $resourceOwnerAccount;
private $templateParam;
private $resourceOwnerId;
private $ownerId;
private $outId;
public function getTemplateCode() {
return $this->templateCode;
}
public function setTemplateCode($templateCode) {
$this->templateCode = $templateCode;
$this->queryParameters["TemplateCode"]=$templateCode;
}
public function getPhoneNumbers() {
return $this->phoneNumbers;
}
public function setPhoneNumbers($phoneNumbers) {
$this->phoneNumbers = $phoneNumbers;
$this->queryParameters["PhoneNumbers"]=$phoneNumbers;
}
public function getCountryCode() {
return $this->countryCode;
}
public function setCountryCode($countryCode) {
$this->countryCode = $countryCode;
$this->queryParameters["CountryCode"]=$countryCode;
}
public function getSignName() {
return $this->signName;
}
public function setSignName($signName) {
$this->signName = $signName;
$this->queryParameters["SignName"]=$signName;
}
public function getResourceOwnerAccount() {
return $this->resourceOwnerAccount;
}
public function setResourceOwnerAccount($resourceOwnerAccount) {
$this->resourceOwnerAccount = $resourceOwnerAccount;
$this->queryParameters["ResourceOwnerAccount"]=$resourceOwnerAccount;
}
public function getTemplateParam() {
return $this->templateParam;
}
public function setTemplateParam($templateParam) {
$this->templateParam = $templateParam;
$this->queryParameters["TemplateParam"]=$templateParam;
}
public function getResourceOwnerId() {
return $this->resourceOwnerId;
}
public function setResourceOwnerId($resourceOwnerId) {
$this->resourceOwnerId = $resourceOwnerId;
$this->queryParameters["ResourceOwnerId"]=$resourceOwnerId;
}
public function getOwnerId() {
return $this->ownerId;
}
public function setOwnerId($ownerId) {
$this->ownerId = $ownerId;
$this->queryParameters["OwnerId"]=$ownerId;
}
public function getOutId() {
return $this->outId;
}
public function setOutId($outId) {
$this->outId = $outId;
$this->queryParameters["OutId"]=$outId;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Api\Sms\Request\V20170525;
use Aliyun\Core\RpcAcsRequest;
class SendSmsRequest extends RpcAcsRequest
{
public function __construct()
{
parent::__construct("Dysmsapi", "2017-05-25", "SendSms");
$this->setMethod("POST");
}
private $templateCode;
private $phoneNumbers;
private $signName;
private $resourceOwnerAccount;
private $templateParam;
private $resourceOwnerId;
private $ownerId;
private $outId;
private $smsUpExtendCode;
public function getTemplateCode() {
return $this->templateCode;
}
public function setTemplateCode($templateCode) {
$this->templateCode = $templateCode;
$this->queryParameters["TemplateCode"]=$templateCode;
}
public function getPhoneNumbers() {
return $this->phoneNumbers;
}
public function setPhoneNumbers($phoneNumbers) {
$this->phoneNumbers = $phoneNumbers;
$this->queryParameters["PhoneNumbers"]=$phoneNumbers;
}
public function getSignName() {
return $this->signName;
}
public function setSignName($signName) {
$this->signName = $signName;
$this->queryParameters["SignName"]=$signName;
}
public function getResourceOwnerAccount() {
return $this->resourceOwnerAccount;
}
public function setResourceOwnerAccount($resourceOwnerAccount) {
$this->resourceOwnerAccount = $resourceOwnerAccount;
$this->queryParameters["ResourceOwnerAccount"]=$resourceOwnerAccount;
}
public function getTemplateParam() {
return $this->templateParam;
}
public function setTemplateParam($templateParam) {
$this->templateParam = $templateParam;
$this->queryParameters["TemplateParam"]=$templateParam;
}
public function getResourceOwnerId() {
return $this->resourceOwnerId;
}
public function setResourceOwnerId($resourceOwnerId) {
$this->resourceOwnerId = $resourceOwnerId;
$this->queryParameters["ResourceOwnerId"]=$resourceOwnerId;
}
public function getOwnerId() {
return $this->ownerId;
}
public function setOwnerId($ownerId) {
$this->ownerId = $ownerId;
$this->queryParameters["OwnerId"]=$ownerId;
}
public function getOutId() {
return $this->outId;
}
public function setOutId($outId) {
$this->outId = $outId;
$this->queryParameters["OutId"]=$outId;
}
public function getSmsUpExtendCode() {
return $this->smsUpExtendCode;
}
public function setSmsUpExtendCode($smsUpExtendCode) {
$this->smsUpExtendCode = $smsUpExtendCode;
$this->queryParameters["SmsUpExtendCode"]=$smsUpExtendCode;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core;
abstract class AcsRequest
{
protected $version;
protected $product;
protected $actionName;
protected $regionId;
protected $acceptFormat;
protected $method;
protected $protocolType = "http";
protected $content;
protected $queryParameters = array();
protected $headers = array();
function __construct($product, $version, $actionName)
{
$this->headers["x-sdk-client"] = "php/2.0.0";
$this->product = $product;
$this->version = $version;
$this->actionName = $actionName;
}
public abstract function composeUrl($iSigner, $credential, $domain);
public function getVersion()
{
return $this->version;
}
public function setVersion($version)
{
$this->version = $version;
}
public function getProduct()
{
return $this->product;
}
public function setProduct($product)
{
$this->product = $product;
}
public function getActionName()
{
return $this->actionName;
}
public function setActionName($actionName)
{
$this->actionName = $actionName;
}
public function getAcceptFormat()
{
return $this->acceptFormat;
}
public function setAcceptFormat($acceptFormat)
{
$this->acceptFormat = $acceptFormat;
}
public function getQueryParameters()
{
return $this->queryParameters;
}
public function getHeaders()
{
return $this->headers;
}
public function getMethod()
{
return $this->method;
}
public function setMethod($method)
{
$this->method = $method;
}
public function getProtocol()
{
return $this->protocolType;
}
public function setProtocol($protocol)
{
$this->protocolType = $protocol;
}
public function getRegionId()
{
return $this->regionId;
}
public function setRegionId($region)
{
$this->regionId = $region;
}
public function getContent()
{
return $this->content;
}
public function setContent($content)
{
$this->content = $content;
}
public function addHeader($headerKey, $headerValue)
{
$this->headers[$headerKey] = $headerValue;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core;
class AcsResponse
{
private $code;
private $message;
public function getCode()
{
return $this->code;
}
public function setCode($code)
{
$this->code = $code;
}
public function getMessage()
{
return $this->message;
}
public function setMessage($message)
{
$this->message = $message;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core\Auth;
class Credential
{
private $dateTimeFormat = 'Y-m-d\TH:i:s\Z';
private $refreshDate;
private $expiredDate;
private $accessKeyId;
private $accessSecret;
private $securityToken;
function __construct($accessKeyId, $accessSecret)
{
$this->accessKeyId = $accessKeyId;
$this->accessSecret = $accessSecret;
$this->refreshDate = date($this->dateTimeFormat);
}
public function isExpired()
{
if($this->expiredDate == null)
{
return false;
}
if(strtotime($this->expiredDate)>date($this->dateTimeFormat))
{
return false;
}
return true;
}
public function getRefreshDate()
{
return $this->refreshDate;
}
public function getExpiredDate()
{
return $this->expiredDate;
}
public function setExpiredDate($expiredHours)
{
if($expiredHours>0)
{
return $this->expiredDate = date($this->dateTimeFormat, strtotime("+".$expiredHours." hour"));
}
}
public function getAccessKeyId()
{
return $this->accessKeyId;
}
public function setAccessKeyId($accessKeyId)
{
$this->accessKeyId = $accessKeyId;
}
public function getAccessSecret()
{
return $this->accessSecret;
}
public function setAccessSecret($accessSecret)
{
$this->accessSecret = $accessSecret;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core\Auth;
interface ISigner
{
public function getSignatureMethod();
public function getSignatureVersion();
public function signString($source, $accessSecret);
}
\ No newline at end of file
<?php
namespace Aliyun\Core\Auth;
class ShaHmac1Signer implements ISigner
{
public function signString($source, $accessSecret)
{
return base64_encode(hash_hmac('sha1', $source, $accessSecret, true));
}
public function getSignatureMethod() {
return "HMAC-SHA1";
}
public function getSignatureVersion() {
return "1.0";
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core\Auth;
class ShaHmac256Signer implements ISigner
{
public function signString($source, $accessSecret)
{
return base64_encode(hash_hmac('sha256', $source, $accessSecret, true));
}
public function getSignatureMethod() {
return "HMAC-SHA256";
}
public function getSignatureVersion() {
return "1.0";
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core;
use Aliyun\Core\Regions\EndpointConfig;
//config http proxy
define('ENABLE_HTTP_PROXY', FALSE);
define('HTTP_PROXY_IP', '127.0.0.1');
define('HTTP_PROXY_PORT', '8888');
class Config
{
private static $loaded = false;
public static function load(){
if(self::$loaded) {
return;
}
EndpointConfig::load();
self::$loaded = true;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core;
use Aliyun\Core\Exception\ClientException;
use Aliyun\Core\Exception\ServerException;
use Aliyun\Core\Regions\EndpointProvider;
use Aliyun\Core\Http\HttpHelper;
class DefaultAcsClient implements IAcsClient
{
public $iClientProfile;
public $__urlTestFlag__;
function __construct($iClientProfile)
{
$this->iClientProfile = $iClientProfile;
$this->__urlTestFlag__ = false;
}
public function getAcsResponse($request, $iSigner = null, $credential = null, $autoRetry = true, $maxRetryNumber = 3)
{
$httpResponse = $this->doActionImpl($request, $iSigner, $credential, $autoRetry, $maxRetryNumber);
$respObject = $this->parseAcsResponse($httpResponse->getBody(), $request->getAcceptFormat());
if(false == $httpResponse->isSuccess())
{
$this->buildApiException($respObject, $httpResponse->getStatus());
}
return $respObject;
}
private function doActionImpl($request, $iSigner = null, $credential = null, $autoRetry = true, $maxRetryNumber = 3)
{
if(null == $this->iClientProfile && (null == $iSigner || null == $credential
|| null == $request->getRegionId() || null == $request->getAcceptFormat()))
{
throw new ClientException("No active profile found.", "SDK.InvalidProfile");
}
if(null == $iSigner)
{
$iSigner = $this->iClientProfile->getSigner();
}
if(null == $credential)
{
$credential = $this->iClientProfile->getCredential();
}
$request = $this->prepareRequest($request);
$domain = EndpointProvider::findProductDomain($request->getRegionId(), $request->getProduct());
if(null == $domain)
{
throw new ClientException("Can not find endpoint to access.", "SDK.InvalidRegionId");
}
$requestUrl = $request->composeUrl($iSigner, $credential, $domain);
if ($this->__urlTestFlag__) {
throw new ClientException($requestUrl, "URLTestFlagIsSet");
}
if(count($request->getDomainParameter())>0){
$httpResponse = HttpHelper::curl($requestUrl, $request->getMethod(), $request->getDomainParameter(), $request->getHeaders());
} else {
$httpResponse = HttpHelper::curl($requestUrl, $request->getMethod(), $request->getContent(), $request->getHeaders());
}
$retryTimes = 1;
while (500 <= $httpResponse->getStatus() && $autoRetry && $retryTimes < $maxRetryNumber) {
$requestUrl = $request->composeUrl($iSigner, $credential,$domain);
if(count($request->getDomainParameter())>0){
$httpResponse = HttpHelper::curl($requestUrl, $request->getMethod(), $request->getDomainParameter(), $request->getHeaders());
} else {
$httpResponse = HttpHelper::curl($requestUrl, $request->getMethod(), $request->getContent(), $request->getHeaders());
}
$retryTimes ++;
}
return $httpResponse;
}
public function doAction($request, $iSigner = null, $credential = null, $autoRetry = true, $maxRetryNumber = 3)
{
trigger_error("doAction() is deprecated. Please use getAcsResponse() instead.", E_USER_NOTICE);
return $this->doActionImpl($request, $iSigner, $credential, $autoRetry, $maxRetryNumber);
}
private function prepareRequest($request)
{
if(null == $request->getRegionId())
{
$request->setRegionId($this->iClientProfile->getRegionId());
}
if(null == $request->getAcceptFormat())
{
$request->setAcceptFormat($this->iClientProfile->getFormat());
}
if(null == $request->getMethod())
{
$request->setMethod("GET");
}
return $request;
}
private function buildApiException($respObject, $httpStatus)
{
throw new ServerException($respObject->Message, $respObject->Code, $httpStatus, $respObject->RequestId);
}
private function parseAcsResponse($body, $format)
{
if ("JSON" == $format)
{
$respObject = json_decode($body);
}
else if("XML" == $format)
{
$respObject = @simplexml_load_string($body);
}
else if("RAW" == $format)
{
$respObject = $body;
}
return $respObject;
}
}
<?php
namespace Aliyun\Core\Exception;
class ClientException extends \Exception
{
function __construct($errorMessage, $errorCode)
{
parent::__construct($errorMessage);
$this->errorMessage = $errorMessage;
$this->errorCode = $errorCode;
$this->setErrorType("Client");
}
private $errorCode;
private $errorMessage;
private $errorType;
public function getErrorCode()
{
return $this->errorCode;
}
public function setErrorCode($errorCode)
{
$this->errorCode = $errorCode;
}
public function getErrorMessage()
{
return $this->errorMessage;
}
public function setErrorMessage($errorMessage)
{
$this->errorMessage = $errorMessage;
}
public function getErrorType()
{
return $this->errorType;
}
public function setErrorType($errorType)
{
$this->errorType = $errorType;
}
}
<?php
namespace Aliyun\Core\Exception;
class ServerException extends ClientException
{
private $httpStatus;
private $requestId;
function __construct($errorMessage, $errorCode, $httpStatus, $requestId)
{
$messageStr = $errorCode . " " . $errorMessage . " HTTP Status: " . $httpStatus . " RequestID: " . $requestId;
parent::__construct($messageStr, $errorCode);
$this->setErrorMessage($errorMessage);
$this->setErrorType("Server");
$this->httpStatus = $httpStatus;
$this->requestId = $requestId;
}
public function getHttpStatus()
{
return $this->httpStatus;
}
public function getRequestId()
{
return $this->requestId;
}
}
<?php
namespace Aliyun\Core\Http;
use Aliyun\Core\Exception\ClientException;
class HttpHelper
{
public static $connectTimeout = 30;//30 second
public static $readTimeout = 80;//80 second
public static function curl($url, $httpMethod = "GET", $postFields = null,$headers = null)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $httpMethod);
if(ENABLE_HTTP_PROXY) {
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_PROXY, HTTP_PROXY_IP);
curl_setopt($ch, CURLOPT_PROXYPORT, HTTP_PROXY_PORT);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($postFields) ? self::getPostHttpBody($postFields) : $postFields);
if (self::$readTimeout) {
curl_setopt($ch, CURLOPT_TIMEOUT, self::$readTimeout);
}
if (self::$connectTimeout) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::$connectTimeout);
}
//https request
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
if (is_array($headers) && 0 < count($headers))
{
$httpHeaders =self::getHttpHearders($headers);
curl_setopt($ch,CURLOPT_HTTPHEADER,$httpHeaders);
}
$httpResponse = new HttpResponse();
$httpResponse->setBody(curl_exec($ch));
$httpResponse->setStatus(curl_getinfo($ch, CURLINFO_HTTP_CODE));
if (curl_errno($ch))
{
throw new ClientException("Server unreachable: Errno: " . curl_errno($ch) . " " . curl_error($ch), "SDK.ServerUnreachable");
}
curl_close($ch);
return $httpResponse;
}
static function getPostHttpBody($postFildes){
$content = "";
foreach ($postFildes as $apiParamKey => $apiParamValue)
{
$content .= "$apiParamKey=" . urlencode($apiParamValue) . "&";
}
return substr($content, 0, -1);
}
static function getHttpHearders($headers)
{
$httpHeader = array();
foreach ($headers as $key => $value)
{
array_push($httpHeader, $key.":".$value);
}
return $httpHeader;
}
}
<?php
namespace Aliyun\Core\Http;
class HttpResponse
{
private $body;
private $status;
public function getBody()
{
return $this->body;
}
public function setBody($body)
{
$this->body = $body;
}
public function getStatus()
{
return $this->status;
}
public function setStatus($status)
{
$this->status = $status;
}
public function isSuccess()
{
if(200 <= $this->status && 300 > $this->status)
{
return true;
}
return false;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core;
interface IAcsClient
{
public function doAction($requst);
}
\ No newline at end of file
<?php
namespace Aliyun\Core\Profile;
use Aliyun\Core\Auth\Credential;
use Aliyun\Core\Auth\ShaHmac1Signer;
use Aliyun\Core\Regions\ProductDomain;
use Aliyun\Core\Regions\Endpoint;
use Aliyun\Core\Regions\EndpointProvider;
class DefaultProfile implements IClientProfile
{
private static $profile;
private static $endpoints;
private static $credential;
private static $regionId;
private static $acceptFormat;
private static $isigner;
private static $iCredential;
private function __construct($regionId,$credential)
{
self::$regionId = $regionId;
self::$credential = $credential;
}
public static function getProfile($regionId, $accessKeyId, $accessSecret)
{
$credential =new Credential($accessKeyId, $accessSecret);
self::$profile = new DefaultProfile($regionId, $credential);
return self::$profile;
}
public function getSigner()
{
if(null == self::$isigner)
{
self::$isigner = new ShaHmac1Signer();
}
return self::$isigner;
}
public function getRegionId()
{
return self::$regionId;
}
public function getFormat()
{
return self::$acceptFormat;
}
public function getCredential()
{
if(null == self::$credential && null != self::$iCredential)
{
self::$credential = self::$iCredential;
}
return self::$credential;
}
public static function getEndpoints()
{
if(null == self::$endpoints)
{
self::$endpoints = EndpointProvider::getEndpoints();
}
return self::$endpoints;
}
public static function addEndpoint($endpointName, $regionId, $product, $domain)
{
if(null == self::$endpoints)
{
self::$endpoints = self::getEndpoints();
}
$endpoint = self::findEndpointByName($endpointName);
if(null == $endpoint)
{
self::addEndpoint_($endpointName, $regionId, $product, $domain);
}
else
{
self::updateEndpoint($regionId, $product, $domain, $endpoint);
}
}
public static function findEndpointByName($endpointName)
{
foreach (self::$endpoints as $key => $endpoint)
{
if($endpoint->getName() == $endpointName)
{
return $endpoint;
}
}
}
private static function addEndpoint_($endpointName,$regionId, $product, $domain)
{
$regionIds = array($regionId);
$productDomains = array(new ProductDomain($product, $domain));
$endpoint = new Endpoint($endpointName, $regionIds, $productDomains);
array_push(self::$endpoints, $endpoint);
}
private static function updateEndpoint($regionId, $product, $domain, $endpoint)
{
$regionIds = $endpoint->getRegionIds();
if(!in_array($regionId,$regionIds))
{
array_push($regionIds, $regionId);
$endpoint->setRegionIds($regionIds);
}
$productDomains = $endpoint->getProductDomains();
if(null == self::findProductDomain($productDomains, $product, $domain))
{
array_push($productDomains, new ProductDomain($product, $domain));
}
$endpoint->setProductDomains($productDomains);
}
private static function findProductDomain($productDomains, $product, $domain)
{
foreach ($productDomains as $key => $productDomain)
{
if($productDomain->getProductName() == $product && $productDomain->getDomainName() == $domain)
{
return $productDomain;
}
}
return null;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core\Profile;
interface IClientProfile
{
public function getSigner();
public function getRegionId();
public function getFormat();
public function getCredential();
}
\ No newline at end of file
<?php
namespace Aliyun\Core\Regions;
class Endpoint
{
private $name;
private $regionIds;
private $productDomains;
function __construct($name, $regionIds, $productDomains)
{
$this->name = $name;
$this->regionIds = $regionIds;
$this->productDomains = $productDomains;
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
public function getRegionIds()
{
return $this->regionIds;
}
public function setRegionIds($regionIds)
{
$this->regionIds = $regionIds;
}
public function getProductDomains()
{
return $this->productDomains;
}
public function setProductDomains($productDomains)
{
$this->productDomains = $productDomains;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core\Regions;
class EndpointConfig {
private static $loaded = false;
public static function load() {
if(self::$loaded) {
return;
}
$endpoint_filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . "endpoints.xml";
$xml = simplexml_load_string(file_get_contents($endpoint_filename));
$json = json_encode($xml);
$json_array = json_decode($json, TRUE);
$endpoints = array();
foreach ($json_array["Endpoint"] as $json_endpoint) {
# pre-process RegionId & Product
if (!array_key_exists("RegionId", $json_endpoint["RegionIds"])) {
$region_ids = array();
} else {
$json_region_ids = $json_endpoint['RegionIds']['RegionId'];
if (!is_array($json_region_ids)) {
$region_ids = array($json_region_ids);
} else {
$region_ids = $json_region_ids;
}
}
if (!array_key_exists("Product", $json_endpoint["Products"])) {
$products = array();
} else {
$json_products = $json_endpoint["Products"]["Product"];
if (array() === $json_products or !is_array($json_products)) {
$products = array();
} else if (array_keys($json_products) !== range(0, count($json_products) - 1)) {
# array is not sequential
$products = array($json_products);
} else {
$products = $json_products;
}
}
$product_domains = array();
foreach ($products as $product) {
$product_domain = new ProductDomain($product['ProductName'], $product['DomainName']);
array_push($product_domains, $product_domain);
}
$endpoint = new Endpoint($region_ids[0], $region_ids, $product_domains);
array_push($endpoints, $endpoint);
}
EndpointProvider::setEndpoints($endpoints);
self::$loaded = true;
}
}
<?php
namespace Aliyun\Core\Regions;
class EndpointProvider
{
private static $endpoints;
public static function findProductDomain($regionId, $product)
{
if(null == $regionId || null == $product || null == self::$endpoints)
{
return null;
}
foreach (self::$endpoints as $key => $endpoint)
{
if(in_array($regionId, $endpoint->getRegionIds()))
{
return self::findProductDomainByProduct($endpoint->getProductDomains(), $product);
}
}
return null;
}
private static function findProductDomainByProduct($productDomains, $product)
{
if(null == $productDomains)
{
return null;
}
foreach ($productDomains as $key => $productDomain)
{
if($product == $productDomain->getProductName())
{
return $productDomain->getDomainName();
}
}
return null;
}
public static function getEndpoints()
{
return self::$endpoints;
}
public static function setEndpoints($endpoints)
{
self::$endpoints = $endpoints;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core\Regions;
class ProductDomain
{
private $productName;
private $domainName;
function __construct($product, $domain) {
$this->productName = $product;
$this->domainName = $domain;
}
public function getProductName() {
return $this->productName;
}
public function setProductName($productName) {
$this->productName = $productName;
}
public function getDomainName() {
return $this->domainName;
}
public function setDomainName($domainName) {
$this->domainName = $domainName;
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
namespace Aliyun\Core;
abstract class RoaAcsRequest extends AcsRequest
{
protected $uriPattern;
private $pathParameters = array();
private $domainParameters = array();
private $dateTimeFormat ="D, d M Y H:i:s \G\M\T";
private static $headerSeparator = "\n";
private static $querySeprator = "&";
function __construct($product, $version, $actionName)
{
parent::__construct($product, $version, $actionName);
$this->setVersion($version);
$this->initialize();
}
private function initialize()
{
$this->setMethod("RAW");
}
public function composeUrl($iSigner, $credential, $domain)
{
$this->prepareHeader($iSigner);
$signString = $this->getMethod().self::$headerSeparator;
if(isset($this->headers["Accept"]))
{
$signString = $signString.$this->headers["Accept"];
}
$signString = $signString.self::$headerSeparator;
if(isset($this->headers["Content-MD5"]))
{
$signString = $signString.$this->headers["Content-MD5"];
}
$signString = $signString.self::$headerSeparator;
if(isset($this->headers["Content-Type"]))
{
$signString = $signString.$this->headers["Content-Type"];
}
$signString = $signString.self::$headerSeparator;
if(isset($this->headers["Date"]))
{
$signString = $signString.$this->headers["Date"];
}
$signString = $signString.self::$headerSeparator;
$uri = $this->replaceOccupiedParameters();
$signString = $signString.$this->buildCanonicalHeaders();
$queryString = $this->buildQueryString($uri);
$signString .= $queryString;
$this->headers["Authorization"] = "acs ".$credential->getAccessKeyId().":"
.$iSigner->signString($signString, $credential->getAccessSecret());
$requestUrl = $this->getProtocol()."://".$domain.$queryString;
return $requestUrl;
}
private function prepareHeader($iSigner)
{
$this->headers["Date"] = gmdate($this->dateTimeFormat);
if(null == $this->acceptFormat)
{
$this->acceptFormat = "RAW";
}
$this->headers["Accept"] = $this->formatToAccept($this->getAcceptFormat());
$this->headers["x-acs-signature-method"] = $iSigner->getSignatureMethod();
$this->headers["x-acs-signature-version"] = $iSigner->getSignatureVersion();
$this->headers["x-acs-region-id"] = $this->regionId;
$content = $this->getDomainParameter();
if ($content != null) {
$this->headers["Content-MD5"] = base64_encode(md5(json_encode($content),true));
}
$this->headers["Content-Type"] = "application/octet-stream;charset=utf-8";
}
private function replaceOccupiedParameters()
{
$result = $this->uriPattern;
foreach ($this->pathParameters as $pathParameterKey => $apiParameterValue)
{
$target = "[".$pathParameterKey."]";
$result = str_replace($target,$apiParameterValue,$result);
}
return $result;
}
private function buildCanonicalHeaders()
{
$sortMap = array();
foreach ($this->headers as $headerKey => $headerValue)
{
$key = strtolower($headerKey);
if(strpos($key, "x-acs-") === 0)
{
$sortMap[$key] = $headerValue;
}
}
ksort($sortMap);
$headerString = "";
foreach ($sortMap as $sortMapKey => $sortMapValue)
{
$headerString = $headerString.$sortMapKey.":".$sortMapValue.self::$headerSeparator;
}
return $headerString;
}
private function splitSubResource($uri)
{
$queIndex = strpos($uri, "?");
$uriParts = array();
if(null != $queIndex)
{
array_push($uriParts, substr($uri,0,$queIndex));
array_push($uriParts, substr($uri,$queIndex+1));
}
else
{
array_push($uriParts,$uri);
}
return $uriParts;
}
private function buildQueryString($uri)
{
$uriParts = $this->splitSubResource($uri);
$sortMap = $this->queryParameters;
if(isset($uriParts[1]))
{
$sortMap[$uriParts[1]] = null;
}
$queryString = $uriParts[0];
if(count($uriParts))
{
$queryString = $queryString."?";
}
ksort($sortMap);
foreach ($sortMap as $sortMapKey => $sortMapValue)
{
$queryString = $queryString.$sortMapKey;
if(isset($sortMapValue))
{
$queryString = $queryString."=".$sortMapValue;
}
$queryString = $queryString.$querySeprator;
}
if(null==count($sortMap))
{
$queryString = substr($queryString, 0, strlen($queryString)-1);
}
return $queryString;
}
private function formatToAccept($acceptFormat)
{
if($acceptFormat == "JSON")
{
return "application/json";
}
elseif ($acceptFormat == "XML") {
return "application/xml";
}
return "application/octet-stream";
}
public function getPathParameters()
{
return $this->pathParameters;
}
public function putPathParameter($name, $value)
{
$this->pathParameters[$name] = $value;
}
public function getDomainParameter()
{
return $this->domainParameters;
}
public function putDomainParameters($name, $value)
{
$this->domainParameters[$name] = $value;
}
public function getUriPattern()
{
return $this->uriPattern;
}
public function setUriPattern($uriPattern)
{
return $this->uriPattern = $uriPattern;
}
public function setVersion($version)
{
$this->version = $version;
$this->headers["x-acs-version"] = $version;
}
}
\ No newline at end of file
<?php
namespace Aliyun\Core;
abstract class RpcAcsRequest extends AcsRequest
{
private $dateTimeFormat = 'Y-m-d\TH:i:s\Z';
private $domainParameters = array();
function __construct($product, $version, $actionName)
{
parent::__construct($product, $version, $actionName);
$this->initialize();
}
private function initialize()
{
$this->setMethod("GET");
$this->setAcceptFormat("JSON");
}
private function prepareValue($value)
{
if (is_bool($value)) {
if ($value) {
return "true";
} else {
return "false";
}
} else {
return $value;
}
}
public function composeUrl($iSigner, $credential, $domain)
{
$apiParams = parent::getQueryParameters();
foreach ($apiParams as $key => $value) {
$apiParams[$key] = $this->prepareValue($value);
}
$apiParams["RegionId"] = $this->getRegionId();
$apiParams["AccessKeyId"] = $credential->getAccessKeyId();
$apiParams["Format"] = $this->getAcceptFormat();
$apiParams["SignatureMethod"] = $iSigner->getSignatureMethod();
$apiParams["SignatureVersion"] = $iSigner->getSignatureVersion();
$apiParams["SignatureNonce"] = md5(uniqid(mt_rand(), true));
$apiParams["Timestamp"] = gmdate($this->dateTimeFormat);
$apiParams["Action"] = $this->getActionName();
$apiParams["Version"] = $this->getVersion();
$apiParams["Signature"] = $this->computeSignature($apiParams, $credential->getAccessSecret(), $iSigner);
if(parent::getMethod() == "POST") {
$requestUrl = $this->getProtocol()."://". $domain . "/";
foreach ($apiParams as $apiParamKey => $apiParamValue)
{
$this->putDomainParameters($apiParamKey,$apiParamValue);
}
return $requestUrl;
}
else {
$requestUrl = $this->getProtocol()."://". $domain . "/?";
foreach ($apiParams as $apiParamKey => $apiParamValue)
{
$requestUrl .= "$apiParamKey=" . urlencode($apiParamValue) . "&";
}
return substr($requestUrl, 0, -1);
}
}
private function computeSignature($parameters, $accessKeySecret, $iSigner)
{
ksort($parameters);
$canonicalizedQueryString = '';
foreach($parameters as $key => $value)
{
$canonicalizedQueryString .= '&' . $this->percentEncode($key). '=' . $this->percentEncode($value);
}
$stringToSign = parent::getMethod().'&%2F&' . $this->percentencode(substr($canonicalizedQueryString, 1));
$signature = $iSigner->signString($stringToSign, $accessKeySecret."&");
return $signature;
}
protected function percentEncode($str)
{
$res = urlencode($str);
$res = preg_replace('/\+/', '%20', $res);
$res = preg_replace('/\*/', '%2A', $res);
$res = preg_replace('/%7E/', '~', $res);
return $res;
}
public function getDomainParameter()
{
return $this->domainParameters;
}
public function putDomainParameters($name, $value)
{
$this->domainParameters[$name] = $value;
}
}
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitee70723fd3132b6d05f0ff016c58b71b::getLoader();
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Aliyun\\' => array($baseDir . '/lib'),
);
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitee70723fd3132b6d05f0ff016c58b71b
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitee70723fd3132b6d05f0ff016c58b71b', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitee70723fd3132b6d05f0ff016c58b71b', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitee70723fd3132b6d05f0ff016c58b71b::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitee70723fd3132b6d05f0ff016c58b71b
{
public static $prefixLengthsPsr4 = array (
'A' =>
array (
'Aliyun\\' => 7,
),
);
public static $prefixDirsPsr4 = array (
'Aliyun\\' =>
array (
0 => __DIR__ . '/../..' . '/lib',
),
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitee70723fd3132b6d05f0ff016c58b71b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitee70723fd3132b6d05f0ff016c58b71b::$prefixDirsPsr4;
}, null, ClassLoader::class);
}
}
......@@ -22,14 +22,17 @@
"php": "^7.2",
"emadadly/laravel-uuid": "^1.3",
"fideloper/proxy": "^4.0",
"ibrand/laravel-sms": "~1.0",
"influxdb/influxdb-php": "^1.15",
"laravel/framework": "^7.0",
"laravel/passport": "^8.4",
"laravel/tinker": "^2.0",
"league/flysystem-aws-s3-v3": "^1.0",
"mrgoon/aliyun-sms": "dev-master",
"predis/predis": "^1.1",
"spatie/laravel-permission": "^3.0",
"swooletw/laravel-swoole": "^2.6",
"toplan/laravel-sms": "~2.6",
"try-to/swoole_mqtt": "^0.0.5"
},
"require-dev": {
......
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3f4372197e40ba5bc91e08d835604a05",
"content-hash": "24958d49156f51e819a800192edafa32",
"packages": [
{
"name": "aws/aws-sdk-php",
......@@ -232,6 +232,257 @@
"description": "implementation of xdg base directory specification for php",
"time": "2019-12-04T15:06:13+00:00"
},
{
"name": "doctrine/cache",
"version": "1.10.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "13e3381b25847283a91948d04640543941309727"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/13e3381b25847283a91948d04640543941309727",
"reference": "13e3381b25847283a91948d04640543941309727",
"shasum": ""
},
"require": {
"php": "~7.1 || ^8.0"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"alcaeus/mongo-php-adapter": "^1.1",
"doctrine/coding-standard": "^6.0",
"mongodb/mongodb": "^1.1",
"phpunit/phpunit": "^7.0",
"predis/predis": "~1.0"
},
"suggest": {
"alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.",
"homepage": "https://www.doctrine-project.org/projects/cache.html",
"keywords": [
"abstraction",
"apcu",
"cache",
"caching",
"couchdb",
"memcached",
"php",
"redis",
"xcache"
],
"time": "2020-07-07T18:54:01+00:00"
},
{
"name": "doctrine/dbal",
"version": "2.12.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "adce7a954a1c2f14f85e94aed90c8489af204086"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/adce7a954a1c2f14f85e94aed90c8489af204086",
"reference": "adce7a954a1c2f14f85e94aed90c8489af204086",
"shasum": ""
},
"require": {
"doctrine/cache": "^1.0",
"doctrine/event-manager": "^1.0",
"ext-pdo": "*",
"php": "^7.3 || ^8"
},
"require-dev": {
"doctrine/coding-standard": "^8.1",
"jetbrains/phpstorm-stubs": "^2019.1",
"phpstan/phpstan": "^0.12.40",
"phpunit/phpunit": "^9.4",
"psalm/plugin-phpunit": "^0.10.0",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "^3.17.2"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"bin": [
"bin/doctrine-dbal"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\DBAL\\": "lib/Doctrine/DBAL"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.",
"homepage": "https://www.doctrine-project.org/projects/dbal.html",
"keywords": [
"abstraction",
"database",
"db2",
"dbal",
"mariadb",
"mssql",
"mysql",
"oci8",
"oracle",
"pdo",
"pgsql",
"postgresql",
"queryobject",
"sasql",
"sql",
"sqlanywhere",
"sqlite",
"sqlserver",
"sqlsrv"
],
"time": "2020-11-14T20:26:58+00:00"
},
{
"name": "doctrine/event-manager",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/event-manager.git",
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f",
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"doctrine/common": "<2.9@dev"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\": "lib/Doctrine/Common"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
},
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.",
"homepage": "https://www.doctrine-project.org/projects/event-manager.html",
"keywords": [
"event",
"event dispatcher",
"event manager",
"event system",
"events"
],
"time": "2020-05-29T18:28:51+00:00"
},
{
"name": "doctrine/inflector",
"version": "1.3.1",
......@@ -831,6 +1082,63 @@
],
"time": "2019-07-01T23:21:34+00:00"
},
{
"name": "ibrand/laravel-sms",
"version": "v1.5.3",
"source": {
"type": "git",
"url": "https://github.com/guojiangclub/laravel-sms.git",
"reference": "4f793161df48bb26f76c00bea479e43a5fdf06df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guojiangclub/laravel-sms/zipball/4f793161df48bb26f76c00bea479e43a5fdf06df",
"reference": "4f793161df48bb26f76c00bea479e43a5fdf06df",
"shasum": ""
},
"require": {
"doctrine/dbal": "^2.5",
"overtrue/easy-sms": "~1.0",
"php": ">=7.0"
},
"require-dev": {
"mockery/mockery": "~0.9",
"orchestra/testbench": "~3.5",
"phpunit/phpunit": "~6.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"iBrand\\Sms\\ServiceProvider"
],
"aliases": {
"Sms": "iBrand\\Sms\\Facade"
}
}
},
"autoload": {
"psr-4": {
"iBrand\\Sms\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "shjchen",
"email": "ibrand.shjchen@foxmail.com"
}
],
"description": "ibrand laravel sms base overtrue's easy-sms",
"keywords": [
"ibrand",
"laravel sms"
],
"time": "2020-10-12T08:41:10+00:00"
},
{
"name": "influxdb/influxdb-php",
"version": "1.15.0",
......@@ -892,6 +1200,65 @@
],
"time": "2019-05-30T00:15:14+00:00"
},
{
"name": "jeremeamia/superclosure",
"version": "2.4.0",
"source": {
"type": "git",
"url": "https://github.com/jeremeamia/super_closure.git",
"reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/5707d5821b30b9a07acfb4d76949784aaa0e9ce9",
"reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9",
"shasum": ""
},
"require": {
"nikic/php-parser": "^1.2|^2.0|^3.0|^4.0",
"php": ">=5.4",
"symfony/polyfill-php56": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0|^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-4": {
"SuperClosure\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia",
"role": "Developer"
}
],
"description": "Serialize Closure objects, including their context and binding",
"homepage": "https://github.com/jeremeamia/super_closure",
"keywords": [
"closure",
"function",
"lambda",
"parser",
"serializable",
"serialize",
"tokenizer"
],
"abandoned": "opis/closure",
"time": "2018-03-21T22:21:57+00:00"
},
{
"name": "laminas/laminas-diactoros",
"version": "2.2.3",
......@@ -2087,6 +2454,48 @@
],
"time": "2019-11-29T22:36:02+00:00"
},
{
"name": "overtrue/easy-sms",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/overtrue/easy-sms.git",
"reference": "cbf093dcd89c1615f617ae5733bfee1e85298793"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/overtrue/easy-sms/zipball/cbf093dcd89c1615f617ae5733bfee1e85298793",
"reference": "cbf093dcd89c1615f617ae5733bfee1e85298793",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/guzzle": "^6.2 || ^7.0",
"php": ">=5.6"
},
"require-dev": {
"mockery/mockery": "1.3.1",
"phpunit/phpunit": "^5.7 || ^7.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Overtrue\\EasySms\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "overtrue",
"email": "i@overtrue.me"
}
],
"description": "The easiest way to send short message.",
"time": "2020-11-24T14:22:50+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v9.99.99",
......@@ -2334,12 +2743,12 @@
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/nrk/predis.git",
"url": "https://github.com/predis/predis.git",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1",
"url": "https://api.github.com/repos/predis/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1",
"shasum": ""
},
......@@ -3946,6 +4355,57 @@
],
"time": "2020-03-09T19:04:49+00:00"
},
{
"name": "symfony/polyfill-php56",
"version": "v1.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php56.git",
"reference": "54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675",
"reference": "54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "metapackage",
"extra": {
"branch-alias": {
"dev-main": "1.20-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"time": "2020-10-23T14:02:19+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.15.0",
......@@ -4564,6 +5024,151 @@
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
"time": "2019-10-24T08:53:34+00:00"
},
{
"name": "toplan/laravel-sms",
"version": "2.6.5",
"source": {
"type": "git",
"url": "https://github.com/toplan/laravel-sms.git",
"reference": "9c8427493c768c07a15fb993436267b81f31bae5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/toplan/laravel-sms/zipball/9c8427493c768c07a15fb993436267b81f31bae5",
"reference": "9c8427493c768c07a15fb993436267b81f31bae5",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"toplan/phpsms": "~1.8"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
],
"psr-0": {
"Toplan\\Sms": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "toplan",
"email": "toplan710@gmail.com"
}
],
"description": "A mobile phone number validation solution based on laravel",
"keywords": [
"laravel",
"laravel-sms",
"mobile",
"phone",
"sms"
],
"time": "2017-06-23T10:07:04+00:00"
},
{
"name": "toplan/phpsms",
"version": "1.8.3",
"source": {
"type": "git",
"url": "https://github.com/toplan/phpsms.git",
"reference": "863918ed0970d335471fb48c09f9f446a4daddbd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/toplan/phpsms/zipball/863918ed0970d335471fb48c09f9f446a4daddbd",
"reference": "863918ed0970d335471fb48c09f9f446a4daddbd",
"shasum": ""
},
"require": {
"jeremeamia/superclosure": "~2.2",
"php": ">=5.4.0",
"toplan/task-balancer": "~0.5"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Toplan\\PhpSms\\": [
"src/phpsms/",
"src/phpsms/agents/",
"src/phpsms/interfaces/"
],
"Toplan\\PhpSms\\Facades\\": [
"src/phpsms/facades/"
]
},
"classmap": [
"src/phpsms/lib/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "toplan",
"email": "toplan710@gmail.com"
}
],
"description": "Probably the most intelligent, elegant sms send library in php",
"keywords": [
"php",
"phpsms",
"sms",
"sms library"
],
"time": "2017-07-10T17:23:21+00:00"
},
{
"name": "toplan/task-balancer",
"version": "0.5.0",
"source": {
"type": "git",
"url": "https://github.com/toplan/task-balancer.git",
"reference": "6ba16aafbf6888de0f0c53ea93dfff844b6ef27f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/toplan/task-balancer/zipball/6ba16aafbf6888de0f0c53ea93dfff844b6ef27f",
"reference": "6ba16aafbf6888de0f0c53ea93dfff844b6ef27f",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Toplan\\TaskBalance\\": "src/TaskBalancer/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "toplan",
"email": "toplan710@gmail.com"
}
],
"description": "lightweight and powerful task load balancing.",
"keywords": [
"balance",
"load balancing",
"task"
],
"time": "2017-05-15T03:19:56+00:00"
},
{
"name": "try-to/swoole_mqtt",
"version": "v0.0.5",
......
......@@ -167,7 +167,6 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
......@@ -230,7 +229,6 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| 内置路由
|--------------------------------------------------------------------------
|
| 如果是 web 应用建议 middleware 为 ['web', ...]
| 如果是 api 应用建议 middleware 为 ['api', ...]
|
*/
'route' => [
'enable' => true,
'prefix' => 'laravel-sms',
'middleware' => ['web'],
],
/*
|--------------------------------------------------------------------------
| 请求间隔
|--------------------------------------------------------------------------
|
| 单位:秒
|
*/
'interval' => 60,
/*
|--------------------------------------------------------------------------
| 数据验证管理
|--------------------------------------------------------------------------
|
| 设置从客户端传来的需要验证的数据字段(`field`)
|
| - isMobile 是否为手机号字段
| - enable 是否开启验证
| - default 默认静态验证规则
| - staticRules 静态验证规则
|
*/
'validation' => [
'mobile' => [
'isMobile' => true,
'enable' => true,
'default' => 'mobile_required',
'staticRules' => [
'mobile_required' => 'required|zh_mobile',
'check_mobile_unique' => 'required|zh_mobile|unique:users,mobile',
'check_mobile_exists' => 'required|zh_mobile|exists:users',
],
],
],
/*
|--------------------------------------------------------------------------
| 验证码管理
|--------------------------------------------------------------------------
|
| - length 验证码长度
| - validMinutes 验证码有效时间长度,单位为分钟
| - repeatIfValid 如果原验证码还有效,是否重复使用原验证码
| - maxAttempts 验证码最大尝试验证次数,超过该数值验证码自动失效,0或负数则不启用
|
*/
'code' => [
'length' => 5,
'validMinutes' => 5,
'repeatIfValid' => false,
'maxAttempts' => 0,
],
/*
|--------------------------------------------------------------------------
| 验证码短信通用内容
|--------------------------------------------------------------------------
|
| 如需缓存配置,则需使用 `Toplan\Sms\SmsManger::closure($closure)` 方法进行配置
|
*/
'content' => function ($code, $minutes, $input) {
return '【signature】您的验证码是' . $code . ',有效期为' . $minutes . '分钟,请尽快验证。';
},
/*
|--------------------------------------------------------------------------
| 验证码短信模版
|--------------------------------------------------------------------------
|
| 每项数据的值可以为以下三种之一:
|
| - 字符串/数字
| 如: 'YunTongXun' => '短信模版id'
|
| - 数组
| 如: 'Alidayu' => ['短信模版id', '语音模版id'],
|
| - 匿名函数
| 如: 'YunTongXun' => function ($input, $type) {
| return $input['isRegister'] ? 'registerTempId' : 'commonId';
| }
|
| 如需缓存配置,则需使用 `Toplan\Sms\SmsManger::closure($closure)` 方法对匿名函数进行配置
|
*/
'templates' => [
'Aliyun' => 'SMS_169897307'
],
/*
|--------------------------------------------------------------------------
| 模版数据管理
|--------------------------------------------------------------------------
|
| 每项数据的值可以为以下两种之一:
|
| - 基本数据类型
| 如: 'minutes' => 5
|
| - 匿名函数(如果该函数不返回任何值,即表示不使用该项数据)
| 如: 'serialNumber' => function ($code, $minutes, $input, $type) {
| return $input['serialNumber'];
| }
| 如: 'hello' => function ($code, $minutes, $input, $type) {
| //不返回任何值,那么hello将会从模版数据中移除 :)
| }
|
| 如需缓存配置,则需使用 `Toplan\Sms\SmsManger::closure($closure)` 方法对匿名函数进行配置
|
*/
'data' => [
'code' => function ($code) {
return $code;
},
'minutes' => function ($code, $minutes) {
return $minutes;
},
],
/*
|--------------------------------------------------------------------------
| 存储系统配置
|--------------------------------------------------------------------------
|
| driver:
| 存储方式,是一个实现了'Toplan\Sms\Storage'接口的类的类名,
| 内置可选的值有'Toplan\Sms\SessionStorage'和'Toplan\Sms\CacheStorage',
| 如果不填写driver,那么系统会自动根据内置路由的属性(route)中middleware的配置值选择存储器driver:
| - 如果中间件含有'web',会选择使用'Toplan\Sms\SessionStorage'
| - 如果中间件含有'api',会选择使用'Toplan\Sms\CacheStorage'
|
| prefix:
| 存储key的prefix
|
| 内置driver的个性化配置:
| - 在laravel项目的'config/session.php'文件中可以对'Toplan\Sms\SessionStorage'进行更多个性化设置
| - 在laravel项目的'config/cache.php'文件中可以对'Toplan\Sms\CacheStorage'进行更多个性化设置
|
*/
'storage' => [
'driver' => '',
'prefix' => 'laravel_sms',
],
/*
|--------------------------------------------------------------------------
| 是否数据库记录发送日志
|--------------------------------------------------------------------------
|
| 若需开启此功能,需要先生成一个内置的'laravel_sms'表
| 运行'php artisan migrate'命令可以自动生成
|
*/
'dbLogs' => false,
/*
|--------------------------------------------------------------------------
| 队列任务
|--------------------------------------------------------------------------
|
*/
'queueJob' => 'Toplan\Sms\SendReminderSms',
/*
|--------------------------------------------------------------------------
| 验证码模块提示信息
|--------------------------------------------------------------------------
|
*/
'notifies' => [
// 频繁请求无效的提示
'request_invalid' => '请求无效,请在%s秒后重试',
// 验证码短信发送失败的提示
'sms_sent_failure' => '短信验证码发送失败,请稍后重试',
// 语音验证码发送发送成功的提示
'voice_sent_failure' => '语音验证码请求失败,请稍后重试',
// 验证码短信发送成功的提示
'sms_sent_success' => '短信验证码发送成功,请注意查收',
// 语音验证码发送发送成功的提示
'voice_sent_success' => '语音验证码发送成功,请注意接听',
],
];
<?php
return [
/*
* The scheme information
* -------------------------------------------------------------------
*
* The key-value paris: {name} => {value}
*
* Examples:
* 'Log' => '10 backup'
* 'SmsBao' => '100'
* 'CustomAgent' => [
* '5 backup',
* 'agentClass' => '/Namespace/ClassName'
* ]
*
* Supported agents:
* 'Log', 'YunPian', 'YunTongXun', 'SubMail', 'Luosimao',
* 'Ucpaas', 'JuHe', 'Alidayu', 'SendCloud', 'SmsBao',
* 'Qcloud', 'Aliyun'
*
*/
'scheme' => [
'Log',
'Aliyun' => '100'
],
/*
* The configuration
* -------------------------------------------------------------------
*
* Expected the name of agent to be a string.
*
*/
'agents' => [
/*
* -----------------------------------
* YunPian
* 云片代理器
* -----------------------------------
* website:http://www.yunpian.com
* support content sms.
*/
'YunPian' => [
//用户唯一标识,必须
'apikey' => 'your_api_key',
],
/*
* -----------------------------------
* YunTongXun
* 云通讯代理器
* -----------------------------------
* website:http://www.yuntongxun.com/
* support template sms.
*/
'YunTongXun' => [
//主帐号
'accountSid' => 'your_account_sid',
//主帐号令牌
'accountToken' => 'your_account_token',
//应用Id
'appId' => 'your_app_id',
//请求地址(不加协议前缀)
'serverIP' => 'app.cloopen.com',
//请求端口
'serverPort' => '8883',
//被叫号显
'displayNum' => null,
//语音验证码播放次数
'playTimes' => 3,
],
/*
* -----------------------------------
* SubMail
* -----------------------------------
* website:http://submail.cn/
* support template sms.
*/
'SubMail' => [
'appid' => 'your_app_id',
'signature' => 'your app key',
],
/*
* -----------------------------------
* luosimao
* -----------------------------------
* website:http://luosimao.com
* support content sms.
*/
'Luosimao' => [
'apikey' => 'your_api_key',
'voiceApikey' => 'your_voice_api_key',
],
/*
* -----------------------------------
* ucpaas
* -----------------------------------
* website:http://ucpaas.com
* support template sms.
*/
'Ucpaas' => [
//主帐号,对应开官网发者主账号下的 ACCOUNT SID
'accountSid' => 'your_account_sid',
//主帐号令牌,对应官网开发者主账号下的 AUTH TOKEN
'accountToken' => 'your_account_token',
//应用Id,在官网应用列表中点击应用,对应应用详情中的APP ID
//在开发调试的时候,可以使用官网自动为您分配的测试Demo的APP ID
'appId' => 'your_app_id',
],
/*
* -----------------------------------
* JuHe
* 聚合数据
* -----------------------------------
* website:https://www.juhe.cn
* support template sms.
*/
'JuHe' => [
//应用App Key
'key' => 'your_key',
//语音验证码播放次数
'times' => 3,
],
/*
* -----------------------------------
* Alidayu
* 阿里大鱼代理器
* -----------------------------------
* website:http://www.alidayu.com
* support template sms.
*/
'Alidayu' => [
//请求地址
'sendUrl' => 'http://gw.api.taobao.com/router/rest',
//淘宝开放平台中,对应阿里大鱼短信应用的App Key
'appKey' => 'your_app_key',
//淘宝开放平台中,对应阿里大鱼短信应用的App Secret
'secretKey' => 'your_secret_key',
//短信签名,传入的短信签名必须是在阿里大鱼“管理中心-短信签名管理”中的可用签名
'smsFreeSignName' => 'your_sms_free_sign_name',
//被叫号显(用于语音通知),传入的显示号码必须是阿里大鱼“管理中心-号码管理”中申请或购买的号码
'calledShowNum' => null,
],
/*
* -----------------------------------
* SendCloud
* -----------------------------------
* website: http://sendcloud.sohu.com/sms/
* support template sms.
*/
'SendCloud' => [
'smsUser' => 'your_SMS_USER',
'smsKey' => 'your_SMS_KEY',
],
/*
* -----------------------------------
* SmsBao
* -----------------------------------
* website: http://www.smsbao.com
* support content sms.
*/
'SmsBao' => [
//注册账号
'username' => 'your_username',
//账号密码(明文)
'password' => 'your_password',
],
/*
* -----------------------------------
* Qcloud
* 腾讯云
* -----------------------------------
* website:http://www.qcloud.com
* support template sms.
*/
'Qcloud' => [
'appId' => 'your_app_id',
'appKey' => 'your_app_key',
],
/*
* -----------------------------------
* Aliyun
* 阿里云
* -----------------------------------
* website:https://www.aliyun.com/product/sms
* support template sms.
*/
'Aliyun' => [
'accessKeyId' => 'LTAI2xiZNF3iV2aV',
'accessKeySecret' => 'bprEWwn1M0xgglRQCQEMYSPiYctDk4',
'signName' => '泽宏云',
'regionId' => 'cn-beijing',
],
],
];
......@@ -14520,7 +14520,7 @@
},
"uppercamelcase": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/uppercamelcase/download/uppercamelcase-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/uppercamelcase/-/uppercamelcase-1.1.0.tgz",
"integrity": "sha1-Mk2YprOvx+iolT4QZBUJsOTiP5c=",
"requires": {
"camelcase": "^1.2.1"
......@@ -14528,7 +14528,7 @@
"dependencies": {
"camelcase": {
"version": "1.2.1",
"resolved": "https://registry.npm.taobao.org/camelcase/download/camelcase-1.2.1.tgz",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
"integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk="
}
}
......
......@@ -24,7 +24,7 @@
<span>{{ scope.row.endtime=='0-0-0 0:0' ? '' : scope.row.endtime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column label="报警浓度" width="150">
<el-table-column label="报警浓度" width="80">
<template slot-scope="scope">
<span @click="handleCopy(scope.row.concentration,$event)">{{ scope.row.concentration }}</span>
</template>
......@@ -34,12 +34,12 @@
<span @click="handleCopy(scope.row.location,$event)">{{ scope.row.location }}</span>
</template>
</el-table-column>
<el-table-column label="报警类型" width="150">
<el-table-column label="报警类型" width="100">
<template slot-scope="scope">
<span>{{ scope.row.status_name }}</span>
</template>
</el-table-column>
<el-table-column label="切断装置状态" width="150">
<el-table-column label="切断装置状态" width="100">
<template slot-scope="scope">
<span>{{ shutoffStatus(scope.row.shutoff_status) }}</span>
</template>
......@@ -54,7 +54,7 @@
<el-tag :type="scope.row.status==1 ? 'danger' : 'success' " effect="dark">{{ scope.row.status==1 ? '当前正在报警' : '已结束报警' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作">
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="primary" effect="dark" @click="orderUsers(scope.row)">生成工单</el-button>
</template>
......
......@@ -86,7 +86,7 @@
<!-- 用户的设备列表 -->
<div v-if="deviceListVisible" class="zero-user-devices">
<el-collapse v-if="checkPermission(['manage isadmin'])" v-model="activeNames">
<el-collapse-item name="1">
<el-collapse-item v-show="leftDeviceListVisible" name="1">
<template slot="title">
设备列表 - {{ leftDeviceName }}
</template>
......@@ -209,6 +209,7 @@ export default {
data(){
const _this = this;
return {
leftDeviceListVisible: true,
markersGoodsVisible: false,
markersGoods: [{
id: 1,
......@@ -277,6 +278,14 @@ export default {
watch: {
},
mounted() {
console.log(this.$route.query);
if (this.$route.query.device_id > 0) {
this.markersDeviceVisible = true;
this.leftDeviceListVisible = false;
this.zoom = 15;
console.log(this.$route.query.device_id);
this.getUserDeviceInfo(this.$route.query.device_id);
}
},
created() {
this.$store.dispatch('app/toggleSideBar');
......@@ -307,6 +316,7 @@ export default {
this.zoom = 6;
this.markersDeviceVisible = true;
this.markerVisible = false;
this.leftDeviceListVisible = true;
});
},
getUserDevices(center) {
......@@ -315,6 +325,7 @@ export default {
this.center = center;
this.markerVisible = true;
this.markersDeviceVisible = true;
this.leftDeviceListVisible = true;
},
rebuildEvent(marker) {
var mapcenter = marker.mapcenter.replace(/\s*/g, '');
......@@ -353,6 +364,7 @@ export default {
},
// 获取单个用户下的设备
getUserDeviceList(uid) {
this.leftDeviceListVisible = true;
// 停止定时器
this.clearIntv();
devices({ uid: uid })
......@@ -372,6 +384,7 @@ export default {
this.markerVisible = false;
});
// this.dataRefresh();
this.leftDeviceListVisible = false;
},
// 获取设备详细信息
getUserDeviceInfo(id) {
......
......@@ -72,12 +72,12 @@
<span>{{ scope.row.tname }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="检测介质" width="170">
<el-table-column align="center" label="检测介质" width="100">
<template slot-scope="scope">
<span>{{ scope.row.gas }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="切断装置" width="170">
<el-table-column align="center" label="切断装置" width="100">
<template slot-scope="scope">
<span>{{ shutoffDevice(scope.row.shutoff_type) }}</span>
</template>
......@@ -92,7 +92,7 @@
<span>{{ scope.row.danwei }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="切断装置状态" width="120">
<el-table-column align="center" label="切断装置状态" width="80">
<template slot-scope="scope">
<span>
<el-popconfirm
......@@ -131,6 +131,13 @@
<span v-if="scope.row.update_time > 0">{{ scope.row.update_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="--" width="120">
<template slot-scope="scope">
<router-link :to="{ path: '/map/map', query: { device_id: scope.row.id } }">
<el-button class="button">查看地图</el-button>
</router-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment