blog/app/service/RoleMenuService.php

29 lines
562 B
PHP
Raw Permalink Normal View History

2024-06-08 15:54:41 +08:00
<?php
namespace app\service;
use app\model\RoleMenu;
class RoleMenuService
{
/**
* @Inject
* @var RoleMenu
*/
private $roleMenu;
public function save(array $param): array
{
$arr = [];
foreach ($param['menu_ids'] as $v) {
$arr[] = [
'role_id' => $param['role_id'],
'menu_id' => $v,
'create_time' => time()
];
}
$this->roleMenu->delByRoleId($param['role_id']);
return $this->roleMenu->saveData($arr);
}
}