You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.7 KiB
95 lines
2.7 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\adminapi\controller\resource_sharing;
|
|
|
|
use core\base\BaseAdminController;
|
|
use app\service\admin\resource_sharing\ResourceSharingService;
|
|
|
|
|
|
/**
|
|
* 资源共享控制器
|
|
* Class ResourceSharing
|
|
* @package app\adminapi\controller\resource_sharing
|
|
*/
|
|
class ResourceSharing extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取资源共享列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
["resource_id",""],
|
|
["user_id",""],
|
|
["role_id",""],
|
|
["shared_by",""],
|
|
["shared_at",""]
|
|
]);
|
|
return success((new ResourceSharingService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 资源共享详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new ResourceSharingService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加资源共享
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["resource_id",0],
|
|
["user_id",0],
|
|
["role_id",0],
|
|
["shared_by",0],
|
|
["shared_at",1747389136]
|
|
]);
|
|
$this->validate($data, 'app\validate\resource_sharing\ResourceSharing.add');
|
|
$id = (new ResourceSharingService())->add($data);
|
|
return success('ADD_SUCCESS', ['id' => $id]);
|
|
}
|
|
|
|
/**
|
|
* 资源共享编辑
|
|
* @param $id 资源共享id
|
|
* @return \think\Response
|
|
*/
|
|
public function edit(int $id){
|
|
$data = $this->request->params([
|
|
["resource_id",0],
|
|
["user_id",0],
|
|
["role_id",0],
|
|
["shared_by",0],
|
|
["shared_at",1747389136]
|
|
]);
|
|
$this->validate($data, 'app\validate\resource_sharing\ResourceSharing.edit');
|
|
(new ResourceSharingService())->edit($id, $data);
|
|
return success('EDIT_SUCCESS');
|
|
}
|
|
|
|
/**
|
|
* 资源共享删除
|
|
* @param $id 资源共享id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new ResourceSharingService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
}
|
|
|