Exemplo n.º 1
0
 def queryByUserid(parameter):
     template = t_query_user_userid
     r = db.runQuerySql(template, parameter, 1)
     #print r
     if r is None:
         return r
     return User(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10])
Exemplo n.º 2
0
 def insertWorks(parameter):
     template = t_insert_works
     #r = db.insert_works(u_id, w_name, cont, img, d_post, p_id)
     r = db.runInsertSql(template, parameter)
     template = t_query_lastworks
     r = db.runQuerySql(template, parameter, 1)
     return r[0]
Exemplo n.º 3
0
 def queryActivity(parameter):
     template = t_query_activity
     r = db.runQuerySql(template, parameter, 2)
     if r is None:
         return None
     a = Activity(r[0], r[1], r[2], r[3])
     return a
Exemplo n.º 4
0
 def query_nActivity(parameter):
     template = t_query_nactivity
     l = db.runQuerySql(template, parameter, 2)
     activityList = []
     if l is None:
         return activityList
     for r in l:
         a = Activity(r[0], r[1], r[2], r[3])
         activityList.append(a)
     return activityList
Exemplo n.º 5
0
 def get_usersworks(parameter):
     template = t_query_usersworks
     l = db.runQuerySql(template, parameter, 2)
     res = []
     if l is None:
         return res
     for r in l:
         w = Works(r[0], r[1], r[2], r[3], r[4], r[5], r[6])
         res.append(w.getWorksInfo())
     return res
Exemplo n.º 6
0
 def queryAllUser():
     parameter = {}
     template = t_query_alluser
     l = db.runQuerySql(template, parameter, 2)
     userList = []
     if l is None:
         return userList
     for r in l:
         u = User(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10])
         userList.append(u)
     return userList
Exemplo n.º 7
0
 def queryComment(parameter):
     template = t_query_comment
     r = db.runQuerySql(template, parameter, 2)
     commentList = []
     if r is None:
         return commentList
     for item in r:
         com = {}
         com['c_id'] = item[0]
         com['txt'] = item[1]
         com['w_id'] = item[2]
         com['u_id'] = item[3]
         com['d_post'] = item[4]
         com['nick'] = item[5]
         com['photo'] = item[6]
         com['sex'] = item[7]
         commentList.append(com)
     return commentList
Exemplo n.º 8
0
 def getFans(parameter):
     template = t_query_fans
     r = db.runQuerySql(template, parameter, 2)
     fanlist = []
     if r is None:
         return fanlist
     for item in r:
         parameter = {}
         parameter['id'] = item[0]
         parameter['nick'] = item[3]
         parameter['photo'] = item[4]
         parameter['birth'] = item[5]
         parameter['reg_date'] = item[6]
         parameter['signa'] = item[7]
         parameter['fol'] = item[8]
         parameter['fan'] = item[9]
         parameter['sex'] = item[10]
         fanlist.append(parameter)
     return fanlist
Exemplo n.º 9
0
 def queryWorks(parameter):
     tamplate = t_query_works
     p_name = [u'手绘', u'板绘', u'PS', u'厚涂', u'水彩']
     #r = db.query_works(worksid)
     r = db.runQuerySql(tamplate, parameter, 1)
     workInfo = {}
     if r is None:
         return None
     workInfo['w_id'] = r[0]
     workInfo['u_id'] = r[1]
     workInfo['w_name'] = r[2]
     workInfo['cont'] = r[3]
     try:
         workInfo['img'] =json.loads(r[4])
     except:
         workInfo['img'] = r[4]
     workInfo['d_post'] = r[5]
     print r[6]
     workInfo['p_id'] = p_name[r[6] - 1]
     return workInfo
Exemplo n.º 10
0
 def find_user(parameter):
     template = t_query_countuser_username
     r = db.runQuerySql(template, parameter, 1)
     if r[0] == 0:
         return False
     return True
Exemplo n.º 11
0
 def queryAdmin(parameter):
     template = t_query_admin
     r = db.runQuerySql(template, parameter, 1)
     if r is None:
         return None
     return Manager(r[0], r[1], r[2])
Exemplo n.º 12
0
 def hasSignActivity(parameter):
     template = t_query_sign_ac
     r = db.runQuerySql(template, parameter)
     if r[0] == 1:
         return False
     return True
Exemplo n.º 13
0
 def hasFollow(parameter):
     template = t_query_relationship
     r = db.runQuerySql(template, parameter, 1)
     if r is None:
         return False
     return True