<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class VerifyAction extends MemberAction
{
    public function run()
    {
        $uid = S::gp('uid','G',2);
        $fuid = S::gp('fuid','G',2);
        
        if ($this->uid() != $fuid)
        {
            throw new iSystemException('非法请求');
        }
        $member = Members::single()->getOne($fuid);
        if (empty($member))
        {
            throw new iSystemException('添加的好友不存在');
        }
        
        Friends::single()->create($uid, $fuid);
        
        $message[] = '添加好友成功';
        $message[] = '返回'.ilink('好友',url('system',array('s'=>'member','c'=>'friend'))).'.'.memberLink();
        $this->showMessage($message);
    }
}