29 lines
562 B
PHP
29 lines
562 B
PHP
<?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);
|
|
}
|
|
} |