$data = []; $data['status'] = 1; $data['data'] = $gift->getGiftByCode($code); if ($data['data'] == false) { $data['status'] = -1; $data['data'] = "未找到相关兑奖码"; } header('Content-type: application/json'); 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'];