|
@@ -10,14 +10,16 @@ use App\Service\SysMenuService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Redis;
|
|
use Illuminate\Support\Facades\Redis;
|
|
use Illuminate\Support\Str;
|
|
use Illuminate\Support\Str;
|
|
|
|
+use Obs\ObsClient;
|
|
|
|
|
|
class DwyController extends BaseController
|
|
class DwyController extends BaseController
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
- public function advertisement()
|
|
|
|
|
|
+ public function advertisement(Request $request)
|
|
{
|
|
{
|
|
|
|
|
|
|
|
+
|
|
return ['status' => 200, 'data' => [
|
|
return ['status' => 200, 'data' => [
|
|
'video' => ['https://clouddevice.qingyaokeji.com/1.mp4',
|
|
'video' => ['https://clouddevice.qingyaokeji.com/1.mp4',
|
|
'https://clouddevice.qingyaokeji.com/2.mp4'],
|
|
'https://clouddevice.qingyaokeji.com/2.mp4'],
|
|
@@ -27,6 +29,77 @@ class DwyController extends BaseController
|
|
],
|
|
],
|
|
'limit_time' => 10
|
|
'limit_time' => 10
|
|
]];
|
|
]];
|
|
|
|
+ $data = $request->all();
|
|
|
|
+ file_put_contents('dwy1.txt', json_encode(['data'=>$data,'header']) . PHP_EOL, 8);
|
|
|
|
+ $url = 'https://tm.dwycloud.com/jbl/api/module-data/poster/poster/diy/device_code';
|
|
|
|
+ $token = $data['token'];
|
|
|
|
+ $param = ['device_code'=>$data['mac']];
|
|
|
|
+ $header = [
|
|
|
|
+ 'Content-Type:application/json',
|
|
|
|
+ 'Authorization: ' . $token,
|
|
|
|
+ ];
|
|
|
|
+ $box_data = $this->post_helper($url, json_encode($param), $header);
|
|
|
|
+ $box_data = json_decode($box_data, true);
|
|
|
|
+ dd($box_data);
|
|
|
|
+ if(isset($box_data)&&$box_data['status'] === 'success'){
|
|
|
|
+ $return = [
|
|
|
|
+ 'video' => [],
|
|
|
|
+ 'img' => [],
|
|
|
|
+ 'limit_time' => 10
|
|
|
|
+ ];
|
|
|
|
+ foreach ($box_data['data'] as $v){
|
|
|
|
+ if(isset($v['poster_attachment']['picture_attachment']['attachFile'])){
|
|
|
|
+ foreach ($v['poster_attachment']['picture_attachment']['attachFile'] as $vv){
|
|
|
|
+ $return['img'][] = $vv['url'].'.'.$vv['typeEk'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(isset($v['poster_attachment']['attachment']['attachFile'])){
|
|
|
|
+ foreach ($v['poster_attachment']['attachment']['attachFile'] as $vv){
|
|
|
|
+
|
|
|
|
+ $return['video'][] = $vv['url'].'.'.$vv['typeEk'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+// var_dump($return);die;
|
|
|
|
+ }else{
|
|
|
|
+ $return = [
|
|
|
|
+ 'video' => ['https://clouddevice.qingyaokeji.com/1.mp4',
|
|
|
|
+ 'https://clouddevice.qingyaokeji.com/2.mp4'],
|
|
|
|
+ 'img' => [
|
|
|
|
+ 'https://clouddevice.qingyaokeji.com/3.jpeg',
|
|
|
|
+ 'https://clouddevice.qingyaokeji.com/3.jpeg',
|
|
|
|
+ ],
|
|
|
|
+ 'limit_time' => 10
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return ['status' => 200, 'data' => $return];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function getObsUrl(){
|
|
|
|
+ $obsClient = new ObsClient([
|
|
|
|
+ 'key' => 'RN0XF4M0LJDJOVAUGPNK',
|
|
|
|
+ 'secret' => 'eCH4ga2kEgQBD2I6niIZkkjxLWIAPKotS5mhwNTE',
|
|
|
|
+ 'endpoint' => 'https://shangbiaoji-test.obs.cn-east-2.myhuaweicloud.com'
|
|
|
|
+ ]);
|
|
|
|
+ // 设置桶名和对象名
|
|
|
|
+ $bucketName = 'shangbiaoji';
|
|
|
|
+ $objectKey = '20240621/E1F5AF36B011AEBAACB7246DD15F5E1E.mp4'; // 例如:path/to/video.mp4
|
|
|
|
+ // 设置过期时间(以秒为单位)
|
|
|
|
+ $expires = 3600; // URL的有效期为1小时
|
|
|
|
+ // 生成预签名URL
|
|
|
|
+ $response = $obsClient->createSignedUrl([
|
|
|
|
+ 'Method' => 'GET', // 请求方法
|
|
|
|
+ 'Bucket' => $bucketName,
|
|
|
|
+ 'Key' => $objectKey,
|
|
|
|
+ 'Expires' => $expires
|
|
|
|
+ ]);
|
|
|
|
+ // 获取预签名URL
|
|
|
|
+ $signedUrl = $response['SignedUrl'];
|
|
|
|
+ $obsClient->close();
|
|
|
|
+ var_dump($signedUrl);die;
|
|
}
|
|
}
|
|
|
|
|
|
public function openCommand(Request $request)
|
|
public function openCommand(Request $request)
|
|
@@ -685,7 +758,7 @@ class DwyController extends BaseController
|
|
|
|
|
|
}
|
|
}
|
|
$box_list = [
|
|
$box_list = [
|
|
- 6,7
|
|
|
|
|
|
+ 1,2
|
|
];
|
|
];
|
|
foreach ($box_list as $v){
|
|
foreach ($box_list as $v){
|
|
$v = $v+3;
|
|
$v = $v+3;
|
|
@@ -719,7 +792,7 @@ class DwyController extends BaseController
|
|
$list = $param['list'];
|
|
$list = $param['list'];
|
|
$mac = $param['mac'];
|
|
$mac = $param['mac'];
|
|
// if($mac === '28f1e65c8cfd496f'){
|
|
// if($mac === '28f1e65c8cfd496f'){
|
|
-//
|
|
|
|
|
|
+////
|
|
// return $this->test();
|
|
// return $this->test();
|
|
// }
|
|
// }
|
|
$url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/box_inventory';
|
|
$url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/box_inventory';
|