作者 lyh

gx

... ... @@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\Com;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Com\OaNoticeLogic;
use App\Models\OaNotice\OaNotice;
use App\Models\Project\Project;
use Illuminate\Support\Facades\DB;
... ... @@ -64,6 +65,7 @@ class OaNoticeController extends BaseController
});
}
}
$this->map['status'] = 0;
return $query;
}
... ... @@ -74,8 +76,21 @@ class OaNoticeController extends BaseController
* @method :post
* @time :2024/6/20 10:49
*/
public function save(){
$data = [];
public function save(OaNoticeLogic $oaNoticeLogic){
$this->request->validate([
'project_str'=>'required',
'title'=>'required',
'remark'=>'required',
'start_time'=>'required',
'end_time'=>'required',
],[
'project_str.required' => 'project_str不能为空',
'title.required' => 'title不能为空',
'remark.required' => 'remark不能为空',
'start_time.required' => 'start_time不能为空',
'end_time.required' => 'end_time不能为空',
]);
$data = $oaNoticeLogic->saveOaNotice();
$this->response('success',Code::SUCCESS,$data);
}
... ... @@ -86,19 +101,15 @@ class OaNoticeController extends BaseController
* @method :post
* @time :2024/6/20 10:50
*/
public function status(){
$data = [];
public function status(OaNoticeLogic $oaNoticeLogic){
$this->request->validate([
'id'=>'required',
'status'=>'required'
],[
'id.required' => 'ID不能为空',
'status.required' => 'status不能为空'
]);
$data = $oaNoticeLogic->statusOaNotice();
$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');
}
}
... ...
... ... @@ -24,4 +24,34 @@ class OaNoticeLogic extends BaseLogic
$this->model = new OaNotice();
$this->param = $this->requestAll;
}
/**
* @remark :保存数据
* @name :saveOaNotice
* @author :lyh
* @method :post
* @time :2024/6/20 15:03
*/
public function saveOaNotice(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
$id = $this->model->addReturnId($this->param);
}
return $this->success(['id'=>$id]);
}
/**
* @remark :修改状态
* @name :statusOaNotice
* @author :lyh
* @method :post
* @time :2024/6/20 15:44
*/
public function statusOaNotice(){
$id = $this->param['id'];
$this->model->edit(['status'=>$this->param['status']],['id'=>$id]);
return $this->success(['id'=>$id]);
}
}
... ...