超管后台 - 添加项目新增分组

This commit is contained in:
柳清爽
2025-04-29 16:12:37 +08:00
parent e6286a8ee4
commit e098ff8c46

View File

@@ -2,6 +2,7 @@
namespace app\superadmin\controller\company;
use app\api\controller\DeviceController;
use app\common\model\Company as CompanyModel;
use app\common\model\User as UsersModel;
use app\superadmin\controller\BaseController;
@@ -105,6 +106,23 @@ class CreateCompanyController extends BaseController
return $this;
}
/**
* 设备创建分组
*
* @param array $params
* @return void
* @throws \Exception
*/
protected function s2CreateDeviceGroup(array $params): void
{
$respon = (new DeviceController())->createGroup($params, true);
$respon = json_decode($respon, true);
if ($respon['code'] != 200) {
throw new \Exception('设备分组添加错误', 210 . $respon['code']);
}
}
/**
* S2 部分
*
@@ -120,6 +138,9 @@ class CreateCompanyController extends BaseController
throw new \Exception('S2返参异常', 210402);
}
// 设备创建分组
$this->s2CreateDeviceGroup(['groupName' => $params['name']]);
return array_merge($params, [
'companyId' => $department['departmentId'],
's2_accountId' => $department['id'],