/**
  * @param $frequency
  * @param $draw_time
  * @param $now
  * @param $expectedDrawDate
  * @param $method
  */
 private function exerciseGetDrawDate($frequency, $draw_time, $now, $expectedDrawDate, $method)
 {
     $sut = new Lottery();
     $sut->initialize(['frequency' => $frequency, 'draw_time' => $draw_time]);
     $actual = $sut->{$method}(new \DateTime($now));
     $expected = new \DateTime($expectedDrawDate);
     $this->assertEquals($expected, $actual);
 }
Exemple #2
0
 public function listAwards()
 {
     $awards = parent::listAwards();
     $all = $awards[0]->apportionments;
     $awards[0]->apportionments = array_slice($all, 0, 5);
     $award = new \stdClass();
     $award->title = 'Time do Coração';
     $award->apportionments = [$all[5]];
     $awards[] = $award;
     return $awards;
 }
Exemple #3
0
 public function listAwards()
 {
     $awards = parent::listAwards();
     $all = $awards[0]->apportionments;
     $award1 = new \stdClass();
     $award1->title = 'Premiação - 1º Sorteio';
     $award1->apportionments = array_slice($all, 0, 3);
     $award2 = new \stdClass();
     $award2->title = 'Premiação - 2º Sorteio';
     $award2->apportionments = array_slice($all, 3, 3);
     return [$award1, $award2];
 }
Exemple #4
0
    $act["active"] = 5;
} elseif ($data['act6'] == 0) {
    $act["pass"] = 5;
    $act["active"] = 6;
} else {
    $act["pass"] = 6;
    $act["active"] = 7;
}
$tpl->act = $act;
$tpl->data = $data;
include_once "../library/Table/Coupon.class.php";
$coupon = new Coupon();
$getcoupon = $coupon->getByRandCoupon();
$tpl->getcoupon = $getcoupon;
include_once "../library/Table/Lottery.class.php";
$lottery = new Lottery();
//以下是計算USER有無領過獎
//  date_default_timezone_set("Asia/Taipei");
// $today = date("Y-m-d");
// $today = (str)$today;
// print_r($today);
$lotteryfail = $lottery->getByLotteryFbId($_SESSION['fbId']);
$tpl->lotteryfail = $lotteryfail;
//以下是計算USER當日有無在被領100次以外
//countLotteryByDate
$todaylotteryfailtimes = $lottery->countLotteryByDate($today);
$tpl->todaylotteryfailtimes = $todaylotteryfailtimes;
//判斷該FB_ID有沒有填寫過表單,有填寫過的話則直接導頁
$ishavedata = $lottery->countLotteryFbid($_SESSION['fbId']);
$tpl->ishavedata = $ishavedata;
//print_r($ishavedata);
Exemple #5
0
 public function listAwards()
 {
     $awards = parent::listAwards();
     $awards[0]->apportionments = array_slice($awards[0]->apportionments, 0, 6);
     return $awards;
 }
Exemple #6
0
function resourcePut($api, $tools, $param)
{
    $param['fbId'] = $tools->sql_injection_anti($_SESSION["fbId"]);
    $param['issuccess'] = $tools->sql_injection_anti($_POST["issuccess"]);
    $param['isfail'] = $tools->sql_injection_anti($_POST["isfail"]);
    $param['coupon_number'] = $tools->sql_injection_anti($_POST["coupon_number"]);
    include_once "../../library/Table/Lottery.class.php";
    $lottery = new Lottery();
    $status = $lottery->getByFbId($param['fbId']);
    //print_r($status["issuccess"]);
    if ($status["issuccess"] == 1 && $status["isfail"] != 1) {
        //假如issuccess = 1存在,就更新isfail = 1並存入酷碰券
        $lottery->updateStatusFail($param['isfail'], $param['coupon_number'], $param['fbId']);
        //  $lottery->updateStatusFail($param['isfail'],$param['coupon_number'],$param['fbId']);
        ///////發信程式START/////////////////////////////
        $Body = '<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>桂冠 :::簡單做開心吃 快樂料理在我家:::</title>
</head>
<body style="margin:0; padding:0;">
<table width="760" border="0" cellspacing="0" cellpadding="0" style="margin:auto;">
    <tr>
        <td width="760" height="352"><img src="http://event.laurel.com.tw/2013Q4hmr/images/edm_01.png" alt="輕鬆做擁有好心情" width="760" height="352" style="display:block; line-height:0;"></td>
    </tr>
    <tr>
        <td width="760" height="39"><table width="760" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="418" height="39"><img src="http://event.laurel.com.tw/2013Q4hmr/images/edm_02.png" alt="輕鬆做擁有好心情" width="418" height="39" style="display:block; line-height:0;" ></td>
                    <td width="101" height="39" bgcolor="#fae9cc" style="font-size:18px; color:#f49d36; font-weight:bold;">' . $param['coupon_number'] . '</td>
                    <td width="241" height="39"><img src="http://event.laurel.com.tw/2013Q4hmr/images/edm_10.png" alt="輕鬆做擁有好心情" width="241" height="39" style="display:block; line-height:0;" ></td>
                </tr>
            </table></td>
    </tr>
    <tr>
        <td width="760" height="188" ><table width="760" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="217" height="188" ><img src="http://event.laurel.com.tw/2013Q4hmr/images/edm_03.png" alt="複製編號" width="217" height="188" style="display:block; line-height:0;"></td>
                    <td width="172" height="188" ><a href="http://my.laurel.com.tw/" title="登入線上購物去" target="_blank" style="border:0 none;"><img src="http://event.laurel.com.tw/2013Q4hmr/images/edm_04.png" alt=" 登入線上購物去" width="172" height="188" style="display:block; line-height:0;border:0 none;"></a></td>
                    <td width="171" height="188" ><img src="http://event.laurel.com.tw/2013Q4hmr/images/edm_06.png" alt=" 購滿$500" width="171" height="188" style="display:block; line-height:0;"></td>
                    <td width="200" height="" background="http://event.laurel.com.tw/2013Q4hmr/images/edm_07.png" style="font-size:16px; color:#f49d36; font-weight:bold; padding:22px 0 0 95px;" >' . $param['coupon_number'] . '</td>
                </tr>
            </table></td>
    </tr>
    <tr>
        <td width="760" style="padding:10px 50px; color:#f49d36; " height="207" bgcolor="#fdfbec"> 本券使用說明:<br>
            1. 本券僅限<a href="http://my.laurel.com.tw/" title="登入線上購物去" target="_blank" style="border:0 none;"><img src="http://event.laurel.com.tw/2013Q4hmr/images/Mylaurel.png" alt="My Laurel" width="68" height="15" align="absmiddle" style="line-height:0;border:0 none;"></a>線上購物使用,不得要求兌換現金。<br>
            2. 使用時間至:2014/2/28 PM24:00止,逾期等同作廢。<br>
            3. 本券折價編號僅限用一次,單次消費滿$500以上,方可使用。<br>
            4. 於線上購物結帳時,在結帳頁面輸入【折價券編號】即可享有折價優惠。<br>
            5. 請妥善保存本券編號,如因個人行為導致編號遺失,恕不補發。<br>
            6.「桂冠實業股份有限公司」保留修改活動之權利。<br></td>
    </tr>
    <tr>
        <td width="760" height="61" > <img src="http://event.laurel.com.tw/2013Q4hmr/images/edm_05.png" alt="輕鬆做擁有好心情" width="760" height="61" style="display:block; line-height:0;"> </td>
    </tr>
</table>
</body>
</html>';
        //此段為電子郵件資料,能顯示會員帳號並分行,再加上一段超連結供會員點選
        //此段能顯示電子郵件出處,且中文資料不會出現亂碼
        $Type = "Content-Type: text/html; charset=UTF-8\r\n";
        $Form = "From:" . "桂冠家庭代餐-活動小組" . '<*****@*****.**>' . "\r\n";
        //此段是要設定資料的類型
        $Header = $Type . $Form;
        //此段為檔頭設定
        $Subject = "=?UTF-8?B?" . base64_encode("桂冠家庭代餐-Coupon通知信") . "?=";
        //此段為郵件的主旨設定
        mail($status["email"], $Subject, $Body, $Header);
        //此處以會員電子郵件當作寄出位置}}
        ///////發信程式END/////////////////////////////
        ///發信完就刪除特定酷朋序號
        $coupon->deleteEmailCoupon($getcoupon["coupon"]);
    } else {
        if ($status["isfail"] == 1 && $status["issuccess"] != 1) {
            //假如isfail = 1存在,就更新issuccess = 1
            $lottery->updateStatusSuccess($param['issuccess'], $param['fbId']);
        }
    }
    return;
}
Exemple #7
0
include_once LIB_PATH . 'Table/LogLike.class.php';
include_once LIB_PATH . 'Table/Game.class.php';
include_once LIB_PATH . 'Table/LogActStart.class.php';
include_once LIB_PATH . 'Table/LogActFinish.class.php';
include_once LIB_PATH . 'Table/LogInviteFriend.class.php';
include_once LIB_PATH . 'Table/Lottery.class.php';
include_once LIB_PATH . 'Table/User.class.php';
$logClick = new LogClick();
$result_log = $logClick->listClickLog();
if (!empty($result_log)) {
    $logLike = new LogLike();
    $tbGame = new Game();
    $logActStart = new LogActStart();
    $logActFinish = new LogActFinish();
    $logInviteFriend = new LogInviteFriend();
    $tbLottery = new Lottery();
    $tbUser = new User();
    foreach ($result_log as $key => $value) {
        $tempRow = $value;
        // 按讚人數
        $countLike = $logLike->countLikeLogByDate($tempRow['log_date']);
        $tempRow["count_like"] = $countLike;
        // 確認進入遊戲人數
        // $countGameUser = $tbGame->countGameUserByDate($tempRow['log_date']);
        // $tempRow["count_game_user"] = $countGameUser;
        $listGameUser = $tbGame->listGameUserByDate($tempRow['log_date']);
        if (!empty($listGameUser) and is_array($listGameUser)) {
            $tempRow["count_game_user"] = count($listGameUser);
            // 因為此活動而進入遊戲的人數
            $tempRow["count_already_join"] = 0;
            $gameUserArray = array();
Exemple #8
0
		<TR><TD colspan=10 align=center bgcolor=d2d2d2><b>Зачеркните 5 чисел</b></TD></TR>
		<TR>
		<SCRIPT>
		for (i=1;i<=30;i++) 
		{
			document.write("<TD width=20 align=center class=\\"unselect\\" id="+i+" onclick=\\"add("+i+")\\">&nbsp;"+i+"&nbsp;</TD>");
			if (i % 10 == 0) document.write("</TR><TR>")
		}
		</SCRIPT>
		</TR>
		</TABLE><BR>
		Выбраные Вами номера : <input style="border: 0px solid #000;color:green;font-weight: bold; background:transparent;" type="text" readonly="true" id="value" name="value" />';
        return $str;
    }
}
$Lottery = new Lottery();
if ($_POST['value']) {
    echo $Lottery->buy_ticket($_POST['value']);
}
$sql = "select * from lottery where end=0 order by id DESC LIMIT 1;";
$res = mysql_query($sql);
while ($result = mysql_fetch_assoc($res)) {
    $id_lottery = $result['id'];
    $date = $result['date'];
    $jackpot = $result['jackpot'];
    $fond = $result['fond'];
    $summ_5 = $result['summ_5'];
    $summ_4 = $result['summ_4'];
    $summ_3 = $result['summ_3'];
    $count_5 = $result['count_5'];
    $count_4 = $result['count_4'];