Exemple #1
0
            echo "<script>window.alert('兑换失败!');" . "window.location.href='http://weilink.huaxi100.com/spe/weixin-shake/my_coupons.php';</script>";
            exit;
        }
        break;
    case "shake":
        $id = $_GET['id'];
        $shake->record_shake_time($id);
        break;
    case "contact":
        $id = $_POST['id'];
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $msg = '';
        if (empty($name)) {
            $msg .= '请输入姓名\\n';
        }
        if (empty($phone)) {
            $msg .= '请输入手机号';
        }
        if (empty($msg)) {
            $success = $shake->record_contact($id, $name, $phone);
            if ($success) {
                echo json_encode(array('success' => true));
            } else {
                echo json_encode(array('success' => false, 'msg' => "保存联系方式出错"));
            }
        } else {
            echo json_encode(array('success' => false, 'msg' => $msg));
        }
        break;
}