0, 'info' => '', 'data'=>''); if(empty($user_id)){ $result['info'] = '请先登陆!'; die($json->encode($result)); } try { $sql = 'INSERT INTO '. $ecs->table('supplier_guanzhu') . ' (`userid`, `supplierid`, `addtime`) VALUES ('.$user_id.','.$_GET['suppId'].','.time().') ON DUPLICATE KEY UPDATE addtime='.time(); $db->query($sql); if($db->affected_rows() > 1){ $result['error'] = 2; $result['info'] = '已经关注!'; }else{ $result['error'] = 1; $result['info'] = '关注成功!'; } } catch (Exception $e) { $result['error'] = 2; $result['info'] = '已经关注!'; } die($json->encode($result)); } ?>