调整代码格式及使用常量去替换常用值

This commit is contained in:
柳清爽
2025-05-08 10:39:53 +08:00
parent b5939b36b3
commit 0426485177
31 changed files with 230 additions and 191 deletions

View File

@@ -6,6 +6,7 @@ use app\common\model\Device as DeviceModel;
use app\common\model\DeviceHandleLog as DeviceHandleLogModel;
use app\common\model\DeviceTaskconf;
use app\common\model\DeviceUser as DeviceUserModel;
use app\common\model\User as UserModel;
use app\cunkebao\controller\BaseController;
use library\ResponseHelper;
use think\Db;
@@ -25,9 +26,8 @@ class UpdateDeviceTaskConfigV1Controller extends BaseController
protected function checkDeviceExists(int $deviceId)
{
$where = [
'deviceId' => $deviceId,
'companyId' => $this->getUserInfo('companyId'),
'deleteTime' => 0
'deviceId' => $deviceId,
'companyId' => $this->getUserInfo('companyId'),
];
$device = DeviceModel::find($where);
@@ -46,8 +46,8 @@ class UpdateDeviceTaskConfigV1Controller extends BaseController
protected function checkUserDevicePermission(int $deviceId): void
{
$where = [
'deviceId' => $deviceId,
'userId' => $this->getUserInfo('id'),
'deviceId' => $deviceId,
'userId' => $this->getUserInfo('id'),
'companyId' => $this->getUserInfo('companyId')
];
@@ -81,9 +81,9 @@ class UpdateDeviceTaskConfigV1Controller extends BaseController
DeviceHandleLogModel::addLog(
[
'deviceId' => $deviceId,
'content' => $content,
'userId' => $this->getUserInfo('id'),
'deviceId' => $deviceId,
'content' => $content,
'userId' => $this->getUserInfo('id'),
'companyId' => $this->getUserInfo('companyId'),
]
);
@@ -119,7 +119,7 @@ class UpdateDeviceTaskConfigV1Controller extends BaseController
$this->checkDeviceExists($id);
if ($this->getUserInfo('isAdmin') != 1) {
if ($this->getUserInfo('isAdmin') != UserModel::ADMIN_STP) {
$this->checkUserDevicePermission($id);
}