<?php
@header("Content-type: text/html; charset=utf-8");
require_once(dirname(__FILE__) . '/../common/db.class.php');
require_once(dirname(__FILE__) . '/../smarty/Smarty.class.php');
require_once(dirname(__FILE__) . '/../common/session_helper.php');
require_once(dirname(__FILE__) . '/../common/function.php');
$style='meepo';
//获取wall_config
$load->model('Wall_model');
$wall_config=$load->wall_model->getConfig();

$load->model('Weixin_model');
$weixin_config=$load->weixin_model->getConfig();

//获取奖品列表
$load->model('Lottery_model');
$awardlist=$load->lottery_model->getAwards('threedimensionallottery');

$load->model('Attachment_model');
foreach($awardlist as $k=>$v){
	if($v['imagepath']>0){
		$img=$load->attachment_model->getById($v['imagepath']);
		$awardlist[$k]['imagepath']=$img['filepath'];
	}else{
		$awardlist[$k]['imagepath']='/wall/themes/meepo/assets/images/defaultaward.jpg';
	}
}

$awardslist_arr=array();
foreach($awardlist as $item){
	$awardslist_arr[$item['id']]['awardimagepath']=$item['imagepath'];
	$awardslist_arr[$item['id']]['awardname']=$item['awardname'];
}

$smarty = new Smarty;
$smarty->caching = false;
$apppath=str_replace(DIRECTORY_SEPARATOR.'wall', '', dirname(__FILE__));
$smarty->compile_dir = $apppath.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'templates_c'.DIRECTORY_SEPARATOR;
$smarty->assign('from','cjresult');
$smarty->assign('wall_config',$wall_config);
$smarty->assign('awardlistjson',json_encode($awardslist_arr) );
$smarty->assign('erweima',$weixin_config['erweima']);

$smarty->display('themes/'.$style.'/header.html');
$smarty->display('themes/'.$style.'/3dlottery.html');
$smarty->display('themes/'.$style.'/footer.html');