This commit is contained in:
xman 2025-04-01 12:00:41 +08:00
parent 01f4316d80
commit 163f4785ec
7 changed files with 738 additions and 14 deletions

View File

@ -0,0 +1,46 @@
<?php
namespace app\common\Logic;
use app\common\services\alibaba\DyvmsService;
use think\Exception;
/**
* 通知
*/
class NoticeLogic
{
public function __construct($types = [])
{
}
/**
* 派单通知
* @return void
*/
public function dispatchNotice($dispatch,$type)
{
$ttsCode = '';
$outId = '';
try {
$reponse = DyvmsService::getInstance()->call($dispatch->worker_tel, $ttsCode, $outId);
}catch (Exception $exception){
dump($exception->getMessage());
}
}
/**
* 超时通知
* @return void
*/
public function overTimeNotice(){
}
}

View File

@ -101,7 +101,7 @@ class OrderLogic
$dispatch->save();
//发送短信通知师傅 todo...
$smsLogic = new SmsLogic();
$smsLogic = new NoticeLogic();
}
}

View File

@ -1,11 +0,0 @@
<?php
namespace app\common\Logic;
/**
* 发送短信
*/
class SmsLogic
{
}

View File

@ -0,0 +1,58 @@
<?php
namespace app\common\services\alibaba;
use AlibabaCloud\SDK\Dyvmsapi\V20170525\Dyvmsapi;
use AlibabaCloud\SDK\Dyvmsapi\V20170525\Models\SingleCallByTtsRequest;
use Darabonba\OpenApi\Models\Config;
use think\Env;
class DyvmsService
{
// 保存实例的静态变量
protected static ?DyvmsService $instance = null;
protected Dyvmsapi $service;
// 私有构造函数,防止外部直接实例化
private function __construct($options = [])
{
$config = Env::get('alibaba_dyvms');
if (!empty($options)) {
$config = array_merge($config, $options);
}
$this->service = new Dyvmsapi(new Config($config));
}
// 单例方法,确保只有一个实例
public static function getInstance($options = []): ?DyvmsService
{
if (self::$instance === null) {
self::$instance = new self($options); // 创建实例
}
return self::$instance; // 返回实例
}
// 防止克隆实例
private function __clone()
{
}
// 防止反序列化
private function __wakeup()
{
}
// 调用阿里云接口发送语音
public function call($tel,$ttsCode,$outId): array|\AlibabaCloud\SDK\Dyvmsapi\V20170525\Models\SingleCallByTtsResponse
{
$request = new SingleCallByTtsRequest([
'calledNumber' => $tel,
'calledShowNumber' => '',//显示专属号码
'ttsCode' => $ttsCode,// 语音文件ID
'outId' => $outId, //外部ID
// 其他必要参数可以继续添加
]);
return $this->service->singleCallByTts($request);
}
}

View File

@ -0,0 +1,12 @@
<?php
return [
'accessKeyId' => '',
'accessKeySecret' => '',
'regionId' => '', //可用区ID
'calledShowNumber' => '', //专属号码
];

View File

@ -30,7 +30,8 @@
"ext-pdo": "*",
"ext-bcmath": "*",
"txthinking/mailer": "^2.0",
"symfony/var-dumper": "^6.4"
"symfony/var-dumper": "^6.4",
"alibabacloud/dyvmsapi-20170525": "^3.2"
},
"config": {
"preferred-install": "dist",

620
composer.lock generated
View File

@ -4,8 +4,566 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fe3829381cb87e4cad3751a2d797da6e",
"content-hash": "770cae8dc7a1ad5a354ecc3345632f98",
"packages": [
{
"name": "adbario/php-dot-notation",
"version": "2.5.0",
"source": {
"type": "git",
"url": "https://github.com/adbario/php-dot-notation.git",
"reference": "081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae",
"reference": "081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-json": "*",
"php": "^5.5 || ^7.0 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.7|^6.6|^7.5|^8.5|^9.5",
"squizlabs/php_codesniffer": "^3.6"
},
"type": "library",
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Adbar\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Riku Särkinen",
"email": "riku@adbar.io"
}
],
"description": "PHP dot notation access to arrays",
"homepage": "https://github.com/adbario/php-dot-notation",
"keywords": [
"ArrayAccess",
"dotnotation"
],
"support": {
"issues": "https://github.com/adbario/php-dot-notation/issues",
"source": "https://github.com/adbario/php-dot-notation/tree/2.5.0"
},
"time": "2022-10-14T20:31:46+00:00"
},
{
"name": "alibabacloud/credentials",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/aliyun/credentials-php.git",
"reference": "cd0f65127d010ce3be5ced13fa9b69218dcfc555"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aliyun/credentials-php/zipball/cd0f65127d010ce3be5ced13fa9b69218dcfc555",
"reference": "cd0f65127d010ce3be5ced13fa9b69218dcfc555",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"adbario/php-dot-notation": "^2.2",
"alibabacloud/tea": "^3.0",
"ext-curl": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-simplexml": "*",
"ext-xmlwriter": "*",
"guzzlehttp/guzzle": "^6.3|^7.0",
"php": ">=5.6"
},
"require-dev": {
"composer/composer": "^1.8",
"drupal/coder": "^8.3",
"ext-dom": "*",
"ext-pcre": "*",
"ext-sockets": "*",
"ext-spl": "*",
"mikey179/vfsstream": "^1.6",
"monolog/monolog": "^1.24",
"phpunit/phpunit": "^5.7|^6.6|^9.3",
"psr/cache": "^1.0",
"symfony/dotenv": "^3.4",
"symfony/var-dumper": "^3.4"
},
"suggest": {
"ext-sockets": "To use client-side monitoring"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Credentials\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com",
"homepage": "http://www.alibabacloud.com"
}
],
"description": "Alibaba Cloud Credentials for PHP",
"homepage": "https://www.alibabacloud.com/",
"keywords": [
"alibaba",
"alibabacloud",
"aliyun",
"client",
"cloud",
"credentials",
"library",
"sdk",
"tool"
],
"support": {
"issues": "https://github.com/aliyun/credentials-php/issues",
"source": "https://github.com/aliyun/credentials-php"
},
"time": "2025-03-03T12:51:01+00:00"
},
{
"name": "alibabacloud/darabonba-openapi",
"version": "0.2.13",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/darabonba-openapi.git",
"reference": "0213396384e2c064eefd614f3dd53636a63f987f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/darabonba-openapi/zipball/0213396384e2c064eefd614f3dd53636a63f987f",
"reference": "0213396384e2c064eefd614f3dd53636a63f987f",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/credentials": "^1.1",
"alibabacloud/gateway-spi": "^1",
"alibabacloud/openapi-util": "^0.1.10|^0.2.1",
"alibabacloud/tea-utils": "^0.2.21",
"alibabacloud/tea-xml": "^0.2",
"php": ">5.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Darabonba\\OpenApi\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud OpenApi Client",
"support": {
"issues": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/issues",
"source": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/tree/0.2.13"
},
"time": "2024-07-15T13:11:36+00:00"
},
{
"name": "alibabacloud/dyvmsapi-20170525",
"version": "3.2.2",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/Dyvmsapi-20170525.git",
"reference": "20c50b61eb383d1aebbdcfe91fa3808fc81fad3a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/Dyvmsapi-20170525/zipball/20c50b61eb383d1aebbdcfe91fa3808fc81fad3a",
"reference": "20c50b61eb383d1aebbdcfe91fa3808fc81fad3a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/darabonba-openapi": "^0.2.13",
"alibabacloud/endpoint-util": "^0.1.0",
"alibabacloud/openapi-util": "^0.1.10|^0.2.1",
"alibabacloud/tea-utils": "^0.2.21",
"php": ">5.5"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\SDK\\Dyvmsapi\\V20170525\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud Dyvmsapi (20170525) SDK Library for PHP",
"support": {
"source": "https://github.com/alibabacloud-sdk-php/Dyvmsapi-20170525/tree/3.2.2"
},
"time": "2024-10-15T09:56:52+00:00"
},
{
"name": "alibabacloud/endpoint-util",
"version": "0.1.1",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/endpoint-util.git",
"reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/endpoint-util/zipball/f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
"reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35|^5.4.3"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Endpoint\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud Endpoint Library for PHP",
"support": {
"source": "https://github.com/alibabacloud-sdk-php/endpoint-util/tree/0.1.1"
},
"time": "2020-06-04T10:57:15+00:00"
},
{
"name": "alibabacloud/gateway-spi",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi.git",
"reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/alibabacloud-gateway-spi/zipball/7440f77750c329d8ab252db1d1d967314ccd1fcb",
"reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/credentials": "^1.1",
"php": ">5.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Darabonba\\GatewaySpi\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud Gateway SPI Client",
"support": {
"source": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi/tree/1.0.0"
},
"time": "2022-07-14T05:31:35+00:00"
},
{
"name": "alibabacloud/openapi-util",
"version": "0.2.1",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/openapi-util.git",
"reference": "f31f7bcd835e08ca24b6b8ba33637eb4eceb093a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/openapi-util/zipball/f31f7bcd835e08ca24b6b8ba33637eb4eceb093a",
"reference": "f31f7bcd835e08ca24b6b8ba33637eb4eceb093a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/tea": "^3.1",
"alibabacloud/tea-utils": "^0.2",
"lizhichao/one-sm": "^1.5",
"php": ">5.5"
},
"require-dev": {
"phpunit/phpunit": "*"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\OpenApiUtil\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud OpenApi Util",
"support": {
"issues": "https://github.com/alibabacloud-sdk-php/openapi-util/issues",
"source": "https://github.com/alibabacloud-sdk-php/openapi-util/tree/0.2.1"
},
"time": "2023-01-10T09:10:10+00:00"
},
{
"name": "alibabacloud/tea",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/aliyun/tea-php.git",
"reference": "1619cb96c158384f72b873e1f85de8b299c9c367"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aliyun/tea-php/zipball/1619cb96c158384f72b873e1f85de8b299c9c367",
"reference": "1619cb96c158384f72b873e1f85de8b299c9c367",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"adbario/php-dot-notation": "^2.4",
"ext-curl": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-simplexml": "*",
"ext-xmlwriter": "*",
"guzzlehttp/guzzle": "^6.3|^7.0",
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "*",
"symfony/dotenv": "^3.4",
"symfony/var-dumper": "^3.4"
},
"suggest": {
"ext-sockets": "To use client-side monitoring"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Tea\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com",
"homepage": "http://www.alibabacloud.com"
}
],
"description": "Client of Tea for PHP",
"homepage": "https://www.alibabacloud.com/",
"keywords": [
"alibabacloud",
"client",
"cloud",
"tea"
],
"support": {
"issues": "https://github.com/aliyun/tea-php/issues",
"source": "https://github.com/aliyun/tea-php"
},
"time": "2023-05-16T06:43:41+00:00"
},
{
"name": "alibabacloud/tea-utils",
"version": "0.2.21",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/tea-utils.git",
"reference": "5039e45714c6456186d267f5d81a4b260a652495"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-utils/zipball/5039e45714c6456186d267f5d81a4b260a652495",
"reference": "5039e45714c6456186d267f5d81a4b260a652495",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/tea": "^3.1",
"php": ">5.5"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Tea\\Utils\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud Tea Utils for PHP",
"support": {
"issues": "https://github.com/aliyun/tea-util/issues",
"source": "https://github.com/aliyun/tea-util"
},
"time": "2024-07-05T06:05:54+00:00"
},
{
"name": "alibabacloud/tea-xml",
"version": "0.2.4",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/tea-xml.git",
"reference": "3e0c000bf536224eebbac913c371bef174c0a16a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-xml/zipball/3e0c000bf536224eebbac913c371bef174c0a16a",
"reference": "3e0c000bf536224eebbac913c371bef174c0a16a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">5.5"
},
"require-dev": {
"phpunit/phpunit": "*",
"symfony/var-dumper": "*"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Tea\\XML\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud Tea XML Library for PHP",
"support": {
"source": "https://github.com/alibabacloud-sdk-php/tea-xml/tree/0.2.4"
},
"time": "2022-08-02T04:12:58+00:00"
},
{
"name": "composer/pcre",
"version": "3.3.2",
@ -475,6 +1033,66 @@
},
"time": "2024-03-28T04:15:16+00:00"
},
{
"name": "lizhichao/one-sm",
"version": "1.10",
"source": {
"type": "git",
"url": "https://github.com/lizhichao/sm.git",
"reference": "687a012a44a5bfd4d9143a0234e1060543be455a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lizhichao/sm/zipball/687a012a44a5bfd4d9143a0234e1060543be455a",
"reference": "687a012a44a5bfd4d9143a0234e1060543be455a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.6"
},
"type": "library",
"autoload": {
"psr-4": {
"OneSm\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "tanszhe",
"email": "1018595261@qq.com"
}
],
"description": "国密sm3",
"keywords": [
"php",
"sm3"
],
"support": {
"issues": "https://github.com/lizhichao/sm/issues",
"source": "https://github.com/lizhichao/sm/tree/1.10"
},
"funding": [
{
"url": "https://www.vicsdf.com/img/w.jpg",
"type": "custom"
},
{
"url": "https://www.vicsdf.com/img/z.jpg",
"type": "custom"
}
],
"time": "2021-05-26T06:19:22+00:00"
},
{
"name": "maennchen/zipstream-php",
"version": "3.1.1",