作者 lyh

gx

... ... @@ -91,7 +91,7 @@ class AyrShareController extends BaseController
$this->response('同步绑定失败');
}
//执行数据库操作
$ayrShareLogic->ayr_share_add($res);
$ayrShareLogic->ayr_share_save($res);
$this->response('success');
}
... ... @@ -108,6 +108,7 @@ class AyrShareController extends BaseController
'id.required' => 'ID不能为空'
]);
$info = $ayrShareLogic->ayr_share_info();
if(!empty($info['title'])){
$data = [
// 'title'=>$info['title'],
'profileKey'=>$info['profile_key']
... ... @@ -118,6 +119,7 @@ class AyrShareController extends BaseController
if($res['status'] == 'fail'){
$this->response('同步删除失败');
}
}
$ayrShareLogic->ayr_share_del();
$this->response('success');
}
... ...
... ... @@ -46,7 +46,7 @@ class AyrShareLogic extends BaseLogic
* @method :post
* @time :2023/5/6 9:19
*/
public function ayr_share_add($res){
public function ayr_share_save($res){
//插入数据库
$param = [
'title'=>$res['title'],
... ... @@ -56,7 +56,12 @@ class AyrShareLogic extends BaseLogic
'project_id'=>$this->user['project_id'],
'name'=>$this->param['name'],
];
$info = $this->model->read(['name'=>$this->param['name']]);
if($info !== false){
$rs = $this->model->edit($param,['id'=>$info['id']]);
}else{
$rs = $this->model->add($param);
}
if($rs === false){
$this->fail('error');
}
... ...