echo json_encode($data); } if ($action == 'updateCode') { $code = isset($_GET['code']) ? $_GET['code'] : 0; $gift = new gift(); $data = []; $data['status'] = 1; $data['data'] = $gift->setGiftByCode($code); header('Content-type: application/json'); echo json_encode($data); } if ($action == 'queryGiftList') { $gift = new gift(); $data = []; $data['status'] = 1; $data['data'] = $gift->getGiftListAll(); header('Content-type: application/json'); echo json_encode($data); } if ($action == 'getGiftItem') { $gift = new gift(); $data = []; $id = $_GET['id']; $data['status'] = 1; $data['data'] = $gift->getGiftItem($id); header('Content-type: application/json'); echo json_encode($data); } if ($action == 'setGiftItem') { $id = isset($_GET['id']) ? $_GET['id'] : 0; $itemdata = [];