<?php
/**
 * 手机端摇一摇界面
 * PHP version 5.4+
 * 
 * @category Mobile
 * 
 * @package Shake
 * 
 * @author fy <jhfangying@qq.com>
 * 
 * @license Copyright (c) 2017 金华迪加网络科技有限公司 版权所有
 * Copyright (c) 2017 金华迪加网络科技有限公司 版权所有
 * 未经许可，任何单位及个人不得做营利性使用
 * 
 * @link link('演示地址','http://xc.taobaodpm.com');
 * */
require_once 'common.php';
// echo var_export($userinfo);
$load->model('Plugs_model');
$plugs=$load->plugs_model->getPlugs(1);
$openid=$_GET['rentopenid'];
$isopen=false;
foreach ($plugs as $item) {
    if ($item['name']=='shake') {
        $isopen=true;
    }
}
if (!$isopen) {
    header('location:qiandao.php?rentopenid='.$openid);
}

$load->model('Shake_model');
$shake_config=$load->shake_model->getCurrentConfig();
$theme_info=$load->shake_model->getThemeById($shake_config['themeid']);
$load->model('Weixin_model');
$weixin_config=$load->weixin_model->getConfig();
$weixin_config['erweima']
    =$weixin_config['erweima']=='/wall/defaultqrcode.php'?
    '':$weixin_config['erweima'];
//模版页面相关内容
require_once '../smarty/Smarty.class.php';
$smarty = new Smarty;
$smarty->debugging = false;
$smarty->caching = false;
$smarty->compile_dir =COMPILEPATH;

$smarty->assign('title', '摇一摇');
$smarty->assign('userinfo', json_encode($userinfo));
// $smarty->assign('openid', $openid);

$smarty->assign('erweima', $weixin_config['erweima']);
$smarty->assign('theme_info', json_encode($theme_info));
$smarty->assign('shake_config', json_encode($shake_config));
$returnmsg=$load->shake_model->joingame($openid);
$smarty->assign('joingame', json_encode($returnmsg));
$smarty->assign('plugs', $plugs);
$smarty->display('template/app_header.html');
$smarty->display('template/app_shake.html');
$smarty->display('template/app_footer.html');