<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/common/common_tools.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/RewardDao.php'; $id = $_GET['id']; $action = $_GET['action']; $dao = new RewardDao(); if ($action == "receive") { $dao->updateReceived($id, 1); } else { if ($action == "unreceive") { $dao->updateReceived($id, 0); } else { if ($action == "delete") { $dao->del($id); } } } header("Location:" . getBaseUrl() . "website/backstage/reward_list.php");
<head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="../css/bootstrap.min.css" rel="stylesheet" media="screen" /> <link href="css/all.css" rel="stylesheet"/> <script src="../js/integration/jquery.min.js"></script> <script src="../js/integration/bootstrap.min.js"></script> <script src="../js/integration/jquery.form.js"></script> <script src="js/all.js"></script> <script src="js/reward_list.js"></script> <title>探庐者后台-中奖者列表</title> </head> <body> <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/controllers/check_admin_login_action.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/RewardDao.php'; $rewardDao = new RewardDao(); $rewards_unreceived = $rewardDao->getAll(0); $rewards_received = $rewardDao->getAll(1); ?> <div id="container"> <?php include 'navigator.php'; ?> <input type="hidden" id="page" value="reward"/> <div class="navbar"> <div class="navbar-inner"> <ul class="nav nav-tabs nav-justified"> <li role="presentation" class="nav_tab unreceived active"> <a href="#">未领奖</a> </li> <li role="presentation" class="nav_tab received">
/** For your local testing: */ $pm = new PropertyManager(); $dummy_openid = $pm->getDummyOpenid(); if (empty($openid) && isset($dummy_openid)) { $openid = $dummy_openid; } /** localhost test context END.*/ // Lottery logic if (isset($openid)) { $r = rand(0, 7); $gua = rand(0, 3); // Draw lottery. 抽奖放在这里 $wls = new WechatLotteryService(); // Today's drawing time. 第几次抽奖 $today_time = $wls->save_onelot($openid); $rewardDao = new RewardDao(); $reward_row = $rewardDao->getByOpenid($openid); if ($today_time == WechatLotteryService::OVER_LIMIT) { // Draw action over daily limit header("Location:result.php?price=-1&casa=" . $r . "&gua=" . $gua); } else { if ($reward_row) { // Already won, 中过奖了 header("Location:result.php?price=0&casa=" . $r . "&gua=" . $gua); } else { $win = $wls->draw(); // 中奖了 if ($win) { // 中了几等奖 $price_level = $wls->draw_price(); // save in session