作者 lyh

gx

@@ -28,8 +28,8 @@ class ProjectCountryController extends BaseController @@ -28,8 +28,8 @@ class ProjectCountryController extends BaseController
28 * @method :post 28 * @method :post
29 * @time :2023/4/28 17:53 29 * @time :2023/4/28 17:53
30 */ 30 */
31 - public function edit(ProjectCountryLogic $projectCountryLogic){  
32 - $projectCountryLogic->country_edit(); 31 + public function save(ProjectCountryLogic $projectCountryLogic){
  32 + $projectCountryLogic->country_save();
33 $this->response('success'); 33 $this->response('success');
34 } 34 }
35 } 35 }
@@ -34,8 +34,14 @@ class ProjectCountryLogic extends BaseLogic @@ -34,8 +34,14 @@ class ProjectCountryLogic extends BaseLogic
34 * @method :post 34 * @method :post
35 * @time :2023/4/28 17:42 35 * @time :2023/4/28 17:42
36 */ 36 */
37 - public function country_edit(){ 37 + public function country_save(){
  38 + $info = $this->model->read(['project_id'=>$this->user['project_id']]);
  39 + if($info === false){
  40 + $this->param['project_id'] = $this->user['project_id'];
  41 + $rs = $this->model->add($this->param);
  42 + }else{
38 $rs = $this->model->edit($this->param,['project_id'=>$this->user['project_id']]); 43 $rs = $this->model->edit($this->param,['project_id'=>$this->user['project_id']]);
  44 + }
39 if($rs === false){ 45 if($rs === false){
40 $this->fail('当前数据不存在'); 46 $this->fail('当前数据不存在');
41 } 47 }