|
|
@@ -5,6 +5,7 @@ namespace bizGhs\ws\services;
|
|
|
use common\components\baiduAip;
|
|
|
use common\components\dict;
|
|
|
use common\components\goWs;
|
|
|
+use common\components\oss;
|
|
|
use common\components\util;
|
|
|
use GatewayClient\Gateway;
|
|
|
use Yii;
|
|
|
@@ -16,10 +17,16 @@ class WsService
|
|
|
$msg = '微信到账'.$money;
|
|
|
$audio = baiduAip::transfer($msg,4,0);
|
|
|
Yii::info("触发到账通知:".$adminId. " ".$money);
|
|
|
+
|
|
|
if(!is_array($audio)){
|
|
|
try{
|
|
|
- $audio = base64_encode($audio);
|
|
|
- $data = ['type' => 'money','url'=>'data:audio/wav;base64,'.$audio, 'msg' => $msg,'money'=>$money];
|
|
|
+ //上传到oss
|
|
|
+ $file =time().rand(10000,999999).'.mp3';
|
|
|
+ $filePath = 'tmp/arrival/money/'.$file;
|
|
|
+ oss::uploadTmpAudio($filePath,$audio);
|
|
|
+ $url = 'https://oss-cn-hangzhou.aliyuncs.com/'.$filePath;
|
|
|
+ // $audio = base64_encode($audio);
|
|
|
+ $data = ['type' => 'money','url'=>$url, 'msg' => $msg,'money'=>$money];
|
|
|
$dataString = json_encode($data);
|
|
|
goWs::sendToUid($adminId,$dataString);
|
|
|
//判断是否在线
|
|
|
@@ -32,7 +39,6 @@ class WsService
|
|
|
Yii::warning("ws arrivalNotice error ". $exception->getMessage());
|
|
|
}
|
|
|
}else{
|
|
|
-
|
|
|
Yii::warning("到账通知 语音获取失败" .json_encode($audio));
|
|
|
}
|
|
|
|