| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- /**
- * Created by PhpStorm.
- * User: qiuzijian
- * Date: 2021-04-25
- * Time: 09:53
- */
- namespace Modules\Camera\Http\Controllers\Api;
- use App\Enum\ApiEnum;
- use App\Http\Controllers\Api\BaseController;
- use Illuminate\Support\Facades\Input;
- use Modules\Camera\Services\CameraServices;
- use Modules\Mine\Entities\MineListExt;
- class CameraApiController extends BaseController
- {
- /**
- * 作者: qiuzijian
- * 注释: 获取摄像头列表
- * @return \App\Http\Controllers\Api\JsonResponse
- */
- public function getCamerasList()
- {
- $parent_id = Input::get('parent_id', '');
- $mine_id = Input::get('mine_id', '');
- if (!$parent_id || !$mine_id) {
- return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
- }
- //判断是否使用海康视频服务器
- $is_hak = MineListExt::where('mine_id', $parent_id)->value('is_hak');
- if ($is_hak) {
- $result = CameraServices::getHaiKangCamera($parent_id, $mine_id);
- } else {
- $result = CameraServices::getCameraListByMineId($mine_id);
- }
- return self::successResponse($result);
- }
- /**
- * 作者: qiuzijian
- * 注释: 获取摄像头播放地址
- * @return \App\Http\Controllers\Api\JsonResponse
- */
- public function getCamerasUrl()
- {
- $parent_id = Input::get('parent_id', '');
- $camera_id = Input::get('camera_id', '');
- if (!$parent_id || !$camera_id) {
- return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
- }
- //判断是否使用海康视频服务器
- $is_hak = MineListExt::where('mine_id', $parent_id)->value('is_hak');
- if ($is_hak) {
- $result = CameraServices::getHaiKangCameraUrl($parent_id, $camera_id);
- } else {
- $result = CameraServices::getCameraUrlByCameraId($camera_id);
- }
- return self::successResponse($result);
- }
- /**
- * 作者: qiuzijian
- * 注释: 停止摄像头推流
- * @return \App\Http\Controllers\Api\JsonResponse
- */
- public function stopCamerasStream()
- {
- $camera_id = Input::get('camera_id', '');
- $result = CameraServices::stopCameraStream($camera_id);
- return self::successResponse($result);
- }
- }
|