prepare($sql); $stmt->execute(); echo 'Success'; } // 獎金確認發放,並更新獎金 OR 實際發放時間 if (!empty($_POST['postType']) && $_POST['postType'] == 'b') { $id = empty($_POST['id']) ? '' : $_POST['id']; $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; $bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue']; $note = empty($_POST['note']) ? '' : $_POST['note']; $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; $review_at = date("Y-m-d"); try { $sql = "UPDATE bonus SET status = 2,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id"; $stmt = $conn->prepare($sql); $stmt->execute(); header("HTTP/1.1 200 success!"); } catch (PDOException $e) { header("HTTP/1.1 500 failed!"); echo $e->getMessage(); die('Error!:' . $e->getMessage()); } } // 獎金暫不發放 if (!empty($_POST['postType']) && $_POST['postType'] == 'c') { // echo 'cccccc'; $id = empty($_POST['id']) ? '' : $_POST['id']; $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; $bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue']; $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; $note = empty($_POST['note']) ? '' : $_POST['note']; try { $sql = "UPDATE bonus SET status = 4,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id"; $stmt = $conn->prepare($sql); $stmt->execute(); header("HTTP/1.1 200 success!"); } catch (PDOException $e) { header("HTTP/1.1 500 failed!"); echo $e->getMessage(); die('Error!:' . $e->getMessage()); } } if (!empty($_POST['postType']) && $_POST['postType'] == 'd') { $id = empty($_POST['id']) ? '' : $_POST['id']; print_r($id); // echo 'ddddd'; }