From 46146961e6356a3e50aae94f1d16f86d0f1d9e9d Mon Sep 17 00:00:00 2001 From: kf_wuhao <15392746632@qq.com> Date: Tue, 2 Mar 2021 19:05:58 +0800 Subject: [PATCH] 1 --- pmcalendar.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pmcalendar.php b/pmcalendar.php index 947f486..aad7fda 100644 --- a/pmcalendar.php +++ b/pmcalendar.php @@ -201,13 +201,20 @@ if ($act == 'newevent') { we('1'); } else if ($act == 'edityanqi') { $id = r('id'); + $idx = r('idx'); + $del = r('del'); $content = stripslashes(r('content')); - $data_array = json_decode($content,true); - $data_array['date'] =date("Y-m-d H:i:s"); - $dict = array( - 'yanqi_remark' => json_encode($data_array) - ); + $dict = array(); + $event = DB::getone("select yanqi_history from calendar where id={$id}"); + $yanqi_history = $event['yanqi_history']; + if(!$del) { + $yanqi_history[$idx]['reason'] = $content; + } + else{ + unset($yanqi_history[$idx]); + } + $dict['yanqi_history']=json_encode($yanqi_history,true); $sql = DB::update('calendar', $dict, "id='{$id}'"); DB::exe($sql); we('1'); @@ -236,7 +243,7 @@ if ($act == 'newevent') { if (!$yanqi_history) $yanqi_history = '[]'; $yanqi_history = json_decode($yanqi_history,true); $isYanqi = strtotime($event['start'])$isYanqi,'date1'=>$event['start'],'date2'=>$dict['end'],'user'=>$user['name'],'reason'=>$reason); + array_unshift($yanqi_history,array('isYanqi'=>$isYanqi,'date1'=>$event['start'],'date2'=>$dict['end'],'user'=>$user['name'],'reason'=>$reason)); $dict['yanqi_history']=json_encode($yanqi_history,true); $sql = DB::update('calendar', $dict, "id='{$id}'");