This commit is contained in:
kf_wuhao 2021-03-02 19:05:58 +08:00
parent 16b7483e81
commit 46146961e6

View File

@ -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'])<strtotime($dict['end'])?1:2;
$yanqi_history[] = array('isYanqi'=>$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}'");