diff --git a/application/project/controller/Project.php b/application/project/controller/Project.php index 48fb54d..d6bd43d 100755 --- a/application/project/controller/Project.php +++ b/application/project/controller/Project.php @@ -566,9 +566,13 @@ class Project extends BasicApi public function positioning(){ $member_code=Request::post('member_code'); $positioning=Request::post('positioning'); - // $find=Db::name('positioning')->where(['member_code'=>$member_code,'positioning'=>$positioning])->find(); - if($member_code && $positioning){ - Db::name('positioning')->insert(['member_code'=>$member_code,'positioning'=>$positioning,'date'=>date('Y-m-d H:i:s')]); + $find=Db::name('positioning')->where(['member_code'=>$member_code,'positioning'=>$positioning])->find(); + if($find){ + Db::name('positioning')->where(['member_code'=>$member_code,'positioning'=>$positioning])->update(['end_date'=>date('Y-m-d H:i:s')]); + }else{ + if($member_code && $positioning){ + Db::name('positioning')->insert(['member_code'=>$member_code,'positioning'=>$positioning,'date'=>date('Y-m-d H:i:s')]); + } } $this->success(''); }