<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class DeleteAction extends MemberAction
{
    public function run()
    {
        $fuid = intval(S::gp('fuid','G',2));
        $friend = $this->db()->select()->from(Friends::table())->where(array('uid'=>$this->uid(),'fuid'=>$fuid))->find(true);

        if (!empty($friend))
        {
            Friends::single()->delete($this->uid(), $fuid);
            $message[] = '好友删除成功';
        }
        else
        {
            $message[] = '好友不存在';
        }
        $message[] = '返回'.ilink('好友', url('system',array('s'=>'member','c'=>'friend'))).'.'.memberLink().'.'.indexLink();
        $this->showMessage($message);
    }
}