|
|
@@ -12,9 +12,6 @@ require_once '../app/library/baidu-api-speech/AipSpeech.php';
|
|
|
class MeasureMonitorController extends Controller
|
|
|
{
|
|
|
|
|
|
- const APP_ID='18433903';
|
|
|
- const API_KEY='3pfojF55BI9LFfXdaI8wRyV2';
|
|
|
- const SECRET_KEY='ZRSZWUPNgRNrdm4gBQ5Gf0c1oANN4mnd';
|
|
|
/**
|
|
|
* Display a listing of the resource.
|
|
|
*
|
|
|
@@ -22,14 +19,12 @@ class MeasureMonitorController extends Controller
|
|
|
*/
|
|
|
public function index(Request $request)
|
|
|
{
|
|
|
- if(!Gate::allows('称重管理-查询')){ return redirect(url('/')); }
|
|
|
$measuringMachines=MeasuringMachine::select('id','name','code','status')->get();
|
|
|
$laravelEchoPrefix = config('database.redis.options.prefix');
|
|
|
return view('weight.measureMonitor.index',compact('laravelEchoPrefix','measuringMachines'));
|
|
|
}
|
|
|
|
|
|
public function data(Request $request){
|
|
|
- if(!Gate::allows('称重管理-查询')){ return redirect(url('/')); }
|
|
|
$measuring_machine_id=$request->input('id');
|
|
|
if ($measuring_machine_id){
|
|
|
/*$package=Package::with('owner','paperBox','measuringMachine')->where('measuring_machine_id',$measuringMachines[0]->id)->orderBy('id','DESC')->first();*/
|
|
|
@@ -59,12 +54,12 @@ class MeasureMonitorController extends Controller
|
|
|
if (file_exists("storage/".$logistic.'.mp3')){
|
|
|
return "/storage/".$logistic.'.mp3';
|
|
|
}
|
|
|
- $client=new \AipSpeech(self::APP_ID,self::API_KEY,self::SECRET_KEY);
|
|
|
+ $client=new \AipSpeech(config('api.baidu.speech.APP_ID'),config('api.baidu.speech.API_KEY'),config('api.baidu.speech.SECRET_KEY'));
|
|
|
$client->setConnectionTimeoutInMillis('180000');
|
|
|
$client->setSocketTimeoutInMillis('180000');
|
|
|
|
|
|
$result = $client->synthesis($logistic, 'zh', 1, array(
|
|
|
- 'vol' => 10,
|
|
|
+ 'vol' => 15,
|
|
|
));
|
|
|
// 识别正确返回语音二进制 错误则返回json 参照下面错误码
|
|
|
if(!is_array($result)){
|