36 lines
736 B
PHP
36 lines
736 B
PHP
<?php
|
|
|
|
namespace app\common\service;
|
|
|
|
use app\common\model\Device;
|
|
use app\constant\ResponseCode;
|
|
use think\Exception;
|
|
|
|
class DeviceService
|
|
{
|
|
|
|
/**
|
|
* @desc 设备列表
|
|
* @return array
|
|
*/
|
|
public function getDeviceService()
|
|
{
|
|
try {
|
|
$list = Device::order('sort desc, id desc')->field('id,device_name')->select();
|
|
|
|
return [
|
|
'code' => ResponseCode::SUCCESS,
|
|
'data' => [
|
|
'list' => $list
|
|
],
|
|
'msg' => 'success'
|
|
];
|
|
} catch (Exception $e) {
|
|
return [
|
|
'code' => ResponseCode::FAIL,
|
|
'msg' => $e->getMessage()
|
|
];
|
|
}
|
|
}
|
|
|
|
} |