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.
64 lines
2.1 KiB
64 lines
2.1 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\service\api\apiService;
|
|
|
|
use app\model\campus_person_role\CampusPersonRole;
|
|
use app\model\resource_sharing\ResourceSharing;
|
|
use core\base\BaseApiService;
|
|
|
|
/**
|
|
* 资源共享服务层
|
|
* Class MemberService
|
|
* @package app\service\api\member
|
|
*/
|
|
class ResourceSharingService extends BaseApiService
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->model = (new ResourceSharing());
|
|
}
|
|
|
|
//获取列表
|
|
public function getList(array $where)
|
|
{
|
|
$page_params = $this->getPageParam();//获取请求参数中的页码+分页数
|
|
$page = $page_params['page'];
|
|
$limit = $page_params['limit'];
|
|
|
|
$person_id = $this->member_id;//当前登录的员工id
|
|
|
|
//查当前用户的归属校区
|
|
$campus_id = CampusPersonRole::where('person_id',$person_id)->value('campus_id');
|
|
//查当前用户校区下的全部员工id
|
|
$person_id_arr = CampusPersonRole::where('campus_id',$campus_id) ->distinct(true)
|
|
->column('person_id');
|
|
|
|
$model = $this->model;
|
|
|
|
if (!isset($where['shared_by']) && $where['shared_by'] !== '') {
|
|
$model = $model->where('shared_by', $where['shared_by']);
|
|
}
|
|
$model = $model->whereIn('user_id', $person_id_arr);
|
|
//分页查询
|
|
$res = $model->with([
|
|
'customerResource'=>function($query){}
|
|
])->paginate([
|
|
'list_rows' => $limit,
|
|
'page' => $page,
|
|
])->toArray();
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
}
|
|
|