作者 lyh

gx

... ... @@ -28,8 +28,8 @@ class ProjectCountryController extends BaseController
* @method :post
* @time :2023/4/28 17:53
*/
public function edit(ProjectCountryLogic $projectCountryLogic){
$projectCountryLogic->country_edit();
public function save(ProjectCountryLogic $projectCountryLogic){
$projectCountryLogic->country_save();
$this->response('success');
}
}
... ...
... ... @@ -34,8 +34,14 @@ class ProjectCountryLogic extends BaseLogic
* @method :post
* @time :2023/4/28 17:42
*/
public function country_edit(){
$rs = $this->model->edit($this->param,['project_id'=>$this->user['project_id']]);
public function country_save(){
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$this->param['project_id'] = $this->user['project_id'];
$rs = $this->model->add($this->param);
}else{
$rs = $this->model->edit($this->param,['project_id'=>$this->user['project_id']]);
}
if($rs === false){
$this->fail('当前数据不存在');
}
... ...