From 10ddd7869aaf19c794ec5759c2f7ac65180a42d8 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 11 Jan 2024 15:41:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/project/controller/Project.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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(''); }