mirror of
https://github.com/zhangxu999/fetchQzone.git
synced 2026-10-16 21:03:03 +08:00
merge two projects, fix the conflicx
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
*.pyc
|
||||
.idea
|
||||
sftp-config.json
|
||||
sftp-config.json
|
||||
@@ -1,6 +1,6 @@
|
||||
# fetchQzone
|
||||
抓取多人QQ空间说说和评论。以便分析一个人在他的好友的空间中留下的轨迹,获取有用信息。
|
||||
|
||||
部署在百度云上,详情及demo请移步:[http://ncwugirl.duapp.com/fetchQzone/search2/?user=738285867](http://ncwugirl.duapp.com/fetchQzone/search2/?user=738285867)
|
||||
部署在百度云上,详情及demo请移步:[http://fqzone.duapp.com](http://fqzone.duapp.com/)
|
||||
,
|
||||
使用Python/django/MySQL/开发
|
||||
使用Python/django/MySQL/开发
|
||||
|
||||
@@ -22,9 +22,10 @@ class comment(models.Model):
|
||||
come=models.ForeignKey(people,related_name='come');
|
||||
to=models.ForeignKey(people,related_name='to');
|
||||
time=models.DateTimeField();
|
||||
|
||||
info=models.TextField(null=True,blank=True);
|
||||
class nick(models.Model):
|
||||
"""de"""
|
||||
host=models.ForeignKey(people,related_name='host');
|
||||
guest=models.ForeignKey(people,related_name='guest');
|
||||
nick=models.CharField(max_length=30);
|
||||
nick=models.CharField(max_length=30);
|
||||
|
||||
+2
-11
@@ -1,3 +1,4 @@
|
||||
|
||||
from fetchQzone.models import people,comment,feed,nick
|
||||
from django.db import connection
|
||||
import types
|
||||
@@ -8,13 +9,11 @@ class queryTool(object):
|
||||
cursor = connection.cursor()
|
||||
sql_tmpfeed="create table tmp_feed select info,time,userID_id,feedID,nick from fetchQzone_feed,fetchQzone_nick limit 5;delete from tmp_feed;"
|
||||
sql_tmpcomment="create table tmp_comment select parent_id,come_id,to_id,info,fetchQzone_comment.time,rootID from fetchQzone_comment limit 5;delete from tmp_comment;"
|
||||
|
||||
for x in (sql_tmpfeed,sql_tmpcomment):
|
||||
try:
|
||||
cursor.execute(x)
|
||||
except :
|
||||
pass
|
||||
#cursor = connection.cursor()
|
||||
def validate(self,user="not num",friend=1,start=1,num=1):
|
||||
if type(user)!=types.IntType and type(user)!=types.LongType:
|
||||
return False
|
||||
@@ -58,14 +57,12 @@ class queryTool(object):
|
||||
#self.insertToTable("tmp_feed",cursor.fetchall())
|
||||
cursor.execute(sql_comment)
|
||||
#self.insertToTable("tmp_comment",cursor.fetchall())
|
||||
|
||||
|
||||
cursor.execute(sql_FeedtoRe)
|
||||
Result["feeds"]=cursor.fetchall()
|
||||
cursor.execute(sql_CommenttoRe)
|
||||
Result["comments"]=cursor.fetchall()
|
||||
else:
|
||||
|
||||
sql_comment=" CREATE TEMPORARY TABLE tmp_comment select parent_id,come_id,to_id,info,time,rootID from fetchQzone_comment where (come_id=%s and to_id=%s) OR (come_id=%s and to_id=%s ) order by parent_id,IDinFeed "%(user,friend,friend,user)
|
||||
sql_feed=" CREATE TEMPORARY TABLE tmp_feed SELECT fe.info,UNIX_TIMESTAMP(fe.`time`),userID_id,feedID, ni.`nick` come_nick FROM fetchQzone_feed fe JOIN tmp_comment ON parent_id=feedID JOIN fetchQzone_nick ni ON guest_id=userID_id group by feedID ORDER BY userid_id, fe.`time` DESC LIMIT %s,%s ;"%(start,num)
|
||||
sql_CommenttoRe="select parent_id,come_id,to_id,tmp_comment.info,tmp_comment.time,rootID,(select nick from fetchQzone_nick where guest_id=come_id limit 1) as come_nick,(select nick from fetchQzone_nick where guest_id=to_id limit 1) as to_nick from tmp_comment,tmp_feed where parent_id=feedID order by feedID;"
|
||||
@@ -93,6 +90,7 @@ class queryTool(object):
|
||||
# sql_comment="select distinct parent_id,come_id,to_id,info,fetchQzone_comment.time,rootID from fetchQzone_comment where parent_id='%s' order by IDinFeed "% feedID
|
||||
sql_CommenttoRe="select parent_id,come_id,to_id,info,time,rootID,(select nick from fetchQzone_nick where guest_id=come_id limit 1) AS come_nick,(select nick from fetchQzone_nick where guest_id=to_id limit 1) AS to_nick from fetchQzone_comment where parent_id='%s' order by IDinFeed"% feedID
|
||||
|
||||
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(sql_CommenttoRe)
|
||||
Result["comments"]=cursor.fetchall()
|
||||
@@ -100,8 +98,6 @@ class queryTool(object):
|
||||
Result["feeds"]=cursor.fetchall()
|
||||
cursor.close()
|
||||
return Result
|
||||
|
||||
|
||||
def getNick(self,guest_id,host_id=0):
|
||||
try:
|
||||
ni=nick.objects.filter(guest_id=guest_id)[0].nick
|
||||
@@ -151,8 +147,3 @@ class queryTool(object):
|
||||
cursor=connection.cursor()
|
||||
cursor.execute(sql)
|
||||
return cursor.fetchall()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,4 +16,4 @@
|
||||
{% endblock timeanaly %}
|
||||
{% block friend %}
|
||||
<a href="intimacy/?user={{params.user}}">查看亲密度排行</a><br><br>
|
||||
{% endblock friend %}
|
||||
{% endblock friend %}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<a href="/fetchQzone?user={{come}}">{{come_nick|default:come}}</a>
|
||||
回复
|
||||
<a href="/fetchQzone?user={{to}}">{{to_nick|default:to }}</a>
|
||||
|
||||
{% endif %}
|
||||
{{info|safe}}
|
||||
</div>
|
||||
@@ -42,4 +43,5 @@
|
||||
{% empty %}
|
||||
<div id="headtitle">木有了~~~~看完了/(ㄒoㄒ)/~~*^_^* …… *^_^*</div>
|
||||
{% endfor %}
|
||||
{% endblock feed %}
|
||||
{% endblock feed %}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{% block title %}
|
||||
说说和评论
|
||||
{% endblock title %}
|
||||
<<<<<<< HEAD
|
||||
{% block commonFriends %}
|
||||
|
||||
<BR>
|
||||
@@ -13,4 +14,4 @@
|
||||
<em>{{params.user_nick|default:params.user}} </em>与<em> {{params.friend_nick|default:params.friend}} </em>相互评论及说说:
|
||||
{% endblock discribe %}
|
||||
{% block friend %}
|
||||
{% endblock friend %}
|
||||
{% endblock friend %}
|
||||
|
||||
@@ -18,4 +18,3 @@ class QueryTests(TestCase):
|
||||
self.assertEqual(qu.validate(mm),False)
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -196,4 +196,5 @@ def intimacy(request):
|
||||
return HttpResponse(json.dumps(Result))
|
||||
else:
|
||||
nick=querytool.getNick(user)
|
||||
return render(request,"fetchQzone/intimacy.html",{"user":user,"nick":nick})
|
||||
return render(request,"fetchQzone/intimacy.html",{"user":user,"nick":nick})
|
||||
|
||||
|
||||
+2
-2
@@ -84,10 +84,10 @@ STATIC_ROOT = ''
|
||||
STATIC_URL = '/static/'
|
||||
#DOMAIN
|
||||
domain="www.ncwugirl.duapp.com"
|
||||
#STATIC_URL = '/static/'
|
||||
STATIC_URL = '/static/'
|
||||
QINIU_URL='http://ncwugirl.qiniudn.com/'
|
||||
# Additional locations of static files
|
||||
STATICFILES_DIRS = (
|
||||
|
||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
|
||||
Reference in New Issue
Block a user