Esempio n. 1
0
File: admin.php Progetto: kemao/php
    $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 = [];
    $itemdata['total'] = isset($_GET['total']) ? $_GET['total'] : 0;
    $itemdata['rate'] = isset($_GET['rate']) ? $_GET['rate'] : 0;
    $gift = new gift();
    $data = [];
    $data['status'] = 1;
    $data['data'] = "修改完毕";
    if ((int) $id == 3 || (int) $id == 4) {
        $gift->setGiftItem($id, $itemdata);
    } else {
        $data['status'] = -1;
        $data['data'] = "修改失败,已锁定";
    }
    header('Content-type: application/json');
    echo json_encode($data);
}