|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
|
|
* @name :OaNoticeController.php
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/6/20 10:47
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Aside\Com;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Controllers\Aside\BaseController;
|
|
|
|
use App\Models\OaNotice\OaNotice;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class OaNoticeController extends BaseController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @remark :通知消息
|
|
|
|
* @name :lists
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/6/20 10:49
|
|
|
|
*/
|
|
|
|
public function lists(){
|
|
|
|
$oaNoticeModel = new OaNotice();
|
|
|
|
$query = $oaNoticeModel->sortOrder($oaNoticeModel,'created_at','desc');
|
|
|
|
$query = $this->searchMap($query);
|
|
|
|
$lists = $query->paginate($this->row, ['*'], 'page', $this->page)->toArray();
|
|
|
|
if(!empty($lists) && !empty($lists['list'])){
|
|
|
|
$projectModel = new Project();
|
|
|
|
foreach ($lists['list'] as $k => $v){
|
|
|
|
if(strtolower($v['project_str']) != 'all'){
|
|
|
|
$v['project_title'] = $projectModel->formatQuery(['id'=>['in',explode(',',$v['project_str'])]])->pluck('title')->toArray();
|
|
|
|
}else{
|
|
|
|
$v['project_title'] = '所有';
|
|
|
|
}
|
|
|
|
$lists['list'][$k] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$lists = [];
|
|
|
|
$this->response('success',Code::SUCCESS,$lists);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :参数搜索
|
|
|
|
* @name :searchMap
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/6/20 11:09
|
|
|
|
*/
|
|
|
|
public function searchMap(&$query){
|
|
|
|
if(isset($this->map['project_title']) && !empty($this->map['project_title'])){
|
|
|
|
$projectModel = new Project();
|
|
|
|
$project_id_arr = $projectModel->formatQuery(['title'=>['like','%'.$this->map['project_title'].'%']])->pluck('id')->toArray();
|
|
|
|
if(!empty($project_id_arr)){
|
|
|
|
$query->where(function ($subQuery) use ($project_id_arr) {
|
|
|
|
foreach ($project_id_arr as $v) {
|
|
|
|
$subQuery->orWhereRaw("FIND_IN_SET(?, project_str) > 0", [$v]);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存数据
|
|
|
|
* @name :save
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/6/20 10:49
|
|
|
|
*/
|
|
|
|
public function save(){
|
|
|
|
$data = [];
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :修改状态
|
|
|
|
* @name :status
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/6/20 10:50
|
|
|
|
*/
|
|
|
|
public function status(){
|
|
|
|
$data = [];
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :删除数据
|
|
|
|
* @name :del
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/6/20 10:50
|
|
|
|
*/
|
|
|
|
public function del(){
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|