You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\YingShiSdk\YingShiSdk;
|
|
use think\Request;
|
|
|
|
class YingShiDevice extends Base
|
|
{
|
|
|
|
public function deviceStatus()
|
|
{
|
|
try {
|
|
$request = Request::instance();
|
|
if (!$request->isPost()) throw new \Exception("请求失败,仅允许POST请求方式");
|
|
|
|
$curlData = YingShiSdk::DeviceStatus();
|
|
|
|
if (!is_array($curlData)) throw new \Exception("cURL Error #:" . $curlData);
|
|
|
|
return $this->jsonSuccess('操作成功',$curlData);
|
|
} catch (\Exception $e) {
|
|
return $this->jsonError($e->getMessage());
|
|
}
|
|
}
|
|
|
|
public function deviceInfo()
|
|
{
|
|
try {
|
|
$request = Request::instance();
|
|
if (!$request->isPost()) throw new \Exception("请求失败,仅允许POST请求方式");
|
|
|
|
$curlData = YingShiSdk::DeviceInfo();
|
|
|
|
if (!is_array($curlData)) throw new \Exception("cURL Error #:" . $curlData);
|
|
|
|
return $this->jsonSuccess('操作成功',$curlData);
|
|
|
|
} catch (\Exception $e) {
|
|
return $this->jsonError($e->getMessage());
|
|
}
|
|
}
|
|
|
|
}
|