<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class MedalAction extends BaseAction
{
    public function run()
    {
        $this->getController()->isLogin();
        $this->getController()->isVerify();
        
        if (empty($_SESSION['user']['wa']))
        {
            iforward(url('system',array('s'=>'props','c'=>'wa')));
        }
        
        $medalId = $_SESSION['user']['wa']['id'];
        $expire = $_SESSION['user']['wa']['expire'];
        unset($_SESSION['user']['wa']);
        
        $this->db()->update(Memberfields::table())->value(array('medals'=>$medalId.'|'.$expire))->where('uid='.$this->uid())->q();
        
        $message[] = '勋章领取成功!';
        $message[] = '返回'.ilink('继续挖宝',url('system',array('s'=>'props','c'=>'wa'))).'.'.$this->getController()->indexLink('道具中心');
        
        $this->showMessage($message);
    }
}