IndexAction::addPostDigg PHP 메소드

addPostDigg() 공개 메소드

public addPostDigg ( )
    public function addPostDigg()
    {
        $maps['post_id'] = $map['post_id'] = intval($_POST['row_id']);
        $map['uid'] = $this->mid;
        $hasdigg = M('weiba_post_digg')->where($map)->find();
        $weiba = M('weiba_post')->where('post_id=' . $map['post_id'])->find();
        // $is_follow = $this->is_follow($weiba['weiba_id']);
        // if(!$is_follow){
        // 	echo 0;exit;
        // }
        $map['cTime'] = time();
        $result = M('weiba_post_digg')->add($map);
        if ($result && !$hasdigg) {
            $post = M('weiba_post')->where($maps)->find();
            M('weiba_post')->where($maps)->setField('praise', $post['praise'] + 1);
            model('UserData')->updateKey('unread_digg_weibapost', 1, true, $weiba['post_uid']);
            echo 1;
        } else {
            echo 0;
        }
    }